// Daisy Bell
"Daisy Bell" is the first song a computer ever sang — an IBM 704 at Bell Labs in 1961, played back to Arthur C. Clarke on a studio visit, which is why HAL 9000 sings it as it's being shut down in 2001: A Space Odyssey. SAM felt like the right engine to try it on.
SAM only speaks text, it has no idea what a musical note is. So this reads the melody out of an actual MIDI file, syllable by syllable: each note's pitch sets SAM's pitch parameter, each note's duration sets its speed, one note per lyric syllable, for one pass through the verse.
Very much a work in progress, and it likely sounds pretty funny right now. I'll keep tweaking it till I get it right. Poor SAM isn't a great singer.
How this works / limitations
daisy_bell.mid has three tracks: a piano accompaniment, a monophonic
"8-Bit Square" lead line, and an "8-Bit Sine" line that only enters in the back half
as a harmony. SAM is one voice, so only the lead line gets sung — the other two are
just how the file happens to be arranged, not something this tool plays.
The lead line repeats the tune roughly three times over the full MIDI file, but only the first pass is used here — one note per lyric syllable, 51 of each, no looping to keep track of.
SAM's pitch parameter isn't calibrated to real semitones anywhere
documented, so each note's MIDI pitch is linearly mapped across that parameter's
range by ear rather than by any precise formula — SAM was never built to sing exact
pitches to begin with. Duration works the same way, through speed: longer
notes get a slower value, shorter notes a faster one. Each syllable is synthesized
separately with its own pitch/speed and scheduled back-to-back on the Web Audio
timeline, the same technique the SAM tool's
Word Gap feature uses.
To do
- Only the lead melody track plays. The "8-Bit Sine" harmony that enters in the back half is read from the file but never used.
- No way to hear it slower/deteriorating the way HAL's voice does — could be a nice mode given the reference.
- Imported JSON isn't validated beyond checking it parses and has the right length — a malformed file with out-of-range values will just get passed straight to SAM.
Changelog
2026-07-21
- Initial release: MIDI file parsed in the browser, lead melody line extracted, mapped to SAM pitch/speed per note, and sung syllable by syllable against the classic first verse of the lyrics.
- Fixed the lyrics coming out badly mispronounced ("Daisy" as "Day-sigh"). What's shown on screen and what's actually spoken are now two separate spellings of the same syllables — normal spelling for the display, phonetically respelled for SAM. Only confirmed by ear against the one example reported; the rest of the respelling is a best-effort guess at SAM's letter-to-sound rules, not verified.
- Added a longer pause after a full stop ("do.", "you.", "two." — the three line endings in the verse), instead of the same tiny gap between every note regardless of phrasing.
- Fixed "do" still sounding like "do" instead of "doo" — the trailing period was clipping the vowel short, so it's dropped from the spoken text now (the display and the pause-detection logic both still keep it). Also fixed "bicycle" sounding wrong: "bi"/"cy"/"cle" is now spoken as "by"/"sick"/"ill".
- Added an audio player above the intro so you can hear the actual song before SAM's attempt at it.
- Switched the sung syllables from respelled plain English (guessing at SAM's reciter rules) to SAM's own phonetic alphabet, fed straight in via
buf32(text, true)— bypasses the reciter's guesswork entirely, plus adds SAM's native stress markers (digits after a vowel) on each word's accented syllable for a bit of natural pitch and emphasis. Transcribed by hand against SAM's manual, not verified by ear. - Added a "Show phonetic" toggle so you can see the exact phonetic spelling fed to SAM alongside the normal lyrics — both follow the singing with the same highlight.
- Added a Speak button alongside Sing — same syllables, same timing, but every note uses SAM's default flat pitch instead of the melody, so you can hear the words on their own without the singing.
- Cut the melody down to one pass through the verse instead of playing all three repetitions in the MIDI file — keeps the note count and the 51-syllable lyric count 1:1, with no looping to track.
- Added an edit view: every note's pitch and speed, shown in a table you can type new values into directly, with the auto-mapped values pre-filled as a starting point. Sing and Speak pick up edits immediately. Export saves the current values to a JSON file; Import loads one back in; Reset restores the computed mapping.
- Added a Random button to the edit view — sets every note's pitch and speed to a random value within SAM's documented practical range, for fun.
- The Lyric column in the edit view is now editable — change a word and the Phonetic column re-spells it automatically via SAM's own reciter, the same guesser this tool used to rely on for the whole song before the phonetic rewrite. Phonetic stays directly editable too, for correcting the reciter's guess by hand.
- Reset now restores the lyric and phonetic spelling as well as pitch and speed, not just the latter two. Also dropped the leading row-number column from the edit table — it wasn't doing anything the row order didn't already show.
- Added a small play button to every row in the edit view, so you can hear a single note on its own with its current pitch/speed/phonetic, without running the whole song.
I'd love to tell you more.