I am using python programming language,I want to join to wav file one at the end of other wav file? I have a Question in the forum which suggest how to merge two wav file i.e add the contents of one wav file at certain offset,but i want to join two wav file at the end of each other...
And also i had a prob playing the my own wav file,using winsound module..I was able to play the sound but using the time.sleep for certain time before playin any windows sound,disadvantage wit this is if i wanted to play a sound longer thn time.sleep(N),N sec also,the windows sound wil jst overlap after N sec play the winsound nd stop..
Can anyone help??please kindly suggest to how to solve these prob...
Thanks in advance
Just to build on @tom10's answer:
Instead of storing all the data then writing it at the end in one go, it writes it bit by bit. It also uses contextlib.close so you don't have to close files.
You could use
audiolab
:I would use
librosa.load
andlibrosa.write_wav
. Check out the doc herei use the SOX [1] library and then call it like
[1] http://sox.sourceforge.net/
Python 3 solution:
We can do this with the standard library as shown by tom10 and eggbert's answers.
Below is a shorter version:
Then write frames to the wav_out as they are read from the wav_in.
Python ships with the wave module that will do what you need. The example below works when the details of the files (mono or stereo, frame rates, etc) are the same: