快捷鍵

LFCC

class torchaudio.transforms.LFCC(sample_rate: int = 16000, n_filter: int = 128, f_min: float = 0.0, f_max: Optional[float] = None, n_lfcc: int = 40, dct_type: int = 2, norm: str = 'ortho', log_lf: bool = False, speckwargs: Optional[dict] = None)[source]

從音訊訊號建立線性頻率倒譜係數。

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

預設情況下,這會在 DB 刻度的線性濾波頻譜圖上計算 LFCC。這不是教科書上的實作方式,但在此實作是為了與 librosa 保持一致。

此輸出取決於輸入頻譜圖中的最大值,因此對於分割成片段的音訊剪輯與完整剪輯可能會傳回不同的值。

參數:
  • sample_rate (int, optional) – 音訊訊號的取樣率。(預設值:16000

  • n_filter (int, optional) – 要應用的線性濾波器數量。(預設值:128

  • n_lfcc (int, optional) – 要保留的 lfc 係數數量。(預設值:40

  • f_min (float, optional) – 最小頻率。(預設值:0.

  • f_max (floatNone, optional) – 最大頻率。(預設值:None

  • dct_type (int, optional) – 要使用的 DCT(離散餘弦轉換)類型。(預設值:2

  • norm (str, optional) – 要使用的範數。(預設值:"ortho"

  • log_lf (bool, optional) – 是否使用 log-lf 頻譜圖而不是 db 刻度。(預設值:False

  • speckwargs (dictNone, optional) – Spectrogram 的引數。(預設值:None

範例
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> transform = transforms.LFCC(
>>>     sample_rate=sample_rate,
>>>     n_lfcc=13,
>>>     speckwargs={"n_fft": 400, "hop_length": 160, "center": False},
>>> )
>>> lfcc = transform(waveform)

另請參閱

torchaudio.functional.linear_fbanks() - 用於產生濾波器組的函式。

使用 LFCC 的教學
Audio Feature Extractions

音訊特徵提取

音訊特徵提取
forward(waveform: Tensor) Tensor[source]
參數:

waveform (Tensor) – 音訊張量,維度為 (…, 時間)。

傳回:

線性頻率倒譜係數,大小為 (…, n_lfcc, 時間)。

傳回類型:

Tensor

文件

取得 PyTorch 的完整開發者文件

檢視文件

教學

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

檢視教學

資源

尋找開發資源並獲得您的問題解答

檢視資源