nnAudio.utilsΒΆ

Module containing helper functions such as overlap sum and Fourier kernels generators

Functions

broadcast_dim

Auto broadcast input so that it can fits into a Conv1d

broadcast_dim_conv2d

Auto broadcast input so that it can fits into a Conv2d

complex_mul

Since PyTorch does not support complex numbers and its operation.

create_cqt_kernels

Automatically create CQT kernels in time domain

create_fourier_kernels

This function creates the Fourier Kernel for STFT, Melspectrogram and CQT.

create_lowpass_filter

Calculate the highest frequency we need to preserve and the lowest frequency we allow to pass through.

downsampling_by_2

A helper function that downsamples the audio by half.

downsampling_by_n

A helper function that downsamples the audio by a arbitary factor n.

early_downsample

Return new sampling rate and hop length after early dowansampling

early_downsample_count

Compute the number of early downsampling operations

extend_fbins

Extending the number of frequency bins from n_fft//2+1 back to n_fft by reversing all bins except DC and Nyquist and append it on top of existing spectrogram

get_cqt_complex

Multiplying the STFT result with the cqt_kernel, check out the 1992 CQT paper [1] for how to multiple the STFT result with the CQT kernel [2] Brown, Judith C.C.

get_cqt_complex2

Multiplying the STFT result with the cqt_kernel, check out the 1992 CQT paper [1] for how to multiple the STFT result with the CQT kernel [2] Brown, Judith C.C.

get_early_downsample_params

Used in CQT2010 and CQT2010v2

get_window_dispatch

nextpow2

A helper function to calculate the next nearest number to the power of 2.

overlap_add

prepow2

A helper function to calculate the next nearest number to the power of 2.

rfft_fn

torch_window_sumsquare

uniform_distribution