Compute time derivatives on existing features
Uses the Kaldi implementation (see [kaldi-delta]):
>>> import numpy as np >>> from shennong.audio import Audio >>> from shennong.features.processor.mfcc import MfccProcessor >>> from shennong.features.postprocessor.delta import DeltaPostProcessor >>> audio = Audio.load('./test/data/test.wav') >>> mfcc = MfccProcessor().process(audio)
Initialize the delta processor and compute first and second order time derivatives of MFCC features:
>>> processor = DeltaPostProcessor(order=2) >>> delta = processor.process(mfcc)
The resulting matrice is the concatenation of the original features, their first and second order derivatives:
>>> nmfcc = mfcc.shape >>> delta.shape == nmfcc * 3 True >>> original = delta.data[:, :nmfcc] >>> np.array_equal(original, mfcc.data) True >>> first_order = delta.data[:, nmfcc:2*nmfcc] >>> second_order = delta.data[:, 2*nmfcc:] >>> original.shape == first_order.shape == second_order.shape True
Name of the processor
Order of delta computation
Get parameters for this processor.
deep (boolean, optional) – If True, will return the parameters for this processor and contained subobjects that are processors. Default to True.
params (mapping of string to any) – Parameter names mapped to their values.
Returns features processed from several input signals
This function processes the features in parallel jobs.
signals (dict of :class`~shennong.audio.Audio`) – A dictionnary of input audio signals to process features on, where the keys are item names and values are audio signals.
njobs (int, optional) – The number of parallel jobs to run in background. Default to the number of CPU cores available on the machine.
FeaturesCollection) – The computed features on each input signal. The keys of output features are the keys of the input signals.
ValueError – If the njobs parameter is <= 0
Set the parameters of this processor.
ValueError – If any given parameter in
paramsis invalid for the processor.
Parameter controlling window for delta computation
The actual window size for each delta order is 1 + 2 * window. The behavior at the edges is to replicate the first or last frame.
Dimension of the output features frames
Return the processors properties as a dictionary
Compute deltas on features with the specified options
features (Features, shape = [nframes, ncols]) – The input features on which to compute the deltas
deltas (Features, shape = [nframes, ncols * (order + 1)]) – The computed deltas with as much orders as specified. The output features are the concatenation of the input features and it’s time derivative at each orders.