Close

Audiobook cutter script

A project log for ABPlayer Mini - AudioBook Player

An audio book player based on the DFPlayer Mini module

AccidentalRebelAccidentalRebel 11/07/2019 at 14:520 Comments

I wanted to make a script that would cut an audio book into smaller files so that my player can play one file after another but also allow going forwards and backwards.

My idea was that the script would cut every 5 minutes but at a point of silence. Audio books have lots of silent moments in between speeches so the script would just move forward in time until it reaches silence.

I searched online to get ideas on how to go about in doing this until I chanced upon this solution. It' different from what i wanted as it cuts at silences that matches a specific duration like 2 seconds.

I tested this script out and found that it actually works just as good. The length of each file differs wildly but I think it doesn't really matter. As long as my player can move forwards and backwards it doesn't matter how much as long as I get to the point that I want.

I experimented a bit more with the above solution and found that a silence duration of 10.0 seconds is best for my needs.

sox -V3 audiobook.mp3 audiobook_part_.mp3 silence -l 0 1 10.0 0.1% : newfile : restart 

With the above command, a 13 hour audiobook has been split to 1014 files.

13 hours is 46,800 seconds. Divide that by 1014 files means that each file should have around an average 45 seconds each. This means pressing the next and previous buttons should jump more or less 45 seconds. Not bad.

I'm going to be sticking with this setup for now. We'll see if the places where the audio is cut makes sense. If not, then I could just run the script again and just change the silence duration.

Discussions