Skip to content

TheUtkarsh8939/Magic-Music-Board

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a9afce5 · · Apr 9, 2026

History

4 Commits
Apr 8, 2026
Apr 9, 2026
Apr 8, 2026
Apr 8, 2026
Apr 9, 2026
Apr 8, 2026
Apr 8, 2026
Apr 9, 2026
Apr 9, 2026
Apr 8, 2026

Repository files navigation

The Magic Music Board

A circuit that plays a note based on your hand's position. Set a reference point, move your hand up or down, and listen as the pitch changes with every centimeter of movement.

What It Does

The Magic Music Board lets you control pitch through physical movement. Once you power it on, the circuit locks in your starting position as (0,0). From there, moving your hand up or down changes the pitch – each centimeter of vertical movement equals one semitone. Move up 12cm and you've jumped an octave.

The built-in speaker plays whatever note your hand position corresponds to, giving you a hands-on way to explore pitch and create music through gesture.

How It Works

  1. Calibration – When powered up, the circuit records your current hand position as the reference point (0,0).

  2. Position Tracking – An inertial measurement unit (IMU) continuously measures where your hand is relative to that starting position.

  3. Height to Pitch – The magic formula is simple: 1cm vertical movement = 1 semitone. Your height above or below the reference point directly determines the pitch.

  4. Audio Output – The board's speaker converts these measurements into sound. Move your hand, and the pitch changes in real time.

  5. Play – Move your hand around freely and create melodies based on your movements.

Wiring and Circuit

Wiring Diagram

The Driver Program

The Magic Music Board can stream frequency data to any connected desktop or computer via the driver – a Go application that receives audio packets from the board over serial and plays them back with different instrument tones.

How It Works

  1. Serial Connection – The ESP32 sends framed binary packets containing packet ID and frequency data at 115200 baud.

  2. Real-Time Playback – The driver decodes incoming packets and synthesizes audio in real time using the selected instrument tone.

  3. Instrument Selection – Choose from Guitar, Piano, Flute, Violin, Vocals, or Raw Frequency to match your performance style.

Running the Driver

Build the driver from the driver/ folder:

cd driver
go buildd

Run with your serial port and desired instrument:

./driver -port COM5 -tone guitar -volume 0.3

Available Tones

Each instrument has a unique timbre based on harmonic profiles and vibrato characteristics:

  • Guitar – Warm, plucky tone with rapid decay (great for percussive gestures)
  • Piano – Resonant, sustained tone with bell-like quality
  • Flute – Pure, airy tone with gentle vibrato
  • Violin – Rich, expressive tone with natural vibrato
  • Vocals – Vocal-like tone with harmonic richness
  • Raw – Pure sine wave for testing and exploration

Command-Line Options

  • -port – Serial port name (e.g., COM3, /dev/ttyUSB0). Auto-detected if not specified.
  • -baud – Serial baud rate (default: 115200)
  • -tone – Instrument tone: guitar, piano, flute, violin, vocals, raw (default: raw)
  • -volume – Output volume from 0.0 to 1.0 (default: 0.25)
  • -list-tones – Print available instruments and exit

Serial Protocol

Packets are framed with sync bytes for robust resynchronization:

[A5][5A] [PacketID uint32 LE] [Frequency float32 LE]

This ensures reliable communication even if debug output appears in the serial stream.

Getting Started

Check the platformio.ini for your board configuration. Make sure your IMU is properly calibrated before you start playing around with it so the pitch tracking is accurate.

Use Cases

  • Build intuition for how pitch relates to physical height
  • Create experimental or improvisational soundscapes
  • Explore theremin-like instrument control using motion sensors
  • Just have fun with gesture-based music

Note: Sound quality and accuracy improve with proper IMU calibration and a stable reference position.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published