Benjolin on Kastle 2
[!WARNING] None of this has been tested on real hardware. The firmware compiles and its DSP is tested against the emulator, but nobody has flashed it to a Kastle 2. Nobody has printed the panel and fitted it to a unit either. Flash and print at your own risk. Bastl's official firmware can be reflashed at any time (see firmware/README.md).
A Benjolin-style instrument for the Bastl Kastle 2: two cross-modulating oscillators, an 8-bit rungler and a resonant filter. The repo has three parts:
- Browser emulator: the instrument laid out on the Kastle 2 faceplate, with the knobs, SHIFT layer, LEDs and patch bay, so the design can be tried without hardware.
- Firmware: a Kastle 2 app running the same DSP in fixed point, built as a
.uf2by GitHub Actions. - Printable top panel: STLs made from Bastl's blank panel template, blank or with raised Benjolin labels.
This is an unofficial community project, not affiliated with or endorsed by Bastl Instruments.
It is a single self-contained HTML page. The DSP runs in an AudioWorklet and falls back to a ScriptProcessor if the worklet is blocked.
Quick start
npm install
npm test # builds, then runs all tests (the firmware tests need a C++ compiler)
npm run build # writes dist/benjolin-emulator.html
Open dist/benjolin-emulator.html in a browser and press Start audio. Needs Node 22.15 or newer for the build and tests; the page itself has no dependencies.
To host it, commit dist/benjolin-emulator.html as index.html on a GitHub Pages branch, or serve the dist/ folder.
Controls
| Knob | Normal layer | With SHIFT |
|---|---|---|
| POT_1 | CV amount for pitch (center = none) | FX: center off, left bitcrush, right delay |
| POT_2 | CV amount for cross-mod | Quantizer amount |
| POT_3 | CV amount for cutoff | Tempo, 60 to 180 BPM |
| POT_4 | Resonance | Volume |
| POT_5 | Osc 1 | Cross-mod |
| POT_6 | Osc 2 | Rungler to osc |
| POT_7 | Cutoff | Rungler to filter |
- MODE cycles the rungler input (Chaos, Loop, Data). SHIFT + MODE cycles the filter (low, band, high pass).
- Hold SHIFT on screen, hold the Shift key, or use Latch SHIFT.
- Each knob keeps one value per layer. A layer's value only changes when you turn that knob in that layer, as on the device. The yellow dot on a knob's ring marks the active layer's value.
- The delay is a dotted eighth note at the current tempo. The quantizer pulls oscillator pitch (knob, CV and rungler) toward the nearest note of the chosen scale, rooted on A, by the knob amount. Cross-modulation is added after the quantizer so it stays unquantized.
Pin assignments are in docs/PIN_MAP.md.
Layout
src/dsp.js the Benjo class (all DSP, patch routing, FX, quantizer)
src/template.html page, faceplate drawing, UI logic; contains a /*DSP*/ placeholder
build.js inlines dsp.js into the template -> dist/benjolin-emulator.html
test/dsp.test.js headless DSP tests
test/ui.test.js jsdom tests of the page logic
test/firmware.test.js compares the firmware's fixed-point DSP with src/dsp.js
firmware/ Kastle 2 app (see firmware/README.md)
panel/ printable top panels (blank and labelled) and their generator (see panel/README.md)
docs/PIN_MAP.md hardware pin map and what each pin does in this app
Status and honesty notes
- Nobody has listened to this on real hardware, and the author of the first version could not listen at all. Tests check numbers and behaviour, not sound quality.
- The knob, button and pin meanings are a proposal for a Benjolin app. They are not a Bastl mapping.
- The emulator runs in floating point at the browser's sample rate and doesn't model CPU limits. The firmware is fixed-point at 44 kHz; its CPU load on the RP2040 hasn't been measured.
- Assumptions that real firmware may contradict are listed in docs/PIN_MAP.md.
Firmware
firmware/ has a Kastle 2 app that runs the same DSP in fixed point. GitHub Actions builds kastle2-benjolin.uf2 on every push to main. It has not been tested on hardware yet.
Next steps
- Flash the firmware, check that it runs without crackles, and tune it by ear.
- Validate the assumptions in docs/PIN_MAP.md against a real unit.
- Compare the rungler behaviour with a real Benjolin.
Credits and licences
This project is built on Bastl Instruments' open-source Kastle 2 work. Thank you to Václav Mach, Marek Mach and everyone at Bastl for publishing it.
- bastl-instruments/kastle2 (code: MIT)
- The firmware is a Kastle 2 app built on Bastl's firmware framework: hardware layer, Base, FancyPot, memory, LED palette, test mode and build system.
firmware/build.shdownloads that repo at a pinned commit and builds inside it; none of Bastl's code is copied into this repo. firmware/Benjolin/main.cppfollows the structure of Bastl's Template app.- Two values in the app come from Bastl's code and are credited in comments where they're used: the volume mapping (from the Base output gain) and the PATTERN pins' resting level.
- The
.uf2built by GitHub Actions contains Bastl's MIT-licensed code, plus the Raspberry Pi Pico SDK (BSD-3-Clause) and TinyUSB (MIT). Their licence notices apply to that binary.
- The firmware is a Kastle 2 app built on Bastl's firmware framework: hardware layer, Base, FancyPot, memory, LED palette, test mode and build system.
- Bastl documentation (CC BY-SA 4.0): the faceplate layout, pin rows and LEDs drawn in the emulator come from the "pins and pots" diagram in the kastle2 repo's glossary. Hardware facts come from the repo's README, glossary and the Kastle 2 Wave Bard manual. The emulator's faceplate drawing is an adaptation of that diagram and is shared under CC BY-SA 4.0.
- Bastl's blank panel template (CC BY-SA 4.0):
case/top-panel/kastle2-template-panel.brdis the source of the printable panel.panel/(the generator, STL and preview) is shared under CC BY-SA 4.0. See panel/README.md. - Barlow Condensed by The Barlow Project Authors (SIL Open Font License 1.1) is the font of the panel labels;
panel/fonts/holds the font and its licence. - Not included: Bastl's panel graphics, case artwork and sample banks, which Bastl keeps under all rights reserved.
- The Benjolin is a design by Rob Hordijk. This is an independent Benjolin-style model, not his circuit.
- "Bastl", "Kastle 2" and "Citadel" are names of Bastl Instruments and are used here only to say what this works with. Neither Bastl nor Rob Hordijk is affiliated with this project.
Licensing: everything in this repo is MIT (LICENSE) except the CC BY-SA 4.0 parts listed above: the emulator's faceplate drawing in src/template.html and the panel/ folder. The font in panel/fonts/ stays under its own SIL Open Font License.
