gammatone#

class diffsptk.GammatoneFilterBankAnalysis(sample_rate, *, f_min=70, f_base=1000, f_max=6700, filter_order=4, bandwidth_factor=1.0, density=1.0, exact=False)[source]#

Gammatone filter bank analysis.

Parameters:
sample_rateint >= 1

Sample rate in Hz.

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.

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)[source]#

Apply Gammatone filter banks to signals.

Parameters:
xTensor [shape=(B, 1, T) or (B, T) or (T,)]

Original waveform.

Returns:
outTensor [shape=(B, K, T)]

Filtered signals.

Examples

>>> x = diffsptk.impulse(15999)
>>> gammatone = diffsptk.GammatoneFilterBankAnalysis(16000)
>>> y = gammatone(x)
>>> y.shape
torch.Size([1, 30, 16000])

See also

igammatone