Working on a project based on speaker recognition using python and getting the following error while finding MFCC
.
Traceback (most recent call last):
File "neh1.py", line 10, in <module>
complexSpectrum = numpy.fft(signal)
TypeError: 'module' object is not callable
This is the part of code:
import numpy
from scipy.fftpack import dct
from scipy.io import wavfile
sampleRate, signal = wavfile.read("/home/neha/Audio/b6.wav")
numCoefficients = 13 # choose the sive of mfcc array
minHz = 0
maxHz = 22.000
complexSpectrum = numpy.fft(signal)
powerSpectrum = abs(complexSpectrum) ** 2
filteredSpectrum = numpy.dot(powerSpectrum, melFilterBank())
logSpectrum = numpy.log(filteredSpectrum)
dctSpectrum = dct(logSpectrum, type=2)
What would be the issue?
A TypeError: 'module' object is not callable
means you're trying to use something like a function when it's not actually a function or a method (e.g. doing foo()
when foo
is an int
or a module). As @JohnGordon points out, numpy.fft
is a module, but you're calling it like a function. You want to use `numpy.fft.fft() to do what you want.
See the numpy.fft
docs for more functions related to fast Fourier Transforms.