python - Python 上麦克风的 Wav 文件

标签 python audio speech-recognition wav microphone

我的项目是使用麦克风进行说话人识别。

我正在使用 speeh_recognition 库来提取我的麦克风音频,但该对象的类是“speech_recognition.AudioData”,我不知道如何将其转换为 wav 文件(例如为了使用 librosa)获取音频功能并可能识别说话者)。

有人可以帮我吗?我学习 Python 的时间不长,所以可能还有更简单的方法来使用麦克风进行说话人识别:) 非常感谢!

最佳答案

将音频写入 WAV 文件:

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

引用doc :

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

关于python - Python 上麦克风的 Wav 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46738569/

相关文章:

python - 在 python 中散列字符串会返回错误的结果?

android - 媒体播放器播放两次

python - 语音识别 Python 出现奇怪的请求错误

python - 时间增量,以小时、分钟、秒、微秒格式表示

python - 如何使用 BeautifulSoup 访问 div 的 id?

ios - iOS AVPlayer没有声音

swift - SFSpeechRecognizer 不可用

google-api - 使用 Electron/ Chrome 浏览器时出现 SpeechRecognition 网络错误

python - 提前比较两个或多个 csv 文件

matlab - FFT 和改变频率以及矢量化 FOR 循环