[LAU] audio collage?

Atte André Jensen atte.jensen at gmail.com
Sat Jan 9 07:14:28 EST 2010


Renato wrote:

> ha, I guess the sox you have doesn't handle mp3. does 'play file.mp3'
> work? It was the first time I ever used sox so I'm no expert...
> probably compile time options?

No:

atte at vestbjerg:~/tmp/collage/licks$ play do_you_like_it.mp3
play FAIL formats: no handler for file extension `mp3'

Indeed a compile time option. Another reason to be extra careful with sox.

>> 3) Although I did this myself, sox is not really nice to wrap in the 
>> first place, since it sometimes changes the names of the arguments
>> and stuff like that. So your script might not work after the next
>> upgrade of sox :-(
> 
> uh, this is bad news indeed

Exactly, add to that the no-mp3-support-problem, and you get headaches 
pretty soon.

>> 4) I'm not sure mp3 files are the most obvious file format to work
>> with, any specific reason you're not working with simple .wav's?
> 
> well, most of my music collection is in mp3... I guess I could prompt
> the user for which filetype to look for

Or how about this: define using mplayer to convert all found audiofiles 
(at least m4a, wma, ogg, wav, aif, flv, au, aiff, mp3 and mov should 
work) into wav, for instance by wrapping the following oneliner in 
os.system():

mplayer -vo null -vc dummy -ao pcm:waveheader FILE_TO_CONVERT

Note that that'll give you the result in audiodump.wav, so remember to 
rename that after each pass. Then to make it easier on the user, check 
if mplayer is installed at the top of the script, if not, abort, else 
proceed. Deliver the result in wav, and let the user decide of he wants 
to degrade the quality and encode to mp3.

All this means that sox should only worry about the splicing, no en- or 
decoding, which should make things a little simpler and more robust.

-- 
Atte

http://atte.dk   http://modlys.dk



More information about the Linux-audio-user mailing list