BarkScale¶
- class torchaudio.prototype.transforms.BarkScale(n_barks: int = 128, sample_rate: int = 16000, f_min: float = 0.0, f_max: Optional[float] = None, n_stft: int = 201, bark_scale: str = 'traunmuller')[source]¶
DEPRECATED
Warning
This class is deprecated from version 2.8. It will be removed in the 2.9 release. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information.
Turn a normal STFT into a bark frequency STFT with triangular filter banks.
- Args:
n_barks (int, optional): Number of bark filterbanks. (Default:
128
) sample_rate (int, optional): Sample rate of audio signal. (Default:16000
) f_min (float, optional): Minimum frequency. (Default:0.
) f_max (float or None, optional): Maximum frequency. (Default:sample_rate // 2
) n_stft (int, optional): Number of bins in STFT. Seen_fft
inSpectrogram
. (Default:201
) norm (str or None, optional): If"slaney"
, divide the triangular bark weights by the width of the bark band(area normalization). (Default:
None
)bark_scale (str, optional): Scale to use:
traunmuller
,schroeder
orwang
. (Default:traunmuller
)- Example
>>> waveform, sample_rate = torchaudio.load("test.wav", normalize=True) >>> spectrogram_transform = transforms.Spectrogram(n_fft=1024) >>> spectrogram = spectrogram_transform(waveform) >>> barkscale_transform = transforms.BarkScale(sample_rate=sample_rate, n_stft=1024 // 2 + 1) >>> barkscale_spectrogram = barkscale_transform(spectrogram)
- See also:
torchaudio.prototype.functional.barkscale_fbanks()
- The function used to generate the filter banks.
- forward(specgram: Tensor) Tensor [source]¶
- Parameters
specgram (torch.Tensor) – A spectrogram STFT of dimension (…, freq, time).
- Returns
Bark frequency spectrogram of size (…,
n_barks
, time).- Return type