From Text to Tune: Building an Interactive Morse Code Synthesizer and MIDI Generator
At Kennebec, we love exploring the intersection of history, technology, and creative expression. Our latest internal project does exactly that: an interactive Morse Code Converter & MIDI Generator that transforms plain text into customizable musical arpeggios, synthesized audio, and downloadable MIDI files.
This article details how we designed the application, the tech stack powering the audio, and the creative applications of translating language into melody.

The Concept: Morse Code as Music
Morse code is inherently musical. Invented in the 1830s for telegraphy, it uses a simple binary rhythm of short signals (dots) and long signals (dashes) to represent letters and numbers.
While traditional Morse code generators produce a monotone beep, we wondered: What if we could map these binary rhythms to musical scales and chords?
By treating dots and dashes as note durations and mapping letters to dynamic musical patterns, we created a tool that turns any word, phrase, or secret message into a unique, harmonically coherent melody.
Core Features of the App
Designed with usability and visual clarity in mind, the converter includes several features that bridge utility and creative play:
- Bidirectional Converter: Users can instantly translate English text into standard Morse code, or paste Morse code to decrypt it back into plain text.
- Interactive Music Engine: Instead of static tones, users can choose from 12 musical keys and various scales/modes (including Major, Minor, Dorian, Phrygian, and Pentatonics) to shape their audio output.
- Built-in Arpeggiator: Users can map Morse symbols to dynamic arpeggio patterns (Up, Down, Up/Down, or Random) that traverse up to three octaves.
- Fine-Grained Rhythm Controls: To customize the feel of the track, the app provides dropdown selectors for dot/dash note lengths and custom pause times between symbols, characters, and words.
- Real-time Web Playback & MIDI Export: Users can preview their musical compositions directly in the browser or download a standard
.midfile to import into their favorite Digital Audio Workstation (DAW) like Ableton Live, Logic Pro, or FL Studio.

Technical Architecture
Building a low-latency, fully client-side audio tool required combining several powerful modern web technologies:
1. Structure & Styling (Tailwind CSS)
We used Tailwind CSS to build a modern, responsive layout that looks great on both desktop and mobile devices. A clean two-column workspace divides the encryption/synthesis side from the decryption panel, with dropdown sections providing clear documentation and timing guides.
2. Audio Synthesis (Tone.js)
For browser-based synthesis and precise timing, we leveraged Tone.js. Standard JavaScript intervals are notorious for drifting, which ruins musical timing. Tone.js solves this by scheduling synthesizer triggers directly on the Web Audio API audio-context timeline, ensuring the dot, dash, and rest intervals remain perfectly quantized.
3. Music Theory Engine (Tonal.js)
To map simple string characters to beautiful melodies, we integrated Tonal.js. When a user selects a key (e.g., C) and a scale (e.g., Major Pentatonic), Tonal.js computes the exact pitch frequencies. If the arpeggiator is active, the app dynamically cycles through this pitch pool for each dot and dash in the Morse sequence.
4. Client-Side MIDI Writing (MidiWriterJS)
To make the tool useful for music producers, we integrated MidiWriterJS. This library allows us to generate a standard MIDI file on the fly directly in the user’s browser, converting the scheduled notes and rest ticks into a downloadable data URI without needing a backend server.
Creative Use Cases
While it’s a great educational tool for learning Morse code, we’ve found several creative ways to use the generator:
- Music Production: Generate unpredictable, text-driven leads, basslines, and arpeggios. You can type a signature phrase or name and instantly have a custom MIDI sequence ready for your DAW.
- Game Design & Alternate Reality Games (ARGs): Embed secret audio clues or melodic puzzles into video games or online campaigns where players must decode a melody to find the answer.
- Sound Design: Create rhythmic retro computer beeps, futuristic telemetry noises, or sci-fi ambient patterns.
Customizing the Output
The app allows for deep rhythmic experimentation. For example, by matching a 16th Note dot duration with a Quarter Note dash duration and setting a 16th Rest symbol pause, users can create fast, syncopated melodies. Setting the base octave to 5 or 6 gives a bright, chip-tune quality, while a base octave of 2 or 3 yields a warm, analog bass vibe.
Looking to Build Something Unique?
The Morse Code MIDI Generator is a prime example of what is possible with modern client-side web development. By combining clean design with advanced browser APIs, we can create lightweight, interactive tools that run entirely in the browser without complex server infrastructures.
Interested in building a custom web application, interactive portfolio piece, or client-side tool? Get in touch with the team at Kennebec.