BEATFuck
Brainfuck written as a drum pattern. Every track plays one step a tick, and the kick moves the pointer.
2026 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
BEATFuck is from 2026, and its interpreter is written in Rust. A program is a drum pattern. Each track is a row of steps, and the eight brainfuck commands are drum sounds. On every tick the interpreter plays one step of each track, top to bottom, so two sounds on the same beat still run one after the other.
Read the story
Tracks of different lengths wrap on their own, as in a polymeter. A 16-step kick against a 12-step hat repeats every 48 ticks. There is no halt instruction. A program without loops stops after one such cycle, and a program with loops goes on until no loop is active.
The machine
| Step | Sound | Brainfuck | Does |
|---|---|---|---|
K | kick | > | Move the pointer right |
S | snare | < | Move the pointer left |
H | hat | + | Add 1 to the cell |
h | ghost hat | - | Take 1 from the cell |
O | open hat | . | Print the cell as a byte |
C | clap | , | Read a byte, if there is one |
. | rest | Nothing, for one tick | |
|: :| | loop | [ ] | Skip to the end when the cell is 0; jump back when it is not |
The tape has 256 cells of 8 bits, and both wrap. A header line DATA 72 101 108 fills the tape from cell 0, and a number inside a track does the same. BPM, TIME and GRID describe the music and change nothing.
Example
The header example.
The header example. K moves to cell 1, H makes its 101 a 102, and O prints it.
A loop counts cell 0 down from 5 and prints cell 1 on each pass, adding 1 to it each time.
Two tracks on one tick run in the order they are written. With the print first it prints cell 0, with the kick first it prints cell 1.
The countdown, DATA 5 and |: h :|, takes 15 ticks, the number the specification gives. The Hello World fixture is not printed in the specification, but its result is. It prints Hello and a 0 byte in 11 ticks and leaves the pointer at 5. One track of six O and five K steps, O K O K O K O K O K O, does exactly that. Without its last K O it prints just Hello, in 9 ticks.
Patterns it teaches
- Camouflage: a program that reads as a drum pattern.
Further
See also
Also in Strange time
Write your own in Run Convert a program from BEATFuck
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: beatfuck.
Command line
shib run beatfuck -e 'DATA 5
[count] |: h :|'shib manual beatfuckSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/beatfuck.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org