2

My project is to do speaker recognition using a microphone.

I'm using the speeh_recognition library to extract my microphone audio, but the object's class is 'speech_recognition.AudioData' and i don't know how to convert it into a wav file (in order to use librosa for example to then get audio features and maybe recognize the speaker).

Could someone please help me on that ? I have been learning Python for not so long so there might also be easier ways to do speaker recognition using a mic :) Many thanks !

Maureen
  • 23
  • 1
  • 4

1 Answers1

4

write audio to a WAV file:

with open("microphone-results.wav", "wb") as f:
    f.write(audio.get_wav_data())

Quoting the doc:

Returns a byte string representing the contents of a WAV file containing the audio represented by the AudioData instance.

Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103