mindspore/docs/api/api_python/dataset_audio/mindspore.dataset.audio.Tim...

29 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2022-06-22 10:46:33 +08:00
mindspore.dataset.audio.TimeStretch
===================================
2021-11-22 14:54:00 +08:00
2022-06-22 10:46:33 +08:00
.. py:class:: mindspore.dataset.audio.TimeStretch(hop_length=None, n_freq=201, fixed_rate=None)
2021-11-22 14:54:00 +08:00
2022-01-13 11:46:37 +08:00
以给定的比例拉伸音频短时傅里叶Short Time Fourier Transform, STFT频谱的时域但不改变音频的音高。
.. note:: 待处理音频维度需为(..., freq, time, complex=2)。第0维代表实部第1维代表虚部。
2021-11-22 14:54:00 +08:00
2022-07-08 16:45:20 +08:00
参数:
2022-11-08 14:13:53 +08:00
- **hop_length** (int, 可选) - STFT窗之间每跳的长度即连续帧之间的样本数。默认值None表示取 `n_freq - 1`
2022-11-02 11:17:18 +08:00
- **n_freq** (int, 可选) - STFT中的滤波器组数。默认值201。
- **fixed_rate** (float, 可选) - 频谱在时域加快或减缓的比例。默认值None表示保持原始速率。
2022-07-08 16:45:20 +08:00
异常:
- **TypeError** - 当 `hop_length` 的类型不为int。
- **ValueError** - 当 `hop_length` 不为正数。
- **TypeError** - 当 `n_freq` 的类型不为int。
- **ValueError** - 当 `n_freq` 不为正数。
- **TypeError** - 当 `fixed_rate` 的类型不为float。
- **ValueError** - 当 `fixed_rate` 不为正数。
- **RuntimeError** - 当输入音频的shape不为<..., freq, num_frame, complex=2>。
2022-01-22 14:32:07 +08:00
.. image:: time_stretch_rate1.5.png
2022-01-13 11:46:37 +08:00
2022-01-22 14:32:07 +08:00
.. image:: time_stretch_original.png
2022-01-13 11:46:37 +08:00
2022-01-22 14:32:07 +08:00
.. image:: time_stretch_rate0.8.png