igammatone#
- class diffsptk.GammatoneFilterBankSynthesis(sample_rate, *, desired_delay=4, f_min=70, f_base=1000, f_max=6700, filter_order=4, bandwidth_factor=1.0, density=1.0, exact=False, n_iter=100, eps=1e-08)[source]#
Gammatone filter bank analysis.
- Parameters:
- sample_rateint >= 1
Sample rate in Hz.
- desired_delayfloat > 0
Desired delay in milliseconds.
- f_minfloat >= 0
Minimum frequency in Hz.
- f_basefloat >= 0
Base frequency in Hz.
- f_maxfloat <= sample_rate // 2
Maximum frequency in Hz.
- filter_orderint >= 1
Order of Gammatone filter.
- bandwidth_factorfloat > 0
Bandwidth of Gammatone filter.
- densityfloat > 0
Density of frequencies on the ERB scale.
- exactbool
If False, use all-pole approximation.
- n_iterint >= 1
Number of iterations for gain computation.
- epsfloat >= 0
Tolerance for gain computation.
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.
[2]T. Herzke, “Improved numerical methods for Gammatone filterbank analysis and synthesis,” Acta Acustica united with Acustica, vol. 93, no. 3, pp. 498-500, 2007.
- forward(y, keepdim=True, compensate_delay=True)[source]#
Reconstruct waveform from filter bank signals.
- Parameters:
- yTensor [shape=(B, K, T) or (K, T)]
Filtered signals.
- keepdimbool
If True, the output shape is (B, 1, T) instead (B, T).
- compensate_delaybool
If True, compensate the delay.
- Returns:
- outTensor [shape=(B, 1, T) or (B, T)]
Reconstructed waveform.
Examples
>>> x = diffsptk.impulse(15999) >>> x[:5] tensor([1., 0., 0., 0., 0.]) >>> f = diffsptk.GammatoneFilterBankAnalysis(16000) >>> g = diffsptk.GammatoneFilterBankSynthesis(16000) >>> y = g(f(x)).squeeze() >>> y[:5] tensor([ 0.8349, 0.0682, -0.1085, 0.0559, -0.0947])
See also