SignalProcessing

Utility functions for audio signal processing.

Functions

Link copied to clipboard
fun fft(real: FloatArray, imag: FloatArray)

Performs an In-place Fast Fourier Transform.

Link copied to clipboard

Applies a Hamming window to the signal.

Link copied to clipboard

Applies a Hanning window to the signal.

Link copied to clipboard
fun hzToMel(hz: Float): Float

Converts a frequency in Hertz to Mel scale.

Link copied to clipboard
fun melFilterBanks(numFilters: Int, fftSize: Int, sampleRate: Int, lowFreq: Float = 0.0f, highFreq: Float = sampleRate / 2f): Array<FloatArray>

Generates Mel filter banks.

Link copied to clipboard
fun melSpectrogram(signal: FloatArray, sampleRate: Int, fftSize: Int, hopSize: Int, numMels: Int, window: FloatArray = hanningWindow(fftSize)): List<FloatArray>

Computes the Mel-spectrogram of a signal.

Link copied to clipboard
fun melToHz(mel: Float): Float

Converts a Mel scale value back to frequency in Hertz.

Link copied to clipboard
fun powerSpectrogram(signal: FloatArray, fftSize: Int, hopSize: Int, window: FloatArray): List<FloatArray>

Computes the power spectrogram of a signal.