【发布时间】:2022-02-02 18:44:58
【问题描述】:
我正在关注 simple_audio 上的音频识别 tensorflow 教程。笔记本很好用。
下一步,我想录制自己的声音,然后通过 tensorflow 训练的模型运行它。 我首先生成了一段录音:
seconds=1
sr=16000
nchannels=1
myrecording = sd.rec(int(seconds * sr), samplerate=sr, channels=nchannels)
sd.wait()
wavfile.write(filename, sr, myrecording)
到目前为止一切顺利,我可以播放我的录音了。但是当我尝试使用tf.audio.decode_wav 加载文件时,类似于:
audio_binary = tf.io.read_file(filename)
audio, _ = tf.audio.decode_wav(audio_binary)
我收到以下错误:
InvalidArgumentError:WAV 的音频格式错误:预期为 1 (PCM),但得到了 3 [Op:DecodeWav]
非常感谢任何关于可能出错的指针。
【问题讨论】:
标签: tensorflow