'Can't stream bytes of audio from pyaudio
I have this program that streams bytes from the audio that my microphone gets through pyaudio, but i have a problem, is that i send this bytes to a flask webapp where i receieve it and decode since it first it's encoded to base64, but when i try to play the audio it doesn't play at all
Here are the python-bytes with the failing wav
Here are the python-bytes that work correctly
Here it is the python code that receives the data sent from another program that i made
@app.route('/api/audio', methods=['POST', 'GET'])
def apiaudio():
stream = b64.b64decode(request.data)
def sound():
wav_header = genHeader(RATE, 16,CHANNELS)
data = wav_header
data += stream
with open('readme.txt', 'w') as f:
f.write(str(data))
yield(data)
while True:
data = stream
yield(data)
return(Response(sound(), mimetype="audio/x-wav"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
