Turning Text into Melody — How Many Notes Is Enough?

What determines whether a sequence of characters can be heard as music? A note on character-to-pitch mapping, the cognitive ceiling around 5–9 pitches, and why Japanese hiragana is unusually well-suited to sonification.

musicdesignlanguage

The Question

Could a sentence be a melody? Not “set to music” by a composer — literally. Feed the characters through a rule and listen to what comes out.

The naive expectation is that it would sound random. The actual answer is more interesting. When the input has the right number of distinct values, and the rule respects the structure the input already has, the result is genuinely musical. The digits of π sound like a pentatonic melody when each digit maps onto a five-note scale. A Japanese sentence is unusually musical because hiragana is already a two-dimensional grid that lines up with the two-dimensional structure of melody.

This note works out why that is, where it breaks down, and what determines how many “levels of distinction” a character system can carry before music gives way to noise.

The Basic Mapping Problem

Take any system of symbols — digits, letters, kana, DNA bases — and pick a rule that turns each symbol into a sound. The simplest such rule is “symbol → pitch.”

System Distinct symbols Comfortable musical mapping
Binary (0, 1) 2 Two tones, or on/off rhythm
DNA (A, T, C, G) 4 Four pitches in a small scale
Decimal (0–9) 10 Nine pitches plus a rest
Hexadecimal (0–f) 16 About 1.3 octaves of chromatic; hard to hear as melody
English letters (A–Z) 26 Requires structure (vowel/consonant split)
Hiragana ~71 Naturally splits into vowel × consonant row
Printable ASCII 95 Requires preprocessing
Everyday kanji ~2,000 Must be lowered to readings first

The raw count isn’t what makes the result musical or not. What matters is the relationship between the number of distinct values and the number of pitches the ear can hold as a coherent melody. Past a certain count, direct mapping starts to sound like a data dump.

The Sweet Spot: Five to Nine Pitches

There is a fairly hard ceiling on how many pitches the ear treats as a coherent melody rather than as a random walk through a chromatic space.

  • Pentatonic scales (five notes) appear independently across Chinese, Japanese, Celtic, African, and Native American traditions.
  • Diatonic scales (seven notes) underpin most Western music.
  • Chromatic scales (twelve notes) are used in classical and jazz but only under strong harmonic or rhythmic anchoring.

This range — roughly five to nine — sits comfortably inside the working-memory bound that the cognitive psychologist George Miller famously estimated at “seven plus or minus two.” Miller wrote about chunks in general, not music specifically, but the same ceiling shows up in musical perception: above it, the listener stops hearing relationships between notes and starts hearing each transition as a fresh event.

Below the range, very small note counts (two to four) start to feel like rhythm rather than melody. That is also fine — it just produces a different kind of music. DNA sonification typically lands here. The four nucleotides become four pitches and listeners hear a percussive sequence rather than a tune.

The interesting band is five to nine. Anything you can fit naturally into this range tends to sound like music.

Three Escape Hatches for “Too Many Values”

When your input has more distinct symbols than pitches, you have three escape hatches.

(a) Dimension reduction

Find existing structure in the input and split it into two orthogonal axes. The cleanest example is Japanese hiragana: every kana is structured as consonant row × vowel column. The vowel can map to pitch (five vowels → pentatonic) and the consonant can map to a second axis (octave, duration, or articulation). This isn’t a clever encoding. It just respects the structure that hiragana already has.

English does the same thing more loosely: vowels carry the pitch, consonants carry the rhythm.

(b) Modulo plus octave

If the system has no natural structure, fall back to pitch = value mod 7 plus octave = value div 7. This wraps values into a scale and uses octave for the high-order bits. The output is more uniform-sounding and tends to wander across octaves in ways that feel arbitrary, but it remains listenable for systems up to around thirty symbols.

(c) Time as second dimension

Instead of encoding everything in pitch, use time: long versus short, accented versus weak, present versus rest. With pitch held to five or seven values, the time axis can carry surprising amounts of additional information. Morse code is the extreme version: a single tone, two durations, and silence between groups, encoding all of English in a way the ear genuinely segments into letters and words.

In practice the best systems combine all three escape hatches.

Why Japanese Is Especially Friendly

Japanese hiragana is a near-perfect fit for sonification. The reason: the writing system is itself a two-dimensional structure that already corresponds to two musical axes.

Axis Hiragana structure Musical mapping
Vowel a / i / u / e / o (5 values) Pitch within a pentatonic scale
Consonant row ∅, k, s, t, n, h, m, y, r, w (≈10) Octave shift, duration, or both
Voicing dakuten (が, ざ, だ, ば), handakuten (ぱ) Octave shift
Modifiers っ (sokuon), ー (long), ん (syllabic n) Rest, sustain, low percussive
Punctuation 。 、 Long and short rests

The vowels go directly onto a pentatonic scale. (In Japanese music, 陽旋法, 平調子, 都節 and 琉球音階 are all five-note.) Voicing maps cleanly to a higher register. The small つ is exactly the kind of beat the speaker would skip when reading aloud — a rest. The long mark is a sustain. The two-dimensional grid of hiragana already encodes the two-dimensional structure of melody.

A consequence: any well-formed Japanese sentence read through this mapping produces a phrase that sounds like music in a recognizably Japanese mode. It isn’t random — the same vowel patterns that make Japanese speech rhythmic make Japanese text musical.

This isn’t unique to Japanese. Any phonetic writing system has some of this property. But hiragana is unusual in how explicit the two-dimensional grid is. Roman letters hide the vowel/consonant distinction inside an alphabetical order; hiragana puts it on the page.

English Strategy

English has roughly six vowels (a, e, i, o, u, and y functioning as one), but the language doesn’t separate vowels from consonants visually the way hiragana does. The escape is to do that separation at runtime: when reading the text, route vowels to pitch and consonants to a short percussive low tone.

Element Mapping
Vowels (a, e, i, o, u, y) Pitch — six notes of a pentatonic-extended scale
Consonants Low percussive tick, half duration
Spaces Short rest
Comma, semicolon, colon Medium rest
Period, exclamation, question Long rest
Newline Phrase break

Read this way, English text gains a percussive layer (the consonant ticks) over the vowel melody. Poetry with strong assonance — Shakespeare, hip-hop verse, Hopkins — produces surprisingly coherent phrases. Prose with neutral vowel distribution produces something closer to recitative.

The harder problem is stress. English meter (iambic, trochaic, anapestic) lives in spoken realization, not in the orthography. Without a pronunciation dictionary, the rhythm stays at the character level and feels slightly mechanical. A more advanced version would consult a dictionary like CMU’s to lengthen stressed syllables. This is the largest open area for the English case.

What Actually Makes It Sound Musical

Three things matter more than the specific mapping.

The scale is forgiving. Pentatonic, 陽旋法, and 平調子 contain no minor seconds, so any sequence of notes within them avoids the harshest dissonances. You can play almost any walk through these scales and it will sound at least pleasant. This is exactly why these scales were invented in folk traditions: they tolerate human imprecision. They also tolerate mechanical imprecision.

Rests carry phrasing. Without rests, the output is a wall of notes and the ear gets nowhere. With rests, the ear groups notes into phrases. This is the single biggest difference between “noise” and “music” in a generated phrase, and punctuation is conveniently already a phrasing system. Periods become full stops in the musical sense too. Commas become breath marks.

Scale change recolors the same text. The same sentence sounds bright in major pentatonic, melancholic in Hirajoshi, exotic in Ryukyu. The mapping is unchanged; the scale is the mood. This is what makes the system feel expressive rather than mechanical. The same paragraph read in three different scales tells you something about how scale and emotion are linked.

What Doesn’t Work (Yet)

A few honest limits, listed for the record.

Limit Why it’s hard
Kanji Not a phonetic system. Must be lowered to readings (hiragana) before the rule applies, which requires a dictionary or IME.
Harmonic resolution The output has no functional harmony — no “this note wants to go to that note.” Listeners trained on Western music hear it as floating. Adding chord context would change everything.
English stress Character-level rhythm misses iambic / trochaic patterns. A CMU-style pronunciation dictionary would fix it, at the cost of an extra lookup table.
Long passages Even within a friendly scale, a 200-note random walk fatigues the ear. Phrase-level repetition or motif structure would help — and isn’t present in unstructured text.
Cross-language uniformity A reader expects different musical traditions for different languages. Auto-detecting language and choosing a default scale per language is a small but important UX detail.
Tone languages Mandarin, Cantonese, Vietnamese already use pitch for meaning. A sonification rule that re-uses pitch for vowel identity discards information the original text carried.

Sonification of text is a small corner of an older field. A non-exhaustive list of nearby ideas:

  • DNA sonification. A/T/C/G → four notes, used both in research and outreach. Often the four bases are mapped to four pentatonic tones to keep the result listenable.
  • Whitney Music Box (Jim Bumgardner, 2006). Integer ratios played simultaneously, visualizing harmonic structure as a rotating set of dots and tones. Different goal from text sonification but the same lineage.
  • Morse code. Binary encoded as two durations plus silence between groups. Strictly rhythmic and unpitched, but listeners genuinely segment it into letters and words. The earliest mass-deployed “text as sound” system.
  • Numbers stations. Cold War shortwave broadcasts of grouped digits read aloud. Treated by The Conet Project and others as found music; an unintentional sonification of pure information.
  • John Cage, Roaratorio (1979). Text from Finnegans Wake converted to a sound score by rule, mixed with field recordings of every place named in the book.
  • Earcons in HCI. Short sonifications mapped to system states — file moved, error, message arrived. A tiny domain-specific version of the same mapping problem, with the same constraints: must be brief, must be distinguishable, must be musical enough not to grate.

The pattern across all of these is consistent: the most successful sonifications are ones where the input has structure and the output respects it. Where the mapping is arbitrary, the output sounds arbitrary. Where the mapping picks up a structure that was already there, the output sounds like music.

A Practical Recipe

If you want to try this on your own input system, the steps are roughly these.

  1. Count distinct values. If the count is nine or fewer, you can map directly to pitches and skip almost everything below.
  2. Look for structure. Vowel/consonant, family/case, group/member, prefix/stem — anything that gives you two axes instead of one. If you find it, use one axis for pitch and the other for octave or duration.
  3. Pick a forgiving scale. Pentatonic or a Japanese five-note scale. Save chromatic and whole-tone for cases where you specifically want a data-sonification feel rather than a musical one.
  4. Add rests at natural boundaries. Punctuation, line breaks, word boundaries. This single step does most of the work of making the output sound like music rather than noise.
  5. Use octave and duration as extra axes. They carry more information than people expect, and they don’t burden the ear the way extra pitches would.
  6. Try multiple scales over the same input. The scale is where mood lives. Same data, different scales, different feelings. This is also the cheapest way to find out whether your mapping is doing real work or just adding randomness.

Closing

Text already has structure: vowels and consonants, words and phrases, sentences and paragraphs. Pi has structure too — a deterministic sequence with surprising long-range patterns. A musical mapping isn’t adding melody to the text. It is reading the structure the text already has, back to us, in a register our ears can hear.

The trick isn’t that the text is musical. The trick is that musicality and language share the same scaffold — a small set of distinguishable units, sequenced in time, grouped by phrases, varying in length and emphasis. Once you notice that, you can read either one through the other.

← Back to Notes