Visualizations
220 / 500

220 · Retro

Chiptune Tracker

An 8-bit sound chip emulated from scratch, playing a procedurally composed song.

The chip has two pulse voices (an 8-step sequencer at 12.5, 25, 50 or 75 percent duty), a triangle stepping through a 32-step 4-bit staircase, and noise from a 15-bit linear feedback shift register with a long mode and a short metallic one, all clocked at 1.789773 MHz. Each output sample is the exact average of every channel's level over that sample's CPU cycles, then mixed through the chip's non-linear DAC curves and its 90 Hz and 440 Hz high-pass and 14 kHz low-pass filters. The tracker drives it the way real ones did: sixty times a second it reads the pattern, runs instrument envelopes and effects (0xy arpeggio, slides, vibrato, volume slide, duty and speed) and writes new register values, which are shown live. The song is composed from a seed: a chord progression, a triangle bass line, noise drums, arpeggiated chords and a motif-based lead with an echo voice.

Try it. Space plays or stops. With the cursor in a note column the keyboard is a piano (Z to M and Q to U, [ and ] change octave); in the other columns type hex digits, and Delete clears. Arrow keys and Tab move the cursor, click a cell to jump to it. Click a scope to mute its channel (Shift-click solos), click the duty icons to force a pulse duty cycle, and press F5 or NEW SONG for a different composition. Click once for sound.

  • Cycle-accurate chip emulation
  • Box-filtered band limiting
  • LFSR noise
  • Tracker effects and envelopes
  • Procedural composition

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a small chiptune tracker with JavaScript, the HTML canvas element and the Web Audio API. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Write a tiny sound chip yourself in a ScriptProcessorNode or AudioWorklet that starts on the first click: two pulse wave voices with a selectable duty cycle (12.5, 25, 50 or 75 percent), a triangle voice that steps through 16 volume levels instead of being smooth, and a noise voice made from a 15-bit linear feedback shift register.
- Store a song as a pattern of 32 rows by 4 channels. Each cell holds a note (or nothing) and a volume. Advance one row every 6 ticks of a 60 Hz clock that you count in audio samples, so the music stays in time.
- Give each note a simple volume envelope that decays tick by tick, and make the noise voice play kick, snare and hi-hat sounds by changing its period and envelope.
- Draw the pattern as scrolling columns of text (like C-4 01 F) in a pixel font, with the playing row highlighted in the middle.

Once that works, make it beautiful:
- Add a small oscilloscope for each channel (record each voice's output into a ring buffer and trigger on a rising edge) and chunky pixel VU meters.
- Add the classic arpeggio effect: cycle the note through the root, +x and +y semitones on every tick to fake a chord on one channel.
- Let me edit cells with the keyboard (the bottom two letter rows as a piano), mute channels by clicking their scopes, and compose a short song procedurally from a chord progression so there is music right away.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as band-limited synthesis to remove aliasing, slides and vibrato, or exporting the song as a WAV file.
PreviousMancalaThe ancient sowing game on a carved wooden board, played by minimax with alpha-beta. NextSymbolic RegressionGenetic programming breeds formulas until it rediscovers the law behind the data.

Related visualizations

  • Demoparty IntroRetro A one-minute demoscene production, beat-synced to a tune synthesized from code.
  • Bytebeat MachineSound Whole songs from one line of bit arithmetic, drawn as a tapestry of bytes.
  • Breadboard CPURetro A microcoded 8-bit breadboard computer paints cellular automata on a 16x16 LED matrix.
  • Modular SynthSound A eurorack case with a working signal graph and patch cables that sag and swing.
  • Oscilloscope MusicRetro A phosphor XY scope draws a 4D tesseract, knots and text from the stereo sound you hear.
  • Mode 7 TrackRetro The per-scanline floor trick of 16-bit kart racers, with a debug view of every row.
  • Generative MusicSound A self-composing synthesizer you can see, played with the Web Audio API.
  • Music BoxSound A pinned brass drum plucks cantilever tines from a punched strip you can edit.
  • Dither LabRetro Seven dithering algorithms race on a moving scene in 1-bit, handheld green, CGA and EGA.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs