快捷方式

AmplitudeToDB

class torchaudio.transforms.AmplitudeToDB(stype: str = 'power', top_db: Optional[float] = None)[source]

將張量從功率/振幅刻度轉換為分貝刻度。

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

此輸出取決於輸入張量中的最大值,因此對於分割成片段的音訊片段與完整片段,可能會返回不同的值。

引數:
  • stype (str, 可選) – 輸入張量的刻度("power""magnitude")。功率是幅值的元素平方。(預設值:"power"

  • top_db (floatNone, 可選) – 分貝中的最小負截止值。一個合理的數值是 80。(預設值:None

示例
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True)
>>> transform = transforms.AmplitudeToDB(stype="amplitude", top_db=80)
>>> waveform_db = transform(waveform)
使用 AmplitudeToDB 的教程
StreamWriter Basic Usage

StreamWriter 基本用法

StreamWriter 基本用法
forward(x: Tensor) Tensor[source]

來自 Librosa 的數值穩定實現。

https://librosa.org/doc/latest/generated/librosa.amplitude_to_db.html

引數:

x (Tensor) – 轉換為分貝刻度之前的輸入張量。

返回值:

分貝刻度的輸出張量。

返回型別:

Tensor

文件

查閱 PyTorch 的完整開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源