Skip to content Skip to sidebar Skip to footer

Linux And Python: Combining Multiple Wave Files To One Wave File

I am looking for a way that I can combine multiple wave files into one wave file using python and run it on linux. I don't want to use any add on other than the default shell comma

Solution 1:

You need to set the number of channels, sample width, and frame rate:

waveFileC.setnchannels(waveFileA.getnchannels())
waveFileC.setsampwidth(waveFileA.getsampwidth())
waveFileC.setframerate(waveFileA.getframerate())

If you want to handle a.wav and b.wav having different settings, you'll want to use something like pysox to convert them to the same settings, or for nchannels and sampwidth you may be able to tough through it yourself.

Solution 2:

Looks like you need to call n=waveFileA.getnchannels() to find out how many channels the first input file uses, likewise for waveFileB, then you'll need to use waveFileC.setnchannels(n) to tell it how many channels to put in the outgoing file. I don't know how it will handle input files with different numbers of channels...

Solution 3:

Here is the answer I am looking for

How to join two wav files using python? (look for a thread by Tom 10)

It's in another thread. some one already solved this problem.

Post a Comment for "Linux And Python: Combining Multiple Wave Files To One Wave File"