AUTOPLAY DEMO ACTIVE
Medium
120

Drawing Music Generator

Create melodies by sketching on the canvas and hear your composition play back instantly.

Overview

The Drawing Music Generator maps spatial paths on a digital canvas into standard musical values. By treating the workspace as a grid of pitch and time divisions, the canvas functions as a direct interface to design melodies visually. This approach bridges visual art and synthesis, allowing users to build polyphonic lines and dynamic sequences.

How to Use

Technical Details

The audio engine relies on Tone.js, scheduling precise polyphonic sound triggers mapped from an internal 1200 x 600 virtual coordinate system. When coordinates are generated or imported, they scale dynamically to fit the physical canvas boundary. This method prevents drawings from becoming offset or scaled incorrectly across responsive viewport sizes. An event timer evaluates paths asynchronously inside requestAnimationFrame callbacks to prevent heavy calculation loops, optimizing the overall page responsiveness.

Future Directions