Re: audio collage?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lördag 09 januari 2010 13:45:14 skrev  Renato:
> On Sat, 09 Jan 2010 13:14:28 +0100
> 
> Atte André Jensen <atte.jensen@xxxxxxxxx> wrote:
> > 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@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.
> 
> yeah, but all files would be converted entirely to wav, taking up
> potentially much hard disk space... I was concerned about this. Instead
> with
> sox in.mp3 out.wav trim 1:35 5
> you'll end up with a wav of 5 seconds... Since anyway for the purpose
> of the script I'd have to trim them, I prefer it.
> Does mplayer have a way to trim? i.e. outputting only a portion of the
> file, not the whole from beggining to end

You could use:
mplayer -ss 10 -endpos 2 -ao pcm:waveheader ~/sound/mp3/01.mp3

which means start at 10 sec and play for 2 sec and dump to audiodump.wav

But you could also go for a more generic python way and use pymedia. Here's an 
example.
http://pymedia.org/tut/src/dump_wav.py.html

But you also used sox to mix and do other stuff which I don't know if pymedia 
will do.

regards,


/bengan
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/listinfo/linux-audio-user


[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux