jdxi_editor.audio.analysers.spectrum_analyser

A 31-band spectrum from one real FFT.

This measures the signal. It does not filter it.

Attributes

BAND_CENTERS

ATTACK

RELEASE

_EPSILON

Classes

SpectrumAnalyser

Hann-windowed FFT, gathered into logarithmic bands, then smoothed.

Functions

band_edges() → numpy.ndarray

The frequency each side of every centre, on a log scale.

band_for_frequency(frequency) → int

Which band contains frequency.

Module Contents

jdxi_editor.audio.analysers.spectrum_analyser.BAND_CENTERS[source]
jdxi_editor.audio.analysers.spectrum_analyser.ATTACK = 0.6[source]
jdxi_editor.audio.analysers.spectrum_analyser.RELEASE = 0.1[source]
jdxi_editor.audio.analysers.spectrum_analyser._EPSILON = 1e-12[source]
jdxi_editor.audio.analysers.spectrum_analyser.band_edges() → numpy.ndarray[source]

The frequency each side of every centre, on a log scale.

Returns:

np.ndarray length BAND_COUNT + 1

jdxi_editor.audio.analysers.spectrum_analyser.band_for_frequency(frequency: float) → int[source]

Which band contains frequency.

Parameters:

frequency – float Hz

Returns:

int index into BAND_CENTERS

class jdxi_editor.audio.analysers.spectrum_analyser.SpectrumAnalyser(sample_rate: int)[source]

Hann-windowed FFT, gathered into logarithmic bands, then smoothed.

sample_rate[source]
_window[source]
_window_sum[source]
_edges[source]
_levels[source]
_bin_band[source]
magnitude_bands(mono: numpy.ndarray) → numpy.ndarray[source]

Unsmoothed band levels, in dB, for one mono block.

Parameters:

mono – np.ndarray samples. Shorter than the FFT is padded.

Returns:

np.ndarray shape (BAND_COUNT,)

update(mono: numpy.ndarray) → numpy.ndarray[source]

Smooth the bands and return a clipped copy.

Parameters:

mono – np.ndarray samples

Returns:

np.ndarray shape (BAND_COUNT,), dB