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的教程