【发布时间】:2020-10-25 19:46:47
【问题描述】:
我已经加载了一个模型以在 Jupyter Notebook 上进行测试,并为我计划测试的 wav 音频文件创建了一个路径:
anger = "C:\\Desktop\\Emotion Speech Recognition\\D_10\\10ANG_XX.wav"
但是,在我从另一个 Python 文件中提取了这些功能之后,我似乎遇到了这个错误,我不太确定我是否正确读取了音频路径,或者是否需要进行转换。 请看下文。任何建议或解释都会有所帮助!
P.S 这是我第一次做音频处理。 :)
ParameterError Traceback (most recent call last)
<ipython-input-6-d282e0102c33> in <module>
1 # extract features and reshape it
----> 2 features = extract_feature(anger, mfcc=True, chroma=True, mel=True).reshape(1, -1)
~\Desktop\Emotion Speech Recognition\Emotion_Speech_Recognizer.py in extract_feature(file_name, **kwargs)
52
53 if chroma or contrast:
---> 54 stft = np.abs(librosa.stft(floaty_num))
55 new_audio_result = np.array([])
56 if mfcc:
~\anaconda3\lib\site-packages\librosa\core\spectrum.py in stft(y, n_fft, hop_length, win_length, window, center, dtype, pad_mode)
213
214 # Check audio is valid
--> 215 util.valid_audio(y)
216
217 # Pad the time series so that frames are centered
~\anaconda3\lib\site-packages\librosa\util\utils.py in valid_audio(y, mono)
266 if mono and y.ndim != 1:
267 raise ParameterError('Invalid shape for monophonic audio: '
--> 268 'ndim={:d}, shape={}'.format(y.ndim, y.shape))
269
270 elif y.ndim > 2 or y.ndim == 0:
ParameterError: Invalid shape for monophonic audio: ndim=2, shape=(96768, 2)
【问题讨论】:
-
请将回溯作为文本而不是图像包含
-
您需要提供加载文件的代码,直到出现错误为止
标签: python machine-learning artificial-intelligence audio-processing librosa