Bubba Machine

Bubba Machine's audio

Bubba Machine has one goal: a hi-fi machine, the best audio quality the FM-1 allows: studio-grade sound computed live on a small groovebox, with no shortcut you can hear. This page covers what changed in 0.4.0-beta to get there, what each part costs on the device and, just as plainly, what isn't there yet.

All CPU figures were measured on the author's FM-1 with the firmware console (tools/fm1/traza.py). The details of each measurement are in TRAZA_FM1.md and MOTORES.md (Spanish).

The device

ProcessorJieLi AC791N, two cores at 360 MHz with a single-precision FPU
Outputexternal codec over I2S, 24-bit stereo at 44,117.6 Hz (24 MHz / 544, fixed by hardware)
Memory for recorded sound100 KiB of flash shared between takes (up to 3 s each) and user sounds

What improved

1. Everything at 44.1 kHz

In 0.3 the engines ran at 22 kHz and every sample was repeated twice to reach the output. That cuts everything above 11 kHz and leaves images (false highs) above it.

Now the engines and the mix run at the codec's real rate, 44,117.6 Hz, with no oversampling. Highs reach 20 kHz and tuning is exact, because it is computed with the true rate, not with 44,100.

2. Floating-point mixing

0.30.4
Mix businteger, one division per sample and trackfloat, gains computed once per block
Silent tracksstill computedskipped
Live effects capture (stutter, reverse, tape stop)8-bit μ-law16-bit
Delay8-bit μ-law16-bit with interpolated reads
Mix cost with PLAY8.6 % of a core7.3 %, computing twice the samples

Measured on the device, the FPU is 1.5× faster than the 64-bit integer math 0.3 used, so moving to float was both faster and cleaner.

3. Sounds computed live, no low-resolution recordings

0.3 had drum kits recorded at 22 kHz in 8-bit μ-law (nothing above 11 kHz) and low-resolution wavetables. They are all gone. Every sound is now computed on the spot with proven synthesis libraries:

EngineWhat it usesLicense
Modeled drumskick, snare and hi-hat models from Plaits (Mutable Instruments), in float, plus our own clap, cowbell, resonator, noise and FM percussionMIT
B-MINIthree polyBLEP oscillators (anti-aliasing), ladder filter with drive, two envelopes and LFOown and MIT (Plaits/stmlib)
BITTALtables built from a 256-harmonic spectrum in 7 levels, one per octave: each note uses the level whose highest harmonic stays below 19 kHz, so there is no aliasing on any note; unison, filter and macrosown; factory sounds from freely licensed Vital presets
BUNO-6one polyBLEP oscillator per voice, high-pass, 24 dB filter and a two-line modulated stereo chorus, like a Juno'sown
6-operator FMmsfa, the engine of Dexed and the same base as the factory firmware; all 32 DX7 algorithmsApache-2.0
BB-303the TB-303 filter, accent circuit, envelopes and declicker adapted from Open303 in float, with polyBLEP oscillatorsMIT (Open303)

Accent doesn't just raise the level: it changes the hit, like a real drum machine.

4. An output without clicks or steps

5. Exact timing

The sequencer counts 96 PPQN from the audio sample counter: there is no separate clock to drift, and every note lands on its exact sample inside the block.

6. Performance: what makes room for quality

Computing twice the samples with better engines only fits if the code is fast. What was measured and changed:

ChangeBeforeAfter
Data cache (SDK setting)4 KiB effective32 KiB: random reads 6-10× faster
Audio compiled for speed (-O2)demo with PLAY: 36.9 % of a core27.7 %
FM, one voice (E.PIANO)6.6 %3.3 %
ANALOG, one voice1757 ns per sample (10 %)654 ns (4.1 %): 7 voices fit with no late blocks

Removing the recorded kits and wavetables made the program 148 KiB smaller and freed 64 KiB of RAM.

What isn't there yet

This is a beta. What limits quality today, plainly:

What's next

  1. Measure 0.6 on the FM-1: each machine's load, both cores and even volume across the bank sounds.
  2. Master effects: tape delay, compressor and leveler.
  3. A higher-quality sampler, within what the flash allows.
  4. Measure the analog output with an audio interface.

See also: sound engines · sound research · FM-1 measurements (Spanish) · changelog.

This page is generated from docs/en/AUDIO.md. Spotted a mistake? Edit the file and send a pull request.