Package: audioclipextractor
Audio Clip ExtractorThis utility allows one to cut multiple clips from a single or multiple audio files.The idea of this project came up when I was doing someShadowing. The problem was that the dialogs were long, so if I wanted to practice a certain phrase or word I would have to manually rewind it. So I thought, if I can split them in different files I'd be able to practice each separately.Also, since this script can embed text as metadata in the outputted clips themselves the next step would be to create an application that takes all these clips and automatically arranges them in a way that makes shadowing even easier to practice.RequirementsThis project depends onFFMPEG. It can be downloaded for freehere.
After installing it, you can either add it to yourPATHor pass it as an argument--ffmpeg <ffmpeg_path>.For each audio file there needs to be a file with the same name but with.txtextension with the respective clips' timestamps (check under sectionHow it worksfor further information).Note:In future versions it will be possible to pass timestamps as optional arguments.InstallationUsepipwith following command:$pipinstallaudioclipextractorHow it works$ ace audio_to_cut_from.mp3The script looks for a file with the same name as the audio file but with the extension.txt. The format of this file is the same as the track labels' file that you can export usingAudacityby going to the menuFile > Export Labels...orTracks > Edit Labels...and thenExport.<begin_clip:seconds> <end_clip:seconds> [<text>]Begin clipCANNOTbe equal to or greater thanEnd clip.Example:1.50    6.20    Hello World!
10      24.70   Because I said so.
33.85   36The<text>part is completely optional, but if provided it will be embedded in the respective outputted clip as metadata. The default name ism_textbut it can be set by passing the option argument--text-var <desired_name>or-m <desired_name>.It can also be piped to, example:$ find . -name '*.mp3' -type f | audioclipextractor --zipBut since we can't have a single specifications file for multiple audio files, this isn't very useful yet. In the future we will be able to, for instance, cut out the first 15s for each file.Comand Line Options--version, -V
    Prints the version of the script

--zip, -z
    Archive the output in a zip container

--ffmpeg <FILEPATH>
    Specify the FFMPEG executable path

--output-dir, -o
    Set the output directory

--text-name, -m
    Specify the name of the embedded text variable

[files]
    Audio files to processHow to use it in your projectsI recommend installingvirtualenvto create an isolated environment.Example:$ pip install virtualenv
$ virtualenv venv
$ source venv/bin/activate
$ pip install audioclipextractor
(venv) $ ace audio_to_cut_from.mp3example.pyfromaudioclipextractorimportAudioClipExtractor,SpecsParser# Inicialize the extractorext=AudioClipExtractor('/path/to/audio/file.mp3','/path/to/ffmpeg')# Define the clips to extract# It's possible to pass a file instead of a stringspecs='''3.5     17      Winter is coming.26      32.4    Summer child.40      58.9    Hodor. Hodor. Hodor.'''# Extract the clips according to the specs and save them as a zip archiveext.extract_clips(specs,'/path/to/output/directory',zip_output=True)NotesThis is still a work in progress. Feel free to use it, fork it and give suggestions.LicenseAudioClipCutter is available under theMIT License.