快捷鍵

torchaudio.prototype.functional.simulate_rir_ism

torchaudio.prototype.functional.simulate_rir_ism(room: Tensor, source: Tensor, mic_array: Tensor, max_order: int, absorption: Union[float, Tensor], output_length: Optional[int] = None, delay_filter_length: int = 81, center_frequency: Optional[Tensor] = None, sound_speed: float = 343.0, sample_rate: float = 16000.0) Tensor[原始碼]

基於影像源方法 [[Allen and Berkley, 1979](references.html#id63)],計算室內脈衝響應 (RIR)。此實作基於 pyroomacoustics [[Scheibler *et al.*, 2018](references.html#id62)]

This feature supports the following devices: CPU This API supports the following properties: TorchScript
參數:
  • room (torch.Tensor) – 房間座標。room 的形狀必須為 (3,),代表房間的三個維度。

  • source (torch.Tensor) – 聲源座標。維度為 (3,) 的張量。

  • mic_array (torch.Tensor) – 麥克風座標。維度為 (channel, 3) 的張量。

  • max_order (int) – 音源的最大反射次數。

  • absorption (floattorch.Tensor) – 牆壁材料對聲音能量的吸收 [[Wikipedia contributors, n.d.](references.html#id64)] 係數。如果 dtype 為 float,則所有牆壁和所有頻率的吸收係數都相同。如果 absorption 是一維張量,則形狀必須為 (6,),其中值分別代表 "west""east""south""north""floor""ceiling" 的吸收係數。如果 absorption 是二維張量,則形狀必須為 (7, 6),其中 7 代表八度音程頻帶的數量。

  • output_length (intNone, 可選) –

    模擬 RIR 訊號的輸出長度。如果為 None,則長度定義為

    \[\frac{\text{max\_d} \cdot \text{sample\_rate}}{\text{sound\_speed}} + \text{delay\_filter\_length} \]

    其中 max_d 是影像源和麥克風之間的最大距離。

  • delay_filter_length (int, 可選) – 用於計算 sinc 函數的濾波器長度。(預設值:81

  • center_frequency (torch.Tensor, 可選) – 多頻帶牆壁的八度音程頻帶的中心頻率。僅當 absorption 是二維張量時使用。

  • sound_speed (float, 可選) – 聲速。(預設值:343.0

  • sample_rate (float, 可選) – 產生的室內脈衝響應訊號的取樣率。(預設值:16000.0

傳回:

模擬的室內脈衝響應波形。維度為 (channel, rir_length) 的張量。

傳回類型:

(torch.Tensor)

注意

如果 absorption 是二維張量且 center_frequency 設定為 None,則八度音程頻帶的中心頻率固定為 [125.0, 250.0, 500.0, 1000.0, 2000.0, 4000.0, 8000.0]。使用者需要調整 absorption 的值以對應的頻率。

文件

存取 PyTorch 的完整開發者文件

查看文件

教學

取得初學者和進階開發者的深入教學

查看教學

資源

尋找開發資源並獲得解答

查看資源