mindspore.dataset.audio.transforms.TimeStretch

class mindspore.dataset.audio.transforms.TimeStretch(hop_length=None, n_freq=201, fixed_rate=None)[source]

Stretch STFT in time at a given rate, without changing the pitch.

Parameters
  • hop_length (int, optional) – Length of hop between STFT windows (default=None, will use ((n_freq - 1) * 2) // 2).

  • n_freq (int, optional) – Number of filter banks form STFT (default=201).

  • fixed_rate (float, optional) – Rate to speed up or slow down the input in time (default=None, will keep the original rate).

Examples

>>> import numpy as np
>>>
>>> waveform = np.random.random([1, 30])
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.TimeStretch()]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])