# Audio Spectrum FFT bars over a synthesised arpeggio ```{raw} html ▶ Run in browser ``` **Tags:** `audio` `spectrum` `fft` `synthesis` An AudioSynth-baked arpeggio loops on an AudioPlayer while a log-spaced bar spectrum dances in time with it. Each frame the demo reads get_playback_position(), slices a 2048-sample window out of the clip's own PCM buffer (backend_data), and runs np.fft.rfft over it. The engine has no audio output tap, so this analyses the source buffer the example itself generated, synchronised by playback position; it cannot analyse file-backed streams (their backend_data is None). ## What it demonstrates - AudioSynth voices (oscillators + ADSR envelopes + a LowPass drone) baked into an AudioClip via bake() / AudioClip.from_pcm. - backend_data as a float32 interleaved numpy buffer, indexed at int(get_playback_position() * sample_rate) frames during playback. - A windowed rfft per frame, folded into log-spaced bands with peak-hold caps, drawn with the immediate-mode 2D renderer. Controls: SPACE - Pause / resume ESC - Quit Run: uv run python examples/features/audio/spectrum.py Headless self-check: uv run python examples/features/audio/spectrum.py --test ## Source ```{literalinclude} ../../examples/features/audio/spectrum.py :language: python :linenos: ```