torchaudio.prototype.functional.oscillator_bank¶
- torchaudio.prototype.functional.oscillator_bank(frequencies: Tensor, amplitudes: Tensor, sample_rate: float, reduction: str = 'sum', dtype: Optional[dtype] = torch.float64) Tensor[source]¶
根据给定的瞬时频率和幅度合成波形。
注意
输出波形的相位信息是通过对给定的瞬时频率 (
frequencies) 进行累加求和得到的。当数据类型精度不足时,这会产生舍入误差。使用torch.float64可以避免这个问题。下图展示了在使用 8000 [Hz] 采样率生成恒定频率和幅度的正弦波时,
torch.float32和torch.float64之间的差异。注意,torch.float32版本显示了在torch.float64版本中未出现的伪影。
- 参数:
- 返回:
合成的波形。
如果
reduction是"none",则形状为 (…, time, N),否则形状为 (…, time)。- 返回类型:
Tensor
- 使用
oscillator_bank的教程