icqt#
- diffsptk.ICQT#
alias of
InverseConstantQTransform
- class diffsptk.InverseConstantQTransform(frame_period, sample_rate, *, f_min=32.7, n_bin=84, n_bin_per_octave=12, tuning=0, filter_scale=1, norm=1, sparsity=0.01, window='hann', scale=True, res_type='kaiser_best', **kwargs)[source]#
Perform inverse constant-Q transform based on the librosa implementation.
- Parameters:
- frame_periodint >= 1
Frame period in samples,
.- sample_rateint >= 1
Sample rate in Hz.
- f_minfloat > 0
Minimum center frequency in Hz.
- n_binint >= 1
Number of CQ-bins,
.- n_bin_per_octaveint >= 1
number of bins per octave,
.- tuningfloat
Tuning offset in fractions of a bin.
- filter_scalefloat > 0
Filter scale factor.
- normfloat
Type of norm used in basis function normalization.
- sparsityfloat in [0, 1)
Sparsification factor.
- windowstr
Window function for the basis.
- scalebool
If True, scale the CQT response by the length of filter.
- res_type[‘kaiser_best’, ‘kaiser_fast’] or None
Resampling type.
- **kwargsadditional keyword arguments
- forward(c, out_length=None)[source]#
Compute inverse constant-Q transform.
- Parameters:
- cTensor [shape=(…, T/P, K)]
CQT complex output.
- out_lengthint or None
Length of output waveform.
- Returns:
- outTensor [shape=(…, T)]
Reconstructed waveform.
Examples
>>> x = diffsptk.sin(99) >>> cqt = diffsptk.CQT(100, 8000, n_bin=4) >>> icqt = diffsptk.ICQT(100, 8000, n_bin=4) >>> y = icqt(cqt(x), out_length=x.size(0)) >>> y.shape torch.Size([100])