I am looping through a large wave file, via a dictionary of new file names, lengths and versions. The loop exports the individual slices as files:
mix.export(key, format='wav')
However, it converts the original 24-bit file to 32-bit slices. I have been doing a round trip to pro tools to get the files back to 24, as I can't figure out either ffmpeg settings, or getting the slice into a subprocess.
I have tried several variations of this theme:
mix.export(key, format='wav', codec='pcm_s24le')
As well as this one:
mix.export(k, format='wav', parameters=['ffmpeg', '-i', '-acodec', 'pcm_s24le', '-ar', '48000'])
I can't seem to get the individual slices to work in the following subprocess call. key
is the file name from the key-value pair. This works well in the 32-bit export, but not sure how to make it work when a slice's temp file, such as /var/folders/vc/q7jggn7900l099w45463lgx40000gn/T/tmpw_6mxyg8
needs to be called.
subprocess.call(['ffmpeg', '-i', key,
'-acodec', 'pcm_s24le', '-ar', '48000', 'output.wav'])
Hoping for slices of the exact same format as the original input:
mix_file = AudioSegment.from_wav(file_name)