Skip to content

A terminal-based interactive piano keyboard built in C

Notifications You must be signed in to change notification settings

errantpianist/in-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

In C - CLI Piano Tool

A terminal-based interactive piano keyboard built in C.

CLI Piano Screenshot

Features

  • 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

Terminal Color Differences

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.

Platform Compatibility

  • macOS: Works natively (uses ncurses for UI and afplay for audio)
  • Linux: UI works natively (ncurses), but audio playback uses afplay (macOS only). For Linux, replace afplay with aplay, paplay, or play (SoX) in src/audio.c.
  • Windows: Not supported natively. Use WSL, Cygwin, or MSYS2 for compatibility. For native Windows, port audio/UI to a Windows-compatible library.

Build Instructions

  1. Install dependencies:
    • macOS: ncurses (usually pre-installed)
    • Linux: ncurses (sudo apt install libncurses5-dev)
  2. Clone the repository and navigate to the project folder.
  3. Run make to build the project.

Usage

Run the program:

./in-c

Controls:

  • 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

Audio Playback

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).

Acknowledgments

Piano Samples Source

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:

About

A terminal-based interactive piano keyboard built in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published