A faithful port of the Genoqs Octopus MIDI sequencer firmware to Linux and Windows, using ALSA/winmm for MIDI I/O and OSC for the control surface.
Also available: The
cuttlefish-v6branch builds against the octopus-cuttlefish-6.0.0 firmware with SoloRec, MIDI slave clock, and recording features.
# Clone with firmware submodule
git clone --recurse-submodules <repo-url>
cd Octopus
# Build everything (requires: gcc, libasound2-dev, Rust)
# produces build/octopus + octopus_gui
cargo build --release
# Run headless (engine + web control surface)
./target/release/octopus_gui --no-gui
# Open in browser
# http://localhost:8088If you cloned without --recurse-submodules, initialize the firmware submodule:
git submodule update --initThe original firmware source is a git submodule at firmware/ (a fork of
genoqs-community/source with
20 #ifdef __linux__/_WIN32/NEMO patches in patches/).
The entire 65,000-line firmware compiles and runs on Linux via an eCos
compatibility shim (hal_linux.c) that maps cyg_* APIs to pthreads, pipes,
POSIX semaphores, and timerfd. No original firmware logic is modified (only
20 minimal guarded patches for NULL safety, CPU-load stub, ALSA/winmm routing, and Nemo build compat).
| File | Purpose |
|---|---|
src/engine.c |
Engine core (single firmware TU), sequencer thread, hosted API |
src/engine_main.c |
Standalone entry point (build/octopus) |
src/hal_linux.c |
eCos API shim (pthread, pipe, timerfd) |
src/midi_alsa.c |
ALSA sequencer I/O (2 out ports + 1 in port) |
src/osc_server.c |
OSC UDP input server (dependency-free) |
src/osc_render.c |
MIR → OSC output bridge + 60 Hz render thread |
include/hal_linux.h |
eCos type/macro declarations |
web_gui.py |
WebSocket ↔ OSC bridge for browser control surface |
web_gui.html |
Browser-based grid UI |
Input (control surface → engine):
| Address | Args | Maps to |
|---|---|---|
/octopus/key |
ii (index 1–260, press 1/release 0) |
executeKey(index) |
/octopus/rotary |
ii (id 0–20, INC=2/DEC=1) |
executeRot() |
/octopus/transport |
s ("start"/"stop"/"pause"/"continue") |
transport state |
/octopus/tempo |
i (bpm 10–199) |
G_master_tempo |
/octopus/zoom |
i (level 0–14) |
G_zoom_level |
/octopus/clocksource |
i (0=OFF, 1=INT, 2=EXT) |
G_clock_source |
/octopus/quit |
— | clean shutdown |
Output (engine → control surface):
| Address | Args | Content |
|---|---|---|
/octopus/mir |
b (170-byte blob) |
Full MIR LED framebuffer |
/octopus/blink |
i |
Master blinker phase |
/octopus/transport |
i |
Playing (1) / stopped (0) |
| Region | Index | Formula |
|---|---|---|
| Step matrix | 11–185 | 11 + col * 11 + row (row 0–9, col 0–15) |
| Transport | 241=PLAY, 231=STOP, 232=PAUSE, 223=RECORD | |
| Zoom | 218=GRID, 219=PAGE, 220=TRACK, 227=STEP | |
| Track selectors | 1–10 | track 0–9 |
| Rotary encoders | 0–20 | TEMPO, VEL, PIT, LEN, STA, POS, DIR, AMT, GRV, MCC, MCH |
The engine creates ALSA sequencer client with ports:
out_A— channels 1–16 (physical MIDI out 1)out_B— channels 17–32 (physical MIDI out 2)in— MIDI input (clock slave, recording)
# Auto-connected to Midi Through for testing.
# Connect to a synth:
aconnect <octopus_client>:0 <synth_client>:<port>
# Monitor:
aseqdump -p <octopus_client>:0
# External clock source:
aconnect <clock_source>:<port> <octopus_client>:2The engine can be driven from a browser-based control surface in two ways:
| Host | Type | Engine location | HTML files |
|---|---|---|---|
octopus_gui |
Native desktop app (egui) with MIDI device picker | In-process (statically linked) | Embedded at compile time |
octopus_gui --no-gui |
Headless (engine + web server, Ctrl+C to quit) | In-process (statically linked) | Embedded at compile time |
web_gui.py |
Python bridge (legacy) | Separate process (./build/octopus) |
Reads from disk |
Built from the Cargo workspace (engine/, gui/): the octopus-engine crate
hosts the C engine in-process (no subprocess, no OSC UDP loopback on port
9000), serves the HTML control surface on port 8088 and bridges WebSocket ↔
engine directly.
# Requires gcc + libasound2-dev (the build compiles the C engine into
# build/liboctopus.a automatically via engine/build.rs)
cargo build --release
./target/release/octopus_gui # desktop app: pick MIDI ports, Start
./target/release/octopus_gui --no-gui # headless: engine + web server
# The old standalone engine binary + Python bridge still work:
./build/octopus &
python3 web_gui.pyOn Windows octopus_gui must be built with the x86_64-pc-windows-gnu
target (the C engine is MinGW-built):
rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnuThe HTML control surface (web_gui.html, /modern → web_gui_modern.html)
is the same everywhere — the Rust hosts embed it at compile time, so changes
require a rebuild; web_gui.py reads it from disk.
State auto-saves on exit to octopus_state.bin and auto-loads on startup.
Uses the firmware's PersistentV2 serialization format (PersPageExport/Import).
# Basic MIDI verification
./build/octopus &
python3 tests/test_osc.py # OSC commands
aseqdump -p 128:0 # watch MIDI output
# Phase 4 test (rotary encoders, track attributes)
python3 tests/test_phase4.pymake # Octopus (10 tracks × 16 steps)
make NEMO=1 # Nemo (8 visible tracks, Cadence, Wilson windowing)
make clean20 files modified in the firmware/ submodule (all minimal, guarded by #ifdef). Split across two patch files:
includes-declarations.h— swap eCos headers forhal_linux.hInit_memory.h— NULL guard inPAGE_init()(ARM hardware masked this bug)cpu-load.c— disable CPU load check on Linux/Windows (no hardware countdown timer)play_MIDI.h—#ifdef __linux__routingMIDI_send()to ALSAshow_hwdriver.h—#ifndef __linux__suppressing hardwareVIEWER_show_MIR()
defs_functions.h— defineKEY/LED_RANDOMIZEunder#ifdef NEMOincludes-definitions.h— add Nemo helper functions under#ifdef NEMOOS_infrastructure.h— wrap alarm creation in#if !linux && !_WIN32Intr_KEY_functions.h— fixmemset(MIR, 0, 204)→sizeof(MIR)Intr_TMR.h— move MIDI clock to sequencer thread; addg_tick_nsprecomputekey_GRID.h,key_MAP.h,key_STEP.h— wrapKEY_RANDOMIZEin#ifndef NEMOkey_PAGE_sel_NONE.h— wrapKEY_MIXTGT_USR1–4in#ifndef NEMO(fixes duplicate case values)key_PAGE_sel_NONE_BIRDSEYE.h,key_PAGE_sel_STEP.h,key_PAGE_sel_TRACK.h— wrapKEY_RANDOMIZEin#ifndef NEMOIntr_KEY_GRID.h— wrapKEY_RANDOMIZEin#ifndef NEMOplay_functions.h,play_play.h— minor whitespace
Patches are stored in patches/. See scripts/setup-firmware.sh for fork setup.
GPL v2 (inherited from the original Octopus_OS firmware).