Skip to main content

Crate vibelang_keys

Crate vibelang_keys 

Source
Expand description

vibelang-keys - Terminal MIDI Keyboard for VibeLang

A terminal-based MIDI keyboard that lets you play music using your computer keyboard. Features include:

  • Piano-style visualization in the terminal
  • Multiple keyboard layouts (German QWERTZ, US QWERTY, or custom)
  • JACK MIDI output
  • OS-level key detection for reliable key release handling
  • Configurable via TOML file

§Usage as a Library

use vibelang_keys::{VirtualKeyboard, KeyboardConfig};

// Create a keyboard with default config
let mut keyboard = VirtualKeyboard::new(KeyboardConfig::default());

// Or load from config file
let config = vibelang_keys::Config::load_or_default();
let mut keyboard = VirtualKeyboard::new(config.to_keyboard_config());

// Handle key events (uses char, not KeyCode)
if let Some((note, velocity)) = keyboard.key_down('c') {
    println!("Play note {} with velocity {}", note, velocity);
}

Re-exports§

pub use config::Config;
pub use config::KeyboardLayout;
pub use config::Theme;
pub use error::Error;
pub use error::Result;
pub use keyboard::note_name;
pub use keyboard::KeyMapping;
pub use keyboard::KeyboardConfig;
pub use keyboard::VirtualKeyboard;
pub use keyboard::C3_MIDI;
pub use keyboard::DEFAULT_VELOCITY;
pub use midi::MidiBackend;
pub use midi::MidiOutput;
pub use os_keyboard::is_available as os_keyboard_available;
pub use os_keyboard::OsKeyEvent;
pub use os_keyboard::OsKeyboardListener;
pub use ui::render_keyboard;
pub use ui::render_keyboard_compact;
pub use ui::render_keyboard_standalone;
pub use ui::KeyboardWidget;

Modules§

config
Configuration file support for vibe-keys
error
Error types for term-keys
keyboard
Virtual MIDI keyboard
midi
MIDI output backends
os_keyboard
OS-level keyboard input using rdev
ui
TUI rendering for the virtual keyboard