oband#
- class diffsptk.FractionalOctaveBandAnalysis(sample_rate: int, *, f_min: float = 40, f_ref: float = 1000, f_max: float = 8000, filter_order: int = 1000, n_fract: int = 1, overlap: float = 1)[source]#
Fractional octave filter band analysis module.
- Parameters:
- sample_rateint >= 1
The sample rate in Hz.
- f_minfloat >= 0
The minimum frequency in Hz.
- f_reffloat >= 0
The reference frequency in Hz.
- f_maxfloat <= sample_rate // 2
The maximum frequency in Hz.
- filter_orderint >= 3
The order of the filter.
- n_fractint >= 1
The number of fractions.
- overlapfloat in [0, 1]
The overlap factor.
References
[1]J. Antoni, “Orthogonal-like fractional-octave-band filters,” The Journal of the Acoustical Society of America, vol. 127, no. 2, pp. 884-895, 2010.
- forward(x: Tensor) Tensor [source]#
Perform fractional octave filter band analysis.
- 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.ramp(0, 1, 0.25) >>> x tensor([0.0000, 0.2500, 0.5000, 0.7500, 1.0000]) >>> oband = diffsptk.FractionalOctaveBandAnalysis(16000) >>> y = oband(x) >>> y.shape torch.Size([1, 9, 5]) >>> y.sum(1).squeeze() tensor([-0.0184, 0.0969, 0.3940, 0.6062, 0.9033])