how to load an audio file instead of recording
DolphinRidz opened this issue · 4 comments
I want to load a pre-existing audio file into test.py instead of recording. What changes should I make?
Reply asap.
Hi @DolphinRidz ,
What tutorial you're talking about ? share link to code here.
Thanks,
https://github.com/x4nth055/pythoncode-tutorials/blob/master/machine-learning/speech-emotion-recognition/test.py
@x4nth055 Actually I want to apply a trained model on the RAVDESS dataset. I have created a dataset by splitting audio files. I want to apply my model to the same. But it is not working
file = 'chunk56.wav'
data , sr = librosa.load(file)
data = np.array(data)
ans =[]
new_feature ,labels = extract_feature('chunk9.wav', mfcc=True, chroma=True, mel=True)
ans.append(new_feature)
ans = np.array(ans)
data.shape
Emotion_Voice_Detection_Model.predict([ans])
This is what I am doing and it does not work.
file = 'chunk4.wav'
ans =[]
new_feature = extract_feature(file, mfcc=True, chroma=True, mel=True)
ans.append(new_feature)
ans = np.array(ans).T
print(np.shape(ans))
Emotion_Voice_Detection_Model.predict([ans])
it gives error as:
Invalid shape for monophonic audio: ndim=2, shape=(2520138, 2)