How to read stream of .wav bytes in python

pyaudio, python, wav, wave

Solution

from scipy.io import wavfile
fs, data = wavfile.read('your file path')

Problem

Is there a way to read frames of .wav format binary data? I am streaming .wav binary to a python server which I want to be able to read and use from processing by pyaudio, which complains about the frame size. Since I cannot use `wave.open('filename.wav')`, because I already have the binary data being streamed, is there a way to read the binary data so that I can use the `readframes` method in the `wave` python library? EDIT: I tried streaming `readframes` from the client side, however pyaudio gives an error that the bytes are not in .wav format. It would be ideal however if I can get this done on the server.

Original source

Related problems