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 and convert it to frequency domain

create_cqt_kernels_t

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.

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

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.

torch_window_sumsquare

uniform_distribution