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)频谱的时域,但不改变音频的音高。
|
|
|
|
|
|
|
2022-08-19 16:27:41 +08:00
|
|
|
|
.. 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-02-28 21:50:37 +08:00
|
|
|
|
|
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
|