joelle-o-world / mfcc

Calculate MFCC (Mel-frequency Cepstral Coefficients) from mic input in the browser. (TypeScript)
1 stars 0 forks source link

What is the behaviour of the preemphasis (preemph) parameter in python_speech_features MFCC? #9

Open joelle-o-world opened 4 years ago

joelle-o-world commented 4 years ago

python function, fbank, shows that preemphasis is applied before the signal is divided into frames.

joelle-o-world commented 4 years ago
def preemphasis(signal, coeff=0.95):
    """perform preemphasis on the input signal.
    :param signal: The signal to filter.
    :param coeff: The preemphasis coefficient. 0 is no filter, default is 0.95.
    :returns: the filtered signal.
    """
    return numpy.append(signal[0], signal[1:] - coeff * signal[:-1])
joelle-o-world commented 4 years ago

js translation:

function preemphasis(signal, coeff=0.95){
   let arr = [signal[0]];
   for(let i=1; i<signal.length; ++i)
      arr.push( signal[i] - coeff * signal[i-1] );

   return arr
}
joelle-o-world commented 4 years ago

Tentatively closing this issue having added a Preemphasis transform stream....