快捷方式

torchaudio.prototype.functional.extend_pitch

torchaudio.prototype.functional.extend_pitch(base: Tensor, pattern: Union[int, List[float], Tensor])[源代码]

已弃用

警告

此函数已被弃用。它将在 2.9 版本中移除。此弃用是 TorchAudio 进入维护阶段的大规模重构工作的一部分。有关更多信息,请参阅 https://github.com/pytorch/audio/issues/3902

使用给定时间序列值的倍数扩展它们。

This feature supports the following devices: CPU, CUDA This API supports the following properties: Autograd, TorchScript

给定一组基频(音高),此函数会附加其谐波泛音或非谐波分量。

参数
  • base (torch.Tensor) – 基准时间序列,例如基频(Hz)。形状:(..., time, 1)

  • pattern (int, float 列表torch.Tensor) –

    如果为 int,则表示操作后的音高序列数量。添加 pattern - 1 个音调,因此生成的 Tensor 包含给定序列最多 pattern 阶的泛音。

    如果为 float 列表或 torch.Tensor,则必须是一维的,表示基频的自定义倍数。

返回

振荡器频率(Hz)。形状:(..., time, num_tones)

返回类型

张量

示例
>>> # fundamental frequency
>>> f0 = torch.linspace(1, 5, 5).unsqueeze(-1)
>>> f0
tensor([[1.],
        [2.],
        [3.],
        [4.],
        [5.]])
>>> # Add harmonic overtones, up to 3rd.
>>> f = extend_pitch(f0, 3)
>>> f.shape
torch.Size([5, 3])
>>> f
tensor([[ 1.,  2.,  3.],
        [ 2.,  4.,  6.],
        [ 3.,  6.,  9.],
        [ 4.,  8., 12.],
        [ 5., 10., 15.]])
>>> # Add custom (inharmonic) partials.
>>> f = extend_pitch(f0, torch.tensor([1, 2.1, 3.3, 4.5]))
>>> f.shape
torch.Size([5, 4])
>>> f
tensor([[ 1.0000,  2.1000,  3.3000,  4.5000],
        [ 2.0000,  4.2000,  6.6000,  9.0000],
        [ 3.0000,  6.3000,  9.9000, 13.5000],
        [ 4.0000,  8.4000, 13.2000, 18.0000],
        [ 5.0000, 10.5000, 16.5000, 22.5000]])
使用 extend_pitch 的教程
Additive Synthesis

加法合成

加法合成

文档

访问全面的 PyTorch 开发者文档

查看文档

教程

为初学者和高级开发者提供深入的教程

查看教程

资源

查找开发资源并让您的问题得到解答

查看资源