parameters: (self, signal)
return_statement: return feature
docstring: Extract MFCC coefficients of the sound x in numpy array format.
docstring_summary: Extract MFCC coefficients of the sound x in numpy array format.
docstring_tokens: Extract MFCC coefficients of the sound x in numpy array format .
function: def extract(self, signal):
          """
          Extract MFCC coefficients of the sound x in numpy array format.
          """
          if signal.ndim > 1:
              self.dprint("INFO: Input signal has more than 1 channel; the channels will be averaged.")
              signal = mean(signal, axis=1)
          assert len(signal) > 5 * self.FRAME_LEN, "Signal too short!"
          frames = (len(signal) - self.FRAME_LEN) / self.FRAME_SHIFT + 1
          feature = []
          for f in xrange(frames):
              # Windowing
              frame = signal[f * self.FRAME_SHIFT : f * self.FRAME_SHIFT +
                             self.FRAME_LEN] * self.window
              # Pre-emphasis
              frame[1:] -= frame[:-1] * self.PRE_EMPH
              # Power spectrum
              X = abs(fft.fft(frame, self.FFT_SIZE)[:self.FFT_SIZE / 2 + 1]) ** 2
              X[X < POWER_SPECTRUM_FLOOR] = POWER_SPECTRUM_FLOOR  # Avoid zero
              # Mel filtering, logarithm, DCT
              X = dot(self.D, log(dot(self.M, X)))
              feature.append(X)
          feature = row_stack(feature)
          # Show the MFCC spectrum before normalization
          # Mean & variance normalization
          if feature.shape[0] > 1:
              mu = mean(feature, axis=0)
              sigma = std(feature, axis=0)
              feature = (feature - mu) / sigma
  
          return feature
function_tokens: def extract ( self , signal ) : if signal . ndim > 1 : self . dprint ( "INFO: Input signal has more than 1 channel; the channels will be averaged." ) signal = mean ( signal , axis = 1 ) assert len ( signal ) > 5 * self . FRAME_LEN , "Signal too short!" frames = ( len ( signal ) - self . FRAME_LEN ) / self . FRAME_SHIFT + 1 feature = [ ] for f in xrange ( frames ) : # Windowing frame = signal [ f * self . FRAME_SHIFT : f * self . FRAME_SHIFT + self . FRAME_LEN ] * self . window # Pre-emphasis frame [ 1 : ] -= frame [ : - 1 ] * self . PRE_EMPH # Power spectrum X = abs ( fft . fft ( frame , self . FFT_SIZE ) [ : self . FFT_SIZE / 2 + 1 ] ) ** 2 X [ X < POWER_SPECTRUM_FLOOR ] = POWER_SPECTRUM_FLOOR # Avoid zero # Mel filtering, logarithm, DCT X = dot ( self . D , log ( dot ( self . M , X ) ) ) feature . append ( X ) feature = row_stack ( feature ) # Show the MFCC spectrum before normalization # Mean & variance normalization if feature . shape [ 0 ] > 1 : mu = mean ( feature , axis = 0 ) sigma = std ( feature , axis = 0 ) feature = ( feature - mu ) / sigma return feature