May-09-2018, 04:42 AM
Hi,
I want to use wave library to open two or more wav files. Then use pyaudio to play all wav files at the same time. How can I do that?
To open and read the wav file, I use the following commands:
Or is there any simple way to mix the audio?
I want to use wave library to open two or more wav files. Then use pyaudio to play all wav files at the same time. How can I do that?
To open and read the wav file, I use the following commands:
wf = wave.open('file.wav', 'rb') data = wf.readframes(chunk)I understand that to mix the audios, I can simply add the waveforms together. But the readframes() function returns a string of bytes, and each audio sample data is a signed 16-bit (2 bytes) data. How can I extract signed 16-bit data from string of bytes?
Or is there any simple way to mix the audio?