Code Music: make songs from your code or your coding agent
Your agent already writes the app, cuts the video and builds the game. With HeartMuLa it also makes the music: one MCP line or one API call, and a finished song with vocals comes back, ready to download.
What is code music?
Code music is music made from code: a script or a coding agent asks for a song, and an audio file comes back. You describe the style, the mood and the voice in words, add lyrics or let the agent write them, and HeartMuLa sings them. No studio, no samples to license, no music theory needed.
One line in your coding agent
HeartMuLa runs a remote MCP server at https://heartmula.com/mcp. Create an API key on the API page, then
add the server to Claude Code:
claude mcp add --transport http heartmula https://heartmula.com/mcp --header "Authorization: Bearer mula_YOUR_API_KEY"
Codex, Cursor, VS Code and other MCP clients take the same URL and header. In Claude or ChatGPT, add a custom connector with the same URL and sign in. Then just ask, for example: "make a 30-second upbeat song for this video and save it as music.mp3".
The MCP server and the API come with the Starter and Creator plans and use the same credits as the website. A song costs 10 credits, the same as on the website. Failed tasks are refunded. To try the music first, the website makes 3 free songs a day.
Or call the API from any language
The same features over HTTPS at https://api.heartmula.com. Start a song, check the task until it
has finished, then download it:
import time, uuid, requests
API = "https://api.heartmula.com"
HEADERS = {"Authorization": "Bearer mula_YOUR_API_KEY"}
task = requests.post(f"{API}/v1/generate",
headers={**HEADERS, "Idempotency-Key": str(uuid.uuid4())},
json={"model": "heartmula-v1",
"style": "upbeat synth pop, bright, female vocal",
"lyrics": "[Verse]\nShipped it on a Friday night\n[Chorus]\nGreen checks, all green"}).json()["data"]
while task["status"] not in ("succeeded", "failed"):
time.sleep(5)
task = requests.get(f"{API}/v1/tasks/{task['id']}", headers=HEADERS).json()["data"]
song = requests.get(f"{API}/v1/tasks/{task['id']}/content", headers=HEADERS)
open("song.mp3", "wb").write(song.content)
Full reference, every endpoint and its parameters: https://api.heartmula.com/docs.
What your agent can do
generate_song: Make a song with vocals from a style and lyrics, or an instrumental. Uses credits; assistants are asked to confirm with you first.get_task: Check a task and get download links for the finished song (valid for 24 hours).upload_audio: For assistants that can run commands (such as Claude Code): a one-time link to upload one audio file of yours (MP3, WAV, FLAC or M4A), used by separate_stems, transcribe_song and analyze_song.separate_stems: Split an uploaded song into a vocals WAV and an instrumental WAV.transcribe_song: Turn an uploaded song into a lead sheet: key, tempo, chords and melodies, as JSON, an ABC score and MIDI.analyze_song: Analyze an uploaded song: structure, beats, key, tempo, chords and lyrics, as JSON.generate_voiceover: Read a script aloud with a female or male voice, with or without background music, for a video, an ad, a podcast intro or a story; two versions, MP3 and WAV. Or a named studio voice: voice only, emotion tags, SRT captions. Uses credits; assistants are asked to confirm with you first.get_voiceover: Check a voiceover and get download links for both versions (valid for 24 hours).get_account: Your credits, plan and the current price of each model.
Over the API it can also make covers of a song in a new style and change the melody, chords or lyrics of one passage of a song (see the developer docs).
Things to ask your agent
- Music for a video your agent made
Make a 30-second upbeat song for this product video, with a short sung hook that says the product name, and save it next to the video as music.mp3.
- A theme for your game
Write a heroic theme song for my game's title screen, about a fox who becomes a knight, and download it into assets/audio.
- A podcast or stream intro
Make a 15-second warm jazz intro for my podcast "Late Commit" that sings the show's name once.
- A song for someone
Write a happy birthday song for Mia, who loves cats and climbing, in an acoustic pop style, and send me the link.
- Stems and a lead sheet
Upload demo.wav, split it into vocals and instrumental, and give me its chords and melody as MIDI.
Music for the videos your agent makes
Coding agents now script, animate and render videos from a prompt. HeartMuLa adds the part they cannot draw: an original song, written for that video, with a hook that can say your product's name. Ask for the length you need, and your agent can place the MP3 under the video in the same project.
Questions
What is code music?
Code music means making music from code: a script or a coding agent asks for a song, and a finished audio file comes back. With HeartMuLa the request is one MCP tool call or one API call with a style and lyrics, and the result is a complete song with vocals that you can download as MP3.
Is code music the same as live coding?
No. Live coding writes a program that plays sounds as it runs, note by note. Code music with HeartMuLa asks an AI music model for a finished song, so you describe the music in words and get a full track, with vocals, in a minute or two.
Which coding agents can make music with HeartMuLa?
Any client that speaks the Model Context Protocol: Claude Code, Codex, Cursor, VS Code and others with an API key, and assistants such as Claude and ChatGPT through a custom connector. Any language that can send an HTTPS request can use the REST API.
Do I need to know music theory?
No. Describe the mood, genre and voice in plain words, and write or ask for lyrics. If you do know music, you can also edit one passage's melody, chords or lyrics, split a song into stems, or get its lead sheet as MIDI.
Can I use the songs in my app, video or game?
Songs made through the MCP server or the API follow the same rules as songs made on the website: the Starter and Creator plans include commercial use of songs made while the subscription is active. See the Terms of Service for details.
More: developer docs, Terms of Service, plans, contact@mulalabs.ai.