mindspore.dataset.audio.DeemphBiquad

查看源文件
class mindspore.dataset.audio.DeemphBiquad(sample_rate)[源代码]

给音频波形施加CD(IEC 60908)去重音(一种高音衰减搁置滤波器)效果。

接口实现方式类似于 SoX库

参数:
  • sample_rate (int) - 波形的采样频率,只能为 4410048000 (Hz)。

异常:
  • TypeError - 当 sample_rate 的类型不为int。

  • ValueError - 当 sample_rate 不为 4410048000

  • RuntimeError - 当输入音频的shape不为<…, time>。

支持平台:

CPU

样例:

>>> import numpy as np
>>> import mindspore.dataset as ds
>>> import mindspore.dataset.audio as audio
>>>
>>> # Use the transform in dataset pipeline mode
>>> waveform = np.random.random([5, 8])  # 5 samples
>>> numpy_slices_dataset = ds.NumpySlicesDataset(data=waveform, column_names=["audio"])
>>> transforms = [audio.DeemphBiquad(44100)]
>>> numpy_slices_dataset = numpy_slices_dataset.map(operations=transforms, input_columns=["audio"])
>>> for item in numpy_slices_dataset.create_dict_iterator(num_epochs=1, output_numpy=True):
...     print(item["audio"].shape, item["audio"].dtype)
...     break
(8,) float64
>>>
>>> # Use the transform in eager mode
>>> waveform = np.random.random([8])  # 1 sample
>>> output = audio.DeemphBiquad(44100)(waveform)
>>> print(output.shape, output.dtype)
(8,) float64
教程样例: