目录

torchaudio.transforms

Transforms 是常见的音频变换。它们可以使用 torch.nn.Sequential 链接在一起

频谱图

class torchaudio.transforms.Spectrogram(n_fft: int = 400, win_length: Optional[int] = None, hop_length: Optional[int] = None, pad: int = 0, window_fn: Callable[[...], torch.Tensor] = <built-in method hann_window of type object>, power: Optional[float] = 2.0, normalized: bool = False, wkwargs: Optional[dict] = None, center: bool = True, pad_mode: str = 'reflect', onesided: bool = True)[source]

从音频信号创建频谱图。

Parameters
  • n_fft (int, optional) – FFT 的大小,创建 n_fft // 2 + 1 个频带。(默认值:400)

  • win_length (intNone, 可选) – 窗口大小。(默认值:n_fft

  • hop_length (intNone, 可选) – STFT 窗口之间的跳跃长度。(默认值:win_length // 2

  • pad (int, optional) – 信号的双边填充。(默认值:0

  • window_fn (Callable[.., Tensor], optional) – 一个用于创建窗口张量的函数,该函数将应用于/乘以每个帧/窗口。(默认值:torch.hann_window

  • power (floatNone, 可选) – 幅度谱图的指数, (必须 > 0),例如:1 表示能量,2 表示功率等。 如果为 None,则返回复数频谱。(默认值: 2)

  • normalized (bool, optional) – 是否在 stft 后按幅度进行归一化。(默认值:False

  • wkwargs (dictNone可选) – 窗口函数的参数。(默认值:None

  • center (bool, optional) – 是否对 waveform 两侧进行填充,使得第 \(t\) 帧位于时间 \(t \times \text{hop\_length}\) 的中心。 默认值:True

  • pad_mode (string, optional) – 控制当 centerTrue 时使用的填充方法。默认值:"reflect"

  • 单边 (bool, 可选) – 控制是否返回一半的结果以避免冗余 默认值:True

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

维度 (…, freq, time),其中 freq 是 n_fft // 2 + 1,而 n_fft 是傅里叶分箱的数量,time 是窗口跳数的数量(n_frame)。

Return type

张量

GriffinLim

class torchaudio.transforms.GriffinLim(n_fft: int = 400, n_iter: int = 32, win_length: Optional[int] = None, hop_length: Optional[int] = None, window_fn: Callable[[...], torch.Tensor] = <built-in method hann_window of type object>, power: float = 2.0, normalized: bool = False, wkwargs: Optional[dict] = None, momentum: float = 0.99, length: Optional[int] = None, rand_init: bool = True)[source]

使用 Griffin-Lim 变换从线性尺度幅度谱图计算波形。

实现移植自 librosa 123

Parameters
  • n_fft (int, optional) – FFT 的大小,创建 n_fft // 2 + 1 个频带。(默认值:400)

  • n_iter (int, optional) – 相位恢复过程的迭代次数。(默认值:32

  • win_length (intNone, 可选) – 窗口大小。(默认值:n_fft

  • hop_length (intNone, 可选) – STFT 窗口之间的跳跃长度。(默认值:win_length // 2

  • window_fn (Callable[.., Tensor], optional) – 一个用于创建窗口张量的函数,该函数将应用于/乘以每个帧/窗口。(默认值:torch.hann_window

  • power (float, optional) – 幅度谱的指数, (必须 > 0),例如:1 表示能量,2 表示功率等。(默认值:2

  • normalized (bool, optional) – 是否在 stft 后按幅度进行归一化。(默认值:False

  • wkwargs (dictNone可选) – 窗口函数的参数。(默认值:None

  • momentum (float, optional) – 快速 Griffin-Lim 的动量参数。 将其设置为 0 可恢复原始的 Griffin-Lim 方法。 接近 1 的值可以导致更快的收敛,但大于 1 可能无法收敛。(默认值:0.99

  • length (int, optional) – 预期输出的数组长度。(默认值:None

  • rand_init (bool, optional) – 如果为 True,则随机初始化相位;否则初始化为零。(默认值:True

参考文献

1
麦克菲,布莱恩,科林·拉斐尔,戴文·梁,丹尼尔·PW·埃利斯,马特·麦克维克,埃里克·巴滕贝格,奥里奥尔·内托。
“ librosa:用 Python 进行音频和音乐信号分析。”
在第十四届科学计算中的Python会议论文集,第18-25页,2015年。
2
佩拉东,N.,巴拉茨,P.,& 森德gaard,P. L.
“一个快速的 Griffin-Lim 算法”,
IEEE 信号处理在音频与声学应用 workshop (第 1-4 页),
2013年10月。
3
D. W. Griffin 和 J. S. Lim,
“基于修改后的短时傅里叶变换的信号估计”
IEEE 信号处理汇刊,第32卷,第2期,第236-243页,1984年4月。
forward(specgram: torch.Tensor) → torch.Tensor[source]
Parameters

specgram (Tensor) – 维度为 (…, freq, frames) 的仅包含幅度的 STFT 频谱图,其中 freq 为 n_fft // 2 + 1

Returns

(…, time) 的波形,其中 time 等于给定的 length 参数。

Return type

张量

AmplitudeToDB

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

将张量从功率/幅度尺度转换为分贝尺度。

此输出取决于输入张量中的最大值,因此对于分割成片段与完整片段的音频剪辑,可能会返回不同的值。

Parameters
  • stype (str, 可选) – 输入张量的缩放比例(‘power’或‘magnitude’)。Power是幅度的逐元素平方。(默认:'power'

  • top_db (float, optional) – 最小负截止值(以分贝为单位)。一个合理的数字是80。(默认:None

forward(x: torch.Tensor) → torch.Tensor[source]

来自 Librosa 的数值稳定实现。

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

Parameters

x (Tensor) – 转换为分贝刻度之前的输入张量。

Returns

以分贝刻度输出的张量。

Return type

张量

MelScale

class torchaudio.transforms.MelScale(n_mels: int = 128, sample_rate: int = 16000, f_min: float = 0.0, f_max: Optional[float] = None, n_stft: Optional[int] = None, norm: Optional[str] = None)[source]

使用转换矩阵将普通 STFT 转换为梅尔频率 STFT。此方法采用三角形滤波器组。

用户可以控制滤波器组(fb)所在的设备(例如,fb.to(spec_f.device))。

Parameters
  • n_mels (int, optional) – 梅尔滤波器组的数量。(默认值:128

  • sample_rate (int, optional) – 音频信号的采样率。(默认值:16000

  • f_min (float, optional) – 最小频率。(默认值:0.

  • f_max (floatNone, 可选) – 最大频率。(默认值:sample_rate // 2

  • n_stft (int, optional) – STFT中的频谱分箱数量。如果未提供,则从第一个输入计算得出。请参见n_fftSpectrogram中。(默认: None)

  • norm (可选[str]) – 如果为 'slaney',则按梅尔频带的宽度除以三角形梅尔权重

  • 归一化)。(默认值)((面积) – None

forward(specgram: torch.Tensor) → torch.Tensor[source]
Parameters

specgram (Tensor) – 维度为 (…, freq, time) 的频谱图 STFT。

Returns

大小为 (…, n_mels, time) 的梅尔频率语谱图。

Return type

张量

InverseMelScale

class torchaudio.transforms.InverseMelScale(n_stft: int, n_mels: int = 128, sample_rate: int = 16000, f_min: float = 0.0, f_max: Optional[float] = None, max_iter: int = 100000, tolerance_loss: float = 1e-05, tolerance_change: float = 1e-08, sgdargs: Optional[dict] = None, norm: Optional[str] = None)[source]

使用转换矩阵,从梅尔频率 STFT 求解普通 STFT。此方法采用三角滤波器组。

它使用 SGD 最小化输入梅尔频谱图与估计频谱图和滤波器组乘积之间的欧几里得范数。

Parameters
  • n_stft (int) – STFT 中的频带数量。参见 n_fftSpectrogram

  • n_mels (int, optional) – 梅尔滤波器组的数量。(默认值:128

  • sample_rate (int, optional) – 音频信号的采样率。(默认值:16000

  • f_min (float, optional) – 最小频率。(默认值:0.

  • f_max (floatNone, 可选) – 最大频率。(默认值:sample_rate // 2

  • max_iter (int, optional) – 优化迭代的最大次数。(默认值:100000

  • tolerance_loss (float, optional) – 停止优化时的损失值。(默认:1e-5

  • tolerance_change (float, optional) – 停止优化时的损失差异。(默认值:1e-8

  • sgdargs (dictNone, 可选) – SGD 优化器的参数。(默认值:None

  • norm (可选[str]) – 如果为 'slaney',则按梅尔频带的宽度除以三角形梅尔权重

  • 归一化)。(默认值)((面积) – None

forward(melspec: torch.Tensor) → torch.Tensor[source]
Parameters

melspec (Tensor) – 维度为 (…, n_mels, time) 的梅尔频率谱图

Returns

大小为 (…, freq, time) 的线性尺度频谱图

Return type

张量

MelSpectrogram

class torchaudio.transforms.MelSpectrogram(sample_rate: int = 16000, n_fft: int = 400, win_length: Optional[int] = None, hop_length: Optional[int] = None, f_min: float = 0.0, f_max: Optional[float] = None, pad: int = 0, n_mels: int = 128, window_fn: Callable[[...], torch.Tensor] = <built-in method hann_window of type object>, power: Optional[float] = 2.0, normalized: bool = False, wkwargs: Optional[dict] = None, center: bool = True, pad_mode: str = 'reflect', onesided: bool = True, norm: Optional[str] = None)[source]

为原始音频信号创建梅尔频谱图。这是频谱图和梅尔尺度的组合。

Sources
Parameters
  • sample_rate (int, optional) – 音频信号的采样率。(默认值:16000

  • win_length (intNone, 可选) – 窗口大小。(默认值:n_fft

  • hop_length (intNone, 可选) – STFT 窗口之间的跳跃长度。(默认值:win_length // 2

  • n_fft (int, optional) – FFT 的大小,创建 n_fft // 2 + 1 个频带。(默认值:400)

  • f_min (float, optional) – 最小频率。(默认值:0.

  • f_max (floatNone, 可选) – 最大频率。(默认值:None

  • pad (int, optional) – 信号的双边填充。(默认值:0

  • n_mels (int, optional) – 梅尔滤波器组的数量。(默认值:128

  • window_fn (Callable[.., Tensor], optional) – 一个用于创建窗口张量的函数,该函数将应用于/乘以每个帧/窗口。(默认值:torch.hann_window

  • wkwargs (Dict[.., ..] 或 None可选) – 窗口函数的参数。(默认值:None

  • center (bool, optional) – 是否对 waveform 两侧进行填充,使得第 \(t\) 帧位于时间 \(t \times \text{hop\_length}\) 的中心。 默认值:True

  • pad_mode (string, optional) – 控制当 centerTrue 时使用的填充方法。默认值:"reflect"

  • onesided (bool, optional) – 控制是否返回一半的结果以避免冗余。默认值:True

  • norm (可选[str]) – 如果为 'slaney',则按梅尔频带的宽度除以三角形梅尔权重

  • 归一化)。(默认值)((面积) – None

Example
>>> waveform, sample_rate = torchaudio.load('test.wav', normalization=True)
>>> mel_specgram = transforms.MelSpectrogram(sample_rate)(waveform)  # (channel, n_mels, time)
forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

大小为 (…, n_mels, time) 的梅尔频率语谱图。

Return type

张量

MFCC

class torchaudio.transforms.MFCC(sample_rate: int = 16000, n_mfcc: int = 40, dct_type: int = 2, norm: str = 'ortho', log_mels: bool = False, melkwargs: Optional[dict] = None)[source]

从音频信号创建梅尔频率倒谱系数。

默认情况下,此函数会在以分贝缩放的梅尔频谱上计算 MFCC。 这并非教科书式的实现,但在此处采用该方式是为了与 librosa 保持一致。

该输出取决于输入频谱图中的最大值,因此对于分割成片段与完整音频剪辑的同一音频,可能会返回不同的值。

Parameters
  • sample_rate (int, optional) – 音频信号的采样率。(默认值:16000

  • n_mfcc (int, optional) – 要保留的 mfc 系数数量。(默认值:40

  • dct_type (int, optional) – 要使用的 DCT(离散余弦变换)类型。(默认值:2

  • norm (str, optional) – 要使用的范数。(默认值:'ortho'

  • log_mels (bool, optional) – 是否使用对数梅尔频谱图代替分贝缩放。(默认值: False)

  • melkwargs (dictNone, 可选) – MelSpectrogram 的参数。(默认值:None

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

大小为 (…, n_mfcc, time) 的 specgram_mel_db。

Return type

张量

MuLawEncoding

class torchaudio.transforms.MuLawEncoding(quantization_channels: int = 256)[source]

根据mu-law压缩编码信号。更多信息请参见 维基百科条目

该算法假设信号已缩放到 -1 到 1 之间,并返回一个编码值在 0 到 quantization_channels - 1 范围内的信号。

Parameters

quantization_channels (int, optional) – 通道数量。(默认值:256

forward(x: torch.Tensor) → torch.Tensor[source]
Parameters

x (Tensor) – 要编码的信号。

Returns

编码信号。

Return type

x_mu (张量)

MuLawDecoding

class torchaudio.transforms.MuLawDecoding(quantization_channels: int = 256)[source]

解码mu-law编码的信号。有关更多信息,请参阅 维基百科条目

此函数期望输入值在 0 到 quantization_channels - 1 之间,并返回一个缩放至 -1 到 1 之间的信号。

Parameters

quantization_channels (int, optional) – 通道数量。(默认值:256

forward(x_mu: torch.Tensor) → torch.Tensor[source]
Parameters

x_mu (Tensor) – 需要解码的 mu-law 编码信号。

Returns

信号已解码。

Return type

张量

重采样

class torchaudio.transforms.Resample(orig_freq: int = 16000, new_freq: int = 16000, resampling_method: str = 'sinc_interpolation')[source]

将信号从一个频率重采样到另一个频率。可以指定一种重采样方法。

Parameters
  • orig_freq (float, 可选) – 信号的原始频率。 (默认: 16000)

  • new_freq (float, 可选) – 所需的频率。 (默认: 16000)

  • 重采样方法 (str, 可选) – 重采样方法。 (默认: 'sinc_interpolation')

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

维度为 (…, time) 的输出信号。

Return type

张量

ComplexNorm

class torchaudio.transforms.ComplexNorm(power: float = 1.0)[source]

计算复数张量输入的范数。

Parameters

power (float, optional) – 范数的幂。(默认值:1.0

forward(complex_tensor: torch.Tensor) → torch.Tensor[source]
Parameters

complex_tensor (Tensor) – 形状为 (…, complex=2) 的张量。

Returns

输入张量的范数,形状为 (…, )

Return type

张量

ComputeDeltas

class torchaudio.transforms.ComputeDeltas(win_length: int = 5, mode: str = 'replicate')[source]

计算张量(通常是频谱图)的 delta 系数。

参见 torchaudio.functional.compute_deltas 以获取更多详情。

Parameters
  • win_length (int) – 用于计算delta的窗口长度。 (默认值: 5)

  • 模式 (字符串) – 传递给填充的模式参数。 (默认: 'replicate')

forward(specgram: torch.Tensor) → torch.Tensor[source]
Parameters

specgram (Tensor) – 维度为 (…, freq, time) 的音频张量。

Returns

维度为 (…, freq, time) 的增量张量。

Return type

张量

TimeStretch

class torchaudio.transforms.TimeStretch(hop_length: Optional[int] = None, n_freq: int = 201, fixed_rate: Optional[float] = None)[source]

在给定速率下,沿时间轴拉伸 STFT 而不改变音高。

Parameters
  • hop_length (intNone, 可选) – STFT 窗口之间的跳跃长度。(默认值:win_length // 2

  • n_freq (int, optional) – 来自 stft 的滤波器组数量。(默认值:201

  • fixed_rate (floatNone, 可选) – 用于加速或减速的比率。 如果提供 None,则必须将 rate 传递给 forward 方法。(默认值:None

forward(complex_specgrams: torch.Tensor, overriding_rate: Optional[float] = None) → torch.Tensor[source]
Parameters
  • 复数频谱图 (张量) – 复数频谱图 (…, 频率, 时间, 复数=2)。

  • overriding_rate (floatNone, 可选) – 应用于此批次的加速倍率。 如果未传入速率,则使用 self.fixed_rate。(默认值:None

Returns

拉伸后的复数频谱图,维度为(…, 频率, 时长/速率取整, 复数=2)。

Return type

张量

淡出

class torchaudio.transforms.Fade(fade_in_len: int = 0, fade_out_len: int = 0, fade_shape: str = 'linear')[source]

为波形添加淡入和/或淡出效果。

Parameters
  • fade_in_len (int, optional) – 淡入长度(时间帧)。(默认值:0

  • fade_out_len (int, optional) – 淡出长度(时间帧)。(默认值:0

  • fade_shape (str, 可选) – 淡入形状。必须是以下之一:“quarter_sine”, “half_sine”, “linear”, “logarithmic”, “exponential”。(默认: "linear")

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

音频张量,维度为 (…, 时间)。

Return type

张量

FrequencyMasking

class torchaudio.transforms.FrequencyMasking(freq_mask_param: int, iid_masks: bool = False)[source]

在频域中对频谱图应用掩码。

Parameters
  • freq_mask_param (int) – 掩码的最大可能长度。 索引从 [0, freq_mask_param) 中均匀采样。

  • iid_masks (bool, optional) – 是否对批次中的每个示例/通道应用不同的掩码。(默认值:False) 此选项仅适用于输入张量为 4D 的情况。

forward(specgram: torch.Tensor, mask_value: float = 0.0) → torch.Tensor
Parameters
  • 频谱图 (张量) – 维度为 (…, 频率, 时间) 的张量。

  • mask_value (float) – 要分配给被屏蔽列的值。

Returns

掩膜频谱图,维度为 (…, 频率, 时间)。

Return type

张量

TimeMasking

class torchaudio.transforms.TimeMasking(time_mask_param: int, iid_masks: bool = False)[source]

在时域中对频谱图应用掩码。

Parameters
  • time_mask_param (int) – 掩码的最大可能长度。 索引从 [0, time_mask_param) 中均匀采样。

  • iid_masks (bool, optional) – 是否对批次中的每个示例/通道应用不同的掩码。(默认值:False) 此选项仅适用于输入张量为 4D 的情况。

forward(specgram: torch.Tensor, mask_value: float = 0.0) → torch.Tensor
Parameters
  • 频谱图 (张量) – 维度为 (…, 频率, 时间) 的张量。

  • mask_value (float) – 要分配给被屏蔽列的值。

Returns

掩膜频谱图,维度为 (…, 频率, 时间)。

Return type

张量

class torchaudio.transforms.Vol(gain: float, gain_type: str = 'amplitude')[source]

为波形添加音量。

Parameters
  • gain (float) – 根据给定的 gain_type 进行解释: 如果 gain_type = amplitude,则 gain 是正振幅比。 如果 gain_type = power,则 gain 是功率(电压的平方)。 如果 gain_type = db,则 gain 以分贝为单位。

  • gain_type (str, optional) – 增益类型。可选值之一:amplitude, power, db(默认:amplitude

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

音频张量,维度为 (…, 时间)。

Return type

张量

SlidingWindowCmn

class torchaudio.transforms.SlidingWindowCmn(cmn_window: int = 600, min_cmn_window: int = 100, center: bool = False, norm_vars: bool = False)[source]

对每个语音片段应用滑动窗口倒谱均值(以及可选的方差)归一化。

Parameters
  • cmn_window (int, optional) – 用于计算运行平均CMN的帧数窗口(int,默认值 = 600)

  • min_cmn_window (int, optional) – 解码开始时使用的最小 CMN 窗口(仅在开始时增加延迟)。 仅当 center == false 时适用,如果 center==true 则被忽略(int,默认值 = 100)

  • center (bool, optional) – 如果为 true,则使用以当前帧为中心的窗口(在可能的情况下,模去端点效应)。如果为 false,则窗口位于左侧。(bool,默认值 = false)

  • norm_vars (bool, optional) – 如果为 true,则将方差归一化为 1。(bool,默认值 = false)

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

音频张量,维度为 (…, 时间)。

Return type

张量

SpectralCentroid

class torchaudio.transforms.SpectralCentroid(sample_rate: int, n_fft: int = 400, win_length: Optional[int] = None, hop_length: Optional[int] = None, pad: int = 0, window_fn: Callable[[...], torch.Tensor] = <built-in method hann_window of type object>, wkwargs: Optional[dict] = None)[source]

沿时间轴计算每个通道的频谱质心。

频谱质心定义为频率值的加权平均值,权重为其幅度。

Parameters
  • sample_rate (int) – 音频信号的采样率。

  • n_fft (int, optional) – FFT 的大小,创建 n_fft // 2 + 1 个频带。(默认值:400)

  • win_length (intNone, 可选) – 窗口大小。(默认值:n_fft

  • hop_length (intNone, 可选) – STFT 窗口之间的跳跃长度。(默认值:win_length // 2

  • pad (int, optional) – 信号的双边填充。(默认值:0

  • window_fn (Callable[.., Tensor], optional) – 一个用于创建窗口张量的函数,该函数将应用于/乘以每个帧/窗口。(默认值:torch.hann_window

  • wkwargs (dictNone可选) – 窗口函数的参数。(默认值:None

Example
>>> waveform, sample_rate = torchaudio.load('test.wav', normalization=True)
>>> spectral_centroid = transforms.SpectralCentroid(sample_rate)(waveform)  # (channel, time)
forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量。

Returns

时域大小为 (…, 时间) 的频谱重心。

Return type

张量

语音活动检测

class torchaudio.transforms.Vad(sample_rate: int, trigger_level: float = 7.0, trigger_time: float = 0.25, search_time: float = 1.0, allowed_gap: float = 0.25, pre_trigger_time: float = 0.0, boot_time: float = 0.35, noise_up_time: float = 0.1, noise_down_time: float = 0.01, noise_reduction_amount: float = 1.35, measure_freq: float = 20.0, measure_duration: Optional[float] = None, measure_smooth_time: float = 0.4, hp_filter_freq: float = 50.0, lp_filter_freq: float = 6000.0, hp_lifter_freq: float = 150.0, lp_lifter_freq: float = 2000.0)[source]

语音活动检测器。实现方式与 SoX 类似。 旨在从语音录音的开头和结尾处修剪静音及安静的背景声音。 该算法目前使用简单的倒谱功率测量来检测语音, 因此可能会被其他声音(尤其是音乐)所误导。

该效果仅能从音频前端进行修剪,因此若要从后端修剪,还必须使用反向效果。

Parameters
  • sample_rate (int) – 音频信号的采样率。

  • trigger_level (float, optional) – 用于触发活动检测的测量级别。 根据噪声水平、信号水平以及输入音频的其他特性,可能需要对此进行调整。(默认值:7.0)

  • trigger_time (float, optional) – 时间常数(单位:秒),用于帮助忽略短促的声脉冲。(默认值:0.25)

  • search_time (float, optional) – 在检测到的触发点之前,要搜索以包含更安静或更短音频片段的时长(以秒为单位)。(默认值:1.0)

  • allowed_gap (float, optional) – 在检测到触发点之前,允许包含的较安静/较短音频片段之间的间隔(以秒为单位)。(默认值:0.25)

  • pre_trigger_time (float, optional) – 在触发点及任何发现的更安静/更短突发之前要保留的音频量(以秒为单位)。(默认值:0.0)

  • boot_time (float, optional) 算法(内部)– 用于检测所需音频开始的估计/缩减。此选项设置初始噪声估计的时间。(默认值:0.35)

  • noise_up_time (float, optional) – 用于噪声水平增加时。(默认值:0.1)

  • noise_down_time (float, optional) – 用于噪声水平下降时。(默认值:0.01)

  • noise_reduction_amount (float, optional) – 检测算法(例如 0, 0.5, …)。(默认值:1.35)

  • measure_freq (float, 可选) – 处理/测量。(默认值:20.0)

  • measure_duration – (float, 可选) 测量持续时间。 (默认值:测量周期的两倍;即存在重叠。)

  • measure_smooth_time (float, 可选) – 频谱测量。(默认值:0.4)

  • hp_filter_freq (float, optional) – 在检测算法的输入端。(默认值:50.0)

  • lp_filter_freq (float, optional) – 在检测算法的输入端。 (默认值: 6000.0)

  • hp_lifter_freq (float, 可选) – 在检测器算法中。(默认值:150.0)

  • lp_lifter_freq (float, 可选) – 在检测器算法中。(默认值:2000.0)

参考文献

http://sox.sourceforge.net/sox.html

forward(waveform: torch.Tensor) → torch.Tensor[source]
Parameters

waveform (Tensor) – 维度为 (…, time) 的音频张量

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源