A terminal-based interactive piano keyboard built in C.
- Play piano notes interactively in your terminal
- Color themes inspired by classic and modern UIs
- Centered, bordered info box with current theme and pressed note
- Real-time key highlighting and note display
- Uses high-quality sampled piano sounds
Color rendering may vary between terminal emulators (VS Code, Kitty, iTerm, GNOME Terminal, etc.), even with use_default_colors(). The same theme may look different depending on your terminal's palette and settings.
- macOS: Works natively (uses
ncursesfor UI andafplayfor audio) - Linux: UI works natively (
ncurses), but audio playback usesafplay(macOS only). For Linux, replaceafplaywithaplay,paplay, orplay(SoX) insrc/audio.c. - Windows: Not supported natively. Use WSL, Cygwin, or MSYS2 for compatibility. For native Windows, port audio/UI to a Windows-compatible library.
- Install dependencies:
- macOS:
ncurses(usually pre-installed) - Linux:
ncurses(sudo apt install libncurses5-dev)
- macOS:
- Clone the repository and navigate to the project folder.
- Run
maketo build the project.
Run the program:
./in-cControls:
- Play notes using the mapped keys (Z, S, X, D, C, V, G, B, H, N, J, M, ,)
- Press 't' to cycle color themes
- Press 'q' to quit
On macOS, audio playback uses the afplay command. On other platforms, you may need to modify src/audio.c to use a different audio player (e.g., aplay, paplay, or play on Linux).
This project uses piano note samples from the University of Iowa Musical Instrument Samples (MIS), created by Lawrence Fritts, Director of the Electronic Music Studios and Professor of Composition at the University of Iowa.
Since 1997, these recordings have been freely available and may be downloaded and used for any projects, without restrictions. These are used by musicians, application developers, teachers, students, and researchers. These have been used in over 270 published research articles and books. Please let me know if these have been helpful in your research and music projects.
For more information, visit:
