Analysis

Reading the sound back, to drive visuals.

Master.level

Master.level()

Returns how loud the sound is right now, from 0 to 1 (the RMS of the newest 21 ms).

Linear in amplitude; a rise shows at once and a fall decays by 1/e every 0.12 s. Call it once per frame. kiln.sound.analysis has the details.

Raises

Name Type Description
ImportError The “sound” extra is not installed.

Master.spectrum

Master.spectrum(bands=128)

Returns the loudness of bands log-spaced pitch bands (40 Hz to 16 kHz), each 0 to 1.

Decibels from -80 dB (0) to 0 dB (1), lowest pitch first, smoothed as level. Call it once per frame. kiln.sound.analysis has the details.

Parameters

Name Type Description Default
bands int How many bands to return, 1 to 1024. 128

Returns

Name Type Description
NDArray A float64 NumPy array of bands values.

Raises

Name Type Description
ImportError The “sound” extra is not installed.
ValueError bands is out of range.

Master.waveform

Master.waveform(n=512)

Returns n of the newest samples (-1 to 1), for an oscilloscope line.

The line starts at a rising zero crossing, so the picture holds still. kiln.sound.analysis has the details.

Parameters

Name Type Description Default
n int How many samples to return, 2 to 2048. 512

Returns

Name Type Description
NDArray A float64 NumPy array of n samples, oldest first.

Raises

Name Type Description
ImportError The “sound” extra is not installed.
ValueError n is out of range.

mic

mic