novoic/surfboard

TypeError: expected dtype object, got 'numpy.dtype[float64]' Error while extracting formants and Linear Spectral Frequeny

Cybernorse opened this issue · 1 comments

Hello there! I an Waqar Ahmad, i was trying to extract frequency formants from a simple librosa example audio file and got this error.
I am using google colab
python version 3.7
surfboard version 0.2.0
i am on ubuntu 20.04
my code is as following;

import surfboard
from surfboard.sound import Waveform

sound = Waveform(path= "/content/cough_noise_reduced.wav")
formant = sound.formants()
print(formant)

and it gives me the following error:


TypeError                                 Traceback (most recent call last)

<ipython-input-11-d498dfc58740> in <module>()
----> 1 formants = sound.formants()

3 frames

/usr/local/lib/python3.7/dist-packages/librosa/core/audio.py in lpc(y, order)
    900     util.valid_audio(y, mono=True)
    901 
--> 902     return __lpc(y, order)
    903 
    904 

TypeError: expected dtype object, got 'numpy.dtype[float64]'

i have also tried "get_formants()" method but it returns the same error, also it specifies numpy dtype as float64 in the error even though the waveform is dtype float32.
i have also tried feature extraction method it returns dataframe with a single Nan value.
any information on that will be appreciated, thank you.

i was able to resolve this issue with a fresh python virtual environment, but not everything is working well, for example i am unable to extract formants and linear spectral frequencies.
fortunately found solution to this problem, it was a librosa problem.
all you have to do is to install librosa with conda, if you have installed it using pip - uninstall it ! and then use this command:

conda install -c conda-forge librosa

and this will install all of the required dependencies (alot of them actually) and you will be able to extract formants, linear spectral ferquency and any other features that you were facing this error while extracting. Good Luck!