Skip to content

gfargo/tPiano

Repository files navigation

tPiano 🎹

A terminal-based piano application that lets you play music right in your command line! Built with TypeScript, React, and Ink.

Features

  • 🎡 Play piano notes using your computer keyboard
  • 🎨 Visual piano interface with real-time feedback
  • 🎼 Multiple octave support with easy switching
  • 🎹 Pre-generated high-quality piano tones
  • πŸ’» Cross-platform compatibility

Installation

# Clone the repository
git clone https://github.com/yourusername/tPiano.git
cd tPiano

# Install dependencies
npm install

# Generate piano sounds
npm run generate-notes

# Build the application
npm run build

# Start playing!
npm start

Usage

Once running, you can play the piano using your keyboard:

  • White Keys: A S D F G H J K
  • Black Keys: W E T Y U
  • Octave Control: ↑/↓ arrows
  • Display Size: ←/β†’ arrows

The interface shows:

  • Current octave and display settings
  • Visual feedback for pressed keys
  • Octave boundaries with color coding

Development

# Start in development mode
npm run dev

# Run tests
npm test

# Lint code
npm run lint

Project Structure

tPiano/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app.tsx         # Main application component
β”‚   β”œβ”€β”€ cli.tsx         # Entry point
β”‚   β”œβ”€β”€ scripts/        # Utility scripts
β”‚   └── test.tsx        # Test suite
β”œβ”€β”€ assets/
β”‚   └── piano-sounds/   # Generated WAV files
└── docs/              # Documentation

Technical Details

tPiano uses several key technologies:

  • Ink: For terminal UI rendering
  • React: For component-based architecture
  • TypeScript: For type safety
  • tonegenerator: For waveform generation
  • play-sound: For audio playback

Current Limitations

  • Terminal limitations prevent true key-up event detection
  • Basic sine wave synthesis for sounds
  • No simultaneous note (or chord) playback

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation as needed
  • Consider cross-platform compatibility

License

This project is licensed under the MIT License

Acknowledgments

  • Ink for the amazing terminal UI framework
  • tonegenerator for sound generation capabilities
  • All contributors who have helped shape this project

Made with β™₯️ by the tPiano team

About

Simple virtual piano created for the Terminal via Ink 🎹

Topics

Resources

License

Stars

Watchers

Forks

Contributors