gammatone#
- class diffsptk.GammatoneFilterBankAnalysis(sample_rate: int, *, f_min: float = 70, f_base: float = 1000, f_max: float = 6700, filter_order: int = 4, bandwidth_factor: float = 1, density: float = 1, exact: bool = False)[source]#
Gammatone filter bank analysis module.
- Parameters:
- sample_rateint >= 1
The sample rate in Hz.
- f_minfloat >= 0
The minimum frequency in Hz.
- f_basefloat >= 0
The base frequency in Hz.
- f_maxfloat <= sample_rate // 2
The maximum frequency in Hz.
- filter_orderint >= 1
The order of the Gammatone filter.
- bandwidth_factorfloat > 0
The bandwidth of the Gammatone filter.
- densityfloat > 0
The density of frequencies on the ERB scale.
- exactbool
If False, use all-pole approximation.
References
[1]V. Hohmann, “Frequency analysis and synthesis using a Gammatone filterbank,” Acta Acustica united with Acustica, vol. 88, no. 3, pp. 433-442, 2002.
- forward(x: Tensor) Tensor [source]#
Apply Gammatone filter banks to the input signal.
- Parameters:
- xTensor [shape=(B, 1, T) or (B, T) or (T,)]
The input signal.
- Returns:
- outTensor [shape=(B, K, T)]
The analyzed signal.
Examples
>>> x = diffsptk.impulse(15999) >>> gammatone = diffsptk.GammatoneFilterBankAnalysis(16000) >>> y = gammatone(x) >>> y.shape torch.Size([1, 30, 16000])
See also