You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The feature_extraction function requires the signal to be of shape (m, ) and fails when given a signal of shape (m, 1).
Try running the following code as a test:
frompyAudioAnalysisimportShortTermFeaturesasaFfrompyAudioAnalysisimportaudioBasicIOasaIOimportnumpyasnpFs, s=aIO.read_audio_file("data/mio_audio.wav")
print(s.shape)
Fs2, s2=aIO.read_audio_generic("data/audio_test.mp3")
print(s2.shape)
# extracting features directly from the first signal is ok_, _=aF.feature_extraction(s, Fs, 500, 500, deltas=False)
# extracting features from the second requires reshaping# causes# ValueError: shapes (250,1) and (250,40) not aligned: 1 (dim 1) != 250 (dim 0)_, _=aF.feature_extraction(s2, Fs2, 500, 500, deltas=False)
# reshaping to (m, ) fixes the issues2=s2.reshape((s2.shape[0], ))
_, _=aF.feature_extraction(s2, Fs2, 500, 500, deltas=False)
Why this matters
This is not a critical flaw but the inconsistency is annoying as it might be hard to spot when working with read_audio_generic.
Proposed fix
Add a check at the beginning of feature_extraction to detect signals in the form (m, 1) and reshape them to (m, ). OR
Return a signal with the same shape as read_audio_file from read_audio_generic.
The text was updated successfully, but these errors were encountered:
What is the problem
The feature_extraction function requires the signal to be of shape (m, ) and fails when given a signal of shape (m, 1).
Try running the following code as a test:
Why this matters
This is not a critical flaw but the inconsistency is annoying as it might be hard to spot when working with read_audio_generic.
Proposed fix
Add a check at the beginning of feature_extraction to detect signals in the form (m, 1) and reshape them to (m, ).
OR
Return a signal with the same shape as read_audio_file from read_audio_generic.
The text was updated successfully, but these errors were encountered: