Home ParameterError: data must be of type numpy.ndarray (While Using Librosa)
Reply: 1

ParameterError: data must be of type numpy.ndarray (While Using Librosa)

Mitesh Puthran
Mitesh Puthran Published in 2017-12-07 05:01:38Z

I am trying to use Librosa library(Python 3.x) for the first time to extract features from multiple audio files which are in wav format. I am facing a issue where it says the data should be of type numpy.ndarray even when it is of that type. Here is my code:

mylist is a list of all the wav audio files in my directory.

import os
import librosa
mylist= os.listdir('RawData/')

for y in mylist:
   X, sample_rate = librosa.load('RawData/'+y, res_type='kaiser_fast')
   sample_rate = np.array(sample_rate)
   mfccs = np.mean(librosa.feature.mfcc(x=X, sr=sample_rate, n_mfcc=40),axis=0)

And this is the output and the error that pops up:

class 'int'

class 'numpy.ndarray'

class 'numpy.ndarray'

ParameterError                            Traceback (most recent call last)
ipython-input-23-817ec793d6c4 in module()
  7     mfccs = np.mean(librosa.feature.mfcc(x=X, 
  8                                          sr=sample_rate,
----> 9                                          n_mfcc=40),
 10                     axis=0)
 ParameterError: data must be of type numpy.ndarray

Any help is appreciated

ShpielMeister Reply to 2017-12-07 05:17:21Z

you perhaps meant to say librosa.feature.mfcc(y=X,


You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298124 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO