views:

136

answers:

2

I am looking for a high level audio library that supports crossfading for python (and that works in linux). In fact crossfading a song and saving it is about the only thing I need.

I tried pyechonest but I find it really slow. Working with multiple songs at the same time is hard on memory too (I tried to crossfade about 10 songs in one, but I got out of memory errors and my script was using 1.4Gb of memory). So now I'm looking for something else that works with python.

I have no idea if there exists anything like that, if not, are there good command line tools for this, I could write a wrapper for the tool.

A: 

A scriptable solution using external tools AviSynth and avs2wav or WAVI:

Create an AviSynth script file: test.avs

v=ColorBars() 
a1=WAVSource("audio1.wav").FadeOut(50) 
a2=WAVSource("audio2.wav").Reverse.FadeOut(50).Reverse
AudioDub(v,a1+a2)

Script fades out on audio1 stores that in a1 then fades in on audio2 and stores that in a2.

a1 & a2 are concatenated and then dubbed with a Colorbar screen pattern to make a video. You can't just work with audio alone - a valid video must be generated.

I kept the script as simple as possible for demonstration purposes. Google for more details on audio processing via AviSynth.

Now using avs2wav (or WAVI) you can render the audio:

avs2wav.exe test.avs combined.wav

or

wavi.exe test.avs combined.wav

Good luck!

Some references:

How to edit with Avisynth

AviSynth filters reference

symmetry
DirectShowSource requires, um, Direct Show. The OP is looking for Linux Support.
Rizwan Kassim
I removed the DirectShow reference. The above was simply a proof of concept and up to the OP to adapt to his purposes.I am aware that AviSynth can be used on Linux and the link I gave to WAVI includes source code.
symmetry
A: 

A list of Python sound libraries.

http://stackoverflow.com/questions/307305/play-a-sound-with-python

PyGame or Snack would work, but for this, I'd use something like [Audioop][1].

http://docs.python.org/library/audioop.html

--- basic first steps here : http://stackoverflow.com/questions/1823480/merge-background-audio-file

Rizwan Kassim