peterc / coopiano
git clone https://github.com/peterc/coopiano.git
A physically modelled piano synthesizer in C++17 with offline WAV rendering and live MIDI on macOS.
—
stars, 24h
+62
stars, 7 days · #787
+62
stars, 30 days · #4,276
62
★ total · +62% this week
2
forks · 0 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguageC++
LicenseMIT
Created2026-10-14 (6d ago)
Last push6d ago
Watchers1
OwnerUser
Links
- GitHub: github.com/peterc/coopiano
- Releases · Issues · Hacker News mentions
README excerpt
# coopiano - physically modelled piano synthesizer https://github.com/user-attachments/assets/aa7c3835-e664-40b2-91cd-c30ee46f2247 A physically modelled piano synthesizer in C++17. It renders notes and MIDI files to stereo WAV and supports live MIDI input on macOS. Sound is synthesized from a hammer, string, soundboard and sympathetic-resonance model, with a room reverb effect. No piano samples, downloads or third-party libraries are required. > [!NOTE] > It is VERY EARLY days for releasing this code. The piano is fine, but I have a prototyped AU and VST plugin, etc. which are not part of this open release so far. ## Build You need a C++17 compiler and Make. On macOS, install the Xcode Command Line Tools (`xcode-select --install`) if they are not already available, then run: [code] macOS builds link the system CoreMIDI, AudioToolbox, CoreFoundation and CoreAudio frameworks. The source also supports offline rendering on other platforms with a C++17 compiler and threads; live MIDI/audio is macOS-only. This extraction was built and tested on macOS; other platforms have not been verified here. Compiler settings can be overridden, for example `make CXX=clang++ CXXFLAGS=-O3`. Run `make clean` before changing compiler settings. `make clean` removes only the executable, preserving any renders and presets. ## Run [code] Running `./coopiano` without arguments renders A4 at velocity 0.5 for eight seconds. Offline commands write 44.1 kHz, 16-bit stereo WAV files; they do not play them automatically. On macOS, use `afplay A4_gp.wav` to listen. Each offline render is peak-normalized independently. ## Presets Built-in defaults work without any configuration file. `default.ini` documents the available voicing and reverb controls, including their ranges. Copy it, edit the copy, then select it explicitly: [code] The audition command plays a chord at increasing velocities. Use `--help` for its chord, velocity and timing options. Editing `default.ini` alone does not change the built-in sound; pass `--preset` and restart playback to load changes. [code] `GP_SAVE_SETTINGS=1` writes a resolved preset beside the WAV as `A4_gp.wav.ini`. Environment overrides take precedence over preset settings. ## Source layout - `coopiano.cpp`: CLI, MIDI file parser, WAV writer and macOS live host. - `piano.hpp`: header-only synthesis library in namespace `piano`. - `instrument.hpp`: voice pool, note/pedal scheduling and instrument effects. - `streaming_soundboard.hpp`: streaming soundboard convolution. - `preset.hpp` and `reverb.hpp`: INI configuration and stereo room effect. - `piano_host.hpp` and `piano_resampler.hpp`: host-rate adaptation and resampling. - `live_diagnostics.hpp` and `live_bench.hpp`: support compiled into the macOS host. The C++ source/header files originate from the development project. Historical comments may refer to documentation in that larger project. The original test and benchmark collections are not bundled here. ## License MIT. See LICENSE.