amplitudeOf

fun amplitudeOf(samples: FloatArray, frequencyHz: Int, sampleRate: Int): Float(source)

The amplitude of frequencyHz in samples, on the same scale the samples are.

Samples normalised to -1f..1f give an amplitude in 0f..1f. The window should hold a whole number of cycles or close to it, since a partial cycle leaks into neighbouring frequencies and reads slightly low.

Parameters

samples

Mono samples. Interleaved stereo must be downmixed or one channel taken first.

frequencyHz

The frequency to measure.

sampleRate

The rate samples were decoded at.