Songs written in symbols: what a language model brings to music

Every so often someone shares draft songs written by a chat model: rock riffs, blues progressions, lyrics with verse and chorus, sometimes generated by two instances of the model working on different machines. Listeners are surprised that a system which has never heard a sound can produce something that plays back as music at all. Others are unimpressed and point out that the results sound generic.
Both reactions are reasonable. This article is for developers, hobbyist musicians and curious readers who want to understand what a text-only model is really doing when it composes, which musical tasks it handles well, where it reliably fails, and how to turn its output into something you can hear with a few lines of code. No audio model is involved; everything here works through a plain chat API.
Frequently asked questions
How can a model that only reads text write music?
Music can be written as text: note names, chord symbols, tablature, ABC notation, MIDI event lists or code for music libraries. Models have read a lot of this during training and learned its patterns, so they can produce new sequences in those formats.
What is ABC notation?
A compact plain-text format for melodies, widely used for folk tunes. A header sets title, metre, default note length and key; the body lists notes like C D E F | G2 G2. Free tools convert ABC to sheet music and MIDI.
How does a text model differ from an audio music generator?
Audio generators produce sound directly and can capture timbre, production and voice. A text model produces a symbolic score that another program must render. It controls notes and structure, not sound quality.
Is music from a language model any good?
It is usually competent and conventional: correct metre, familiar progressions, singable lines. It rarely surprises. It is better as a sketch generator or practice tool than as a finished composer.
Which is better for lyrics, a large commercial model or a small open one?
Large commercial models such as Claude generally write more coherent, less clichéd lyrics and follow complex constraints better. A smaller open model is fine for drafts, rhyme lists and variations, especially when you iterate.
Can a model hear whether its melody sounds right?
No. It predicts symbols that resemble good music in text form. It cannot check by ear, so errors such as a clashing note or awkward rhythm slip through. Rendering and listening is your job.
Who owns music written with a model?
That depends on your jurisdiction and on the terms of the service you used, and the law is still developing. Treat it as an open question, avoid prompting for imitations of specific copyrighted songs, and seek advice for commercial releases.
Can I use free-ai for songwriting?
Yes, for text formats: lyrics, chord charts and ABC melodies. It is a text-only model, so it cannot produce audio. Answers can be up to 16,000 tokens, enough for full lead sheets.
Music as a language the model already knows
The internet contains huge amounts of music written as text: guitar tabs, chord sheets on lyric sites, folk tune collections in ABC, tutorials with MIDI note numbers, code using music libraries. A language model trained on broad web text has absorbed the regularities of these formats, the same way it absorbed grammar.
So when you ask for a twelve-bar blues in A, the model is not imagining sound. It is producing the sequence of symbols that most resembles twelve-bar blues charts it has seen. Because those charts follow strong conventions, the result is usually structurally correct.
Why structure comes easily
Bars, repeats, verse and chorus labels, and common progressions are highly regular. Regular patterns are exactly what language models learn best, so form is usually the strongest part of model-written music.
Why originality is hard
The most likely continuation is, by definition, the most typical. Typical melodies and progressions are what you get unless you push the model with constraints, unusual references or higher sampling temperature.
Formats to ask for, and what each is good at
Choosing the output format is the single biggest decision. It determines what you can do with the result and how often the model gets it right.
Prefer formats you can validate
ABC and JSON can be parsed and checked automatically: are all bars the right length, are notes in range. Free-form tabs are hard to validate. When you plan to render output, choose a parseable format.
Ask for one format at a time
Mixing chords, tabs and ABC in one reply invites errors in all of them. Request a single format, validate it, and convert to other formats in code if you need them. A clean ABC melody can be transposed or turned into MIDI programmatically, which is more reliable than asking the model for every version separately.
- Chord charts with lyrics: easiest for the model, ideal for songwriting and jamming.
- ABC notation: compact melodies with metre and key, renders to sheet music and MIDI.
- Guitar tablature: readable for players, but models often misalign columns.
- MIDI event lists or JSON: precise pitch and timing, easy to convert in code.
- Code for a music library: lets you add rules, transposition and checks programmatically.

From prompt to playable melody
The quickest route to hearing a model's melody is ABC notation. Ask for a short tune with explicit header fields, extract the ABC block, and open it in any ABC tool or convert it with a library such as music21. The script below requests a tune from the free endpoint and saves it as a file.
It uses free-ai through the openai SDK. Setting temperature a bit above the default encourages less predictable melodies; lower it if the output stops being valid ABC.
Check bar lengths before listening
In 6/8 with a default length of 1/8, every full bar should add up to six units. A short script that sums durations per bar catches the most common model errors. Feed the failures back to the model and ask it to fix only those bars.
Lead sheets as a middle ground
A lead sheet combines a melody line, chord symbols and lyrics. It is compact, readable by most musicians and easy for a model to produce consistently. For songwriting projects it is often the most useful single output: enough to play and sing from, without the complexity of a full arrangement that the model would likely get wrong.
import re
from openai import OpenAI
client = OpenAI(base_url="https://api.apikeyanthropicfree.com/v1", api_key="free")
prompt = (
"Write an original 16-bar folk melody in ABC notation. "
"Include headers X:, T:, M:6/8, L:1/8, K:D. "
"Return only the ABC inside a code block."
)
r = client.chat.completions.create(
model="free-ai",
messages=[{"role": "user", "content": prompt}],
temperature=0.9,
)
text = r.choices[0].message.content
m = re.search(r"```(?:abc)?\s*(.*?)```", text, re.S)
abc = (m.group(1) if m else text).strip()
with open("tune.abc", "w", encoding="utf-8") as f:
f.write(abc + "\n")
print(abc)
# Optional: pip install music21, then
# from music21 import converter
# converter.parse("tune.abc").write("midi", fp="tune.mid")
Where text-based composition breaks down
The model's blindness to sound shows up in predictable ways. Knowing them helps you design prompts and checks rather than being disappointed.
Rhythm arithmetic
Counting beats inside a bar is a counting task, and language models are weak at exact counting. Bars with one beat too many or too few are common, especially in longer pieces. Automated checks fix this cheaply.
Voice leading and clashes
Harmony across several voices requires tracking many constraints at once. Models often produce parallel motion or clashing notes that a trained musician would avoid. Ask for a single melody plus chord symbols rather than full four-part harmony.
Long-range development
Good music develops motifs across minutes. Models drift: a theme introduced in bar one is forgotten by bar thirty. Work in sections and remind the model of the motif explicitly in each request.
Lyrics that scan on paper only
Syllable stress is about sound. Models count syllables imperfectly and may place stressed syllables on weak beats. Sing or speak the line over the rhythm before keeping it.

Using a model as a songwriting partner
The most productive way to work is iterative and human-led. You set the mood, form and constraints; the model proposes; you choose and edit; the model varies what you kept. This keeps the creative direction with you and plays to what the model does well: generating many options fast.
Useful requests include rhyme families for a key word, five alternative chorus lines in the same metre, a bridge that modulates to the relative minor, or a reharmonisation of a progression you already like. Each is small, checkable and easy to judge by ear.
Two models, two roles
Running two instances with different instructions, for example one writes and one critiques, can lift quality. The critic should get concrete criteria such as singability, cliché count and rhyme scheme, not a vague request to improve the song.
Keep a constraint sheet
Write down the key, tempo, metre, form, rhyme scheme and mood for the song in a short block and paste it into every request. Because the API keeps no memory, this sheet is what holds a project together across sessions. It also makes it easy to compare outputs from different models on exactly the same brief.
- Give the model the existing verse when asking for the chorus, so the tone matches.
- Specify syllable counts per line to keep lyrics singable.
- Ask for several short options instead of one long finished song.
- Keep your own notebook of what you accepted; the API is stateless and remembers nothing.
Rights, originality and honest labelling
Because models reproduce common patterns, they can occasionally produce melodies close to existing tunes, especially for short, simple phrases. Avoid prompts like write a song like a specific hit, and be cautious before releasing anything commercially. Rules on authorship of machine-assisted works differ between countries and are evolving.
If you publish model-assisted music, say so. Listeners and platforms increasingly expect disclosure, and it is the honest thing to do. Our article on generating self-contained HTML pages shows one way to present drafts, lyrics and sheet music together for collaborators.
Fewer refusals, same responsibilities
The free-ai model is tuned to refuse less than commercial assistants, which helps with dark or mature lyrical themes as a matter of craft. It does not change copyright law or platform rules, and it keeps its two hard limits on content.

Where commercial models and audio tools win
For polished lyrics, complex harmony instructions and long, coherent compositions, large commercial models such as Claude are clearly better than a 35B open-weight model. For actual sound, dedicated audio and music generation tools are a different category altogether. A text model is a sketchpad and a theory assistant, not a studio.
This site is not affiliated with Anthropic, and the free endpoint at https://api.apikeyanthropicfree.com/v1 serves only free-ai, an independent model. It is a convenient place to experiment with music-as-text pipelines at no cost. If you plan to generate many variations in batches, read how output length affects token use first.
A sensible stack
Use a language model for structure, chords and lyrics, a notation library for validation and rendering, a synthesiser or digital audio workstation for sound, and your own ears for every decision that matters.
Send a test prompt from the chat box on the home page: no key, no account and no card, only the published per-IP limits.