mindspore.dataset.audio.ComputeDeltas

class mindspore.dataset.audio.ComputeDeltas(win_length=5, pad_mode=BorderType.EDGE)[source]

Compute delta coefficients of a spectrogram.

\[d_{t}=\frac{{\textstyle\sum_{n=1}^{N}}n(c_{t+n}-c_{t-n})}{2{\textstyle\sum_{n=1}^{N}}n^{2}}\]
Parameters
  • win_length (int) – The window length used for computing delta, must be no less than 3 (default=5).

  • pad_mode (BorderType) –

    Mode parameter passed to padding (default=BorderType.EDGE).It can be any of [BorderType.CONSTANT, BorderType.EDGE, BorderType.REFLECT, BordBorderTypeer.SYMMETRIC].

    • BorderType.CONSTANT, means it fills the border with constant values.

    • BorderType.EDGE, means it pads with the last value on the edge.

    • BorderType.REFLECT, means it reflects the values on the edge omitting the last value of edge.

    • BorderType.SYMMETRIC, means it reflects the values on the edge repeating the last value of edge.

Examples

>>> import numpy as np
>>> from mindspore.dataset.audio import BorderType
>>>
>>> waveform = np.random.random([1, 400//2+1, 30])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.ComputeDeltas(win_length=7, pad_mode = BorderType.EDGE)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])