I want to process an audio blob in python that is received via socketio from a javascript client.
I want the audio data as numpy array to process it, but I don't seem to be able to convert the blob properly.
The audio blob contains:
[Float32Array[32768], Float32Array[32768]]
In python, I tried:
@socketio.on('gotaudio')
def get_audio(blob):
//CONVERT THE BLOB
data = blob[0]
dat = np.array(json.loads(data));
//DO SOME SIGNAL PROCESSING
fftData=abs(np.fft.rfft(dat))**2;
....
But this throws the error:
TypeError: expected string or buffer
How can I transform the audio blob correctly so that it can be processed with np.fft?
Have you tried using base64.b64decode() on it first? (base64 is in the standard lib)
It would help to get an example blob.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With