Guide
Generating Custom Lyrics-to-Song BGM for E-commerce Product Videos with mureka-9.5 on HiAPI
A developer guide to turning product copy into ad-ready music and mixing it into video
On this page
Why custom songs beat stock BGM for product videos
Stock music is a solved problem in the sense that it is cheap and instant, but it solves the wrong problem for e-commerce. A licensed track is generic by definition: it was written before your product existed, it carries no product name, no benefit, and no call to action. In a 15-second feed video where the viewer may only hear the first three seconds, generic music is filler, not persuasion.
A lyrics-to-song model such as mureka-9.5/lyrics-to-song changes the economics of the decision. You provide the words, the model returns a sung track that literally names the product and states the offer. That is the key difference from background music: the audio track itself becomes a copy channel that works even when the viewer never reads the caption.
Use stock BGM when:
- the video is a pure visual showcase and copy is on-screen;
- you need dozens of variants per day and brand voice is not a constraint;
- the product has no name, benefit, or offer worth singing.
Reach for a generated lyric track when:
- the product name or a short benefit is the hook;
- you are producing repeatable ad creatives per SKU and want a distinguishable sonic identity;
- you need a jingle-like asset you can iterate on by editing text rather than re-licensing music;
- you want creative control over tempo and mood through the prompt instead of a catalog search.
The trade-off is honest: generation adds a request and a rendering step, and sung vocals demand more quality control than an instrumental bed. The rest of this guide treats that trade-off as an engineering problem with a repeatable pipeline.
A practical framing for developers: treat the lyric track as another generated asset in your product media pipeline, next to thumbnails and short-form clips. It has inputs (product attributes), a render step (the API call), and an output that must pass checks before it ships.
Turning product copy into singable lyrics
The most common failure in lyric-to-song for ads is submitting marketing prose. A model that sings will sing whatever you give it, including a 40-word feature list, and the result will not fit a 15-second cut. The fix happens before the API call: compress product copy into short lines with a fixed structure.
The four-slot structure
Map every product to four slots:
- Identity — product name plus one category cue ("the ceramic mug that keeps heat").
- Benefit — one concrete outcome, not a list ("coffee still warm at noon").
- Proof or differentiator — a single sensory or material detail.
- Call to action — a short imperative tied to the storefront.
Each slot becomes one or two lyric lines. Keep lines short: roughly 5 to 9 syllables per line is a safe target for singability, and it keeps the sung phrase inside a couple of seconds of audio. Avoid numerals in prices, avoid legal disclaimers, and avoid parenthetical clauses, since all of these are awkward to sing and often get garbled.
Deriving lyrics programmatically
Store the slots as structured fields on the product record, then assemble with a template rather than free-form string concatenation:
[verse]
{identity_line}
{benefit_line}
[chorus]
{product_name}, {benefit_short}
{cta_line}
The template is the contract between your catalog data and the model. When a copywriter rewrites a line, only the field changes; the template stays stable, so output length and structure stay predictable across SKUs.
Length budgeting
Estimate duration from line count before you render. A 15-second spot comfortably holds a verse pair plus a short chorus; a 30-second spot allows a second repetition of the chorus. If the assembled lyric is longer than the budget, cut the proof slot first, not the call to action. Write the budget check as an assertion in your generator so a verbose product description cannot silently produce an unusable track.
Finally, keep the raw product copy and the derived lyric side by side. When a track comes back with a mispronounced word, you need to know whether the source field or the phrasing caused it.
Building the HiAPI request for mureka-9.5/lyrics-to-song
All model access goes through the HiAPI unified interface, so the request shape is the same one you use for other media models: authenticate with your HiAPI key, target the mureka-9.5/lyrics-to-song model identifier, and pass your lyric payload plus style guidance.
Request anatomy
A minimal request contains:
- model —
mureka-9.5/lyrics-to-song. - lyrics — the assembled, section-tagged text from the previous step. Preserve the
[verse]/[chorus]tags; they tell the model how to structure the song. - style prompt — genre, mood, tempo, and instrumentation, phrased as adjectives or short phrases (for example "bright indie pop, mid tempo, acoustic guitar, clean female vocal").
- instrumental flag — keep false when you want sung lyrics; set it true only for a pure bed.
{
"model": "mureka-9.5/lyrics-to-song",
"lyrics": "[verse]\nHand-thrown stoneware, morning light\n[chorus]\nKeep the heat till the afternoon\nShop the stoneware line today",
"style": "warm indie pop, mid tempo, clean vocal",
"instrumental": false
}
Handling the response
The call returns an audio asset reference rather than inline bytes in most workflows. Treat it as an asynchronous job: submit, poll or await the completion signal, then download the audio to your own storage bucket keyed by {sku}/{variant}/{hash-of-lyrics-and-style}. The hash matters because it makes the render idempotent; rerunning a batch does not create duplicate assets.
Wrap the call in a thin client with three responsibilities: retry on transient failures with backoff, validate that the returned duration is within your budget, and record the request payload alongside the asset for reproducibility. Do not let a failed render block video assembly; fall back to a cached track for that product line while you inspect the error.
Keep the style prompt in a configuration file per campaign rather than hard-coding it in the request builder. That way a seasonal refresh is a config change, not a code change, and every SKU in the campaign stays sonically consistent.
Mixing the generated track into your video pipeline
The generated track is a raw creative asset; the final cut needs a predictable duration and level. Most problems appear here, not at generation time.
Fit duration to the cut
Measure the returned audio duration and compare it to the video timeline. Two safe strategies:
- Trim with a musical boundary — cut at the end of a sung phrase and apply a fade of about 300–500 ms so the tail does not click.
- Loop with a beat-aligned point — if the track is shorter than the video, loop at a chorus boundary, not an arbitrary timestamp, to avoid an audible seam.
If the track is materially longer than the video, do not simply chop; re-render with a shorter lyric budget. Cutting mid-word is the most noticeable failure in sung ads.
Levels before muxing
Normalize the music to a consistent target loudness relative to the voice-over if one exists, and duck the music under speech with a sidechain or a simple volume automation curve. If the video has no narration, the track can sit higher, but leave headroom so platform loudness normalization does not squash it. Apply a short fade-in at the start of the video so the audio does not begin abruptly on autoplay.
Muxing
Use your existing encoding pipeline — ffmpeg or a managed transcoder — and treat audio as one more input stream:
ffmpeg -i product.mp4 -i track.wav \
-filter_complex "[1:a]afade=t=in:st=0:d=0.4,afade=t=out:st=14.6:d=0.4[a]" \
-map 0:v -map "[a]" -c:v copy -c:a aac -shortest out.mp4
The important discipline is that the video stream is copied, not re-encoded, so a music swap does not degrade the visual. Keep the mux step parameterized by fade points and loop markers so a 15-second and a 30-second variant come from the same code path.
Store the generated track separately from the muxed video. When you refresh the creative, you re-mux instead of re-rendering the song.
Quality checks before shipping to storefronts
Automate what you can and listen to the rest. A short pre-publish checklist catches nearly every failure mode.
Automated gates
- Duration — within the target window for the placement (for example, the ad slot maximum).
- Loudness — integrated loudness within the platform's expected range; fail the build if it is out of band.
- Silence and clipping — no unexpected silent spans and no peaks at full scale.
- Asset linkage — the track hash, lyric payload, and product record are all recorded against the output.
Human gates
- Lyric intelligibility — can a first-time listener pick out the product name on one pass? If not, simplify the line, do not slow the tempo.
- Pronunciation — brand names and unusual words are the usual casualties; check each one against a known list.
- Brand fit — genre and vocal tone match the category. A high-energy track on a premium or quiet product reads as a mistake.
- Timing — the call to action lands while the product is on screen, not after it fades.
Run these gates per variant, not per batch. A single bad pronunciation in a batch of a hundred is exactly the case that slips into a storefront. Keep a small listening harness that pulls the newest renders for a given product line and plays them back to back; it takes minutes and catches structural issues that metrics cannot.
When a check fails, fix the input — lyric line, style prompt, or length budget — and re-render with the same cache key inputs so the new asset supersedes the old one cleanly.
Scaling to a product catalog
A single hero video is a demo; a catalog is a system. The goal is consistency at volume without re-listening to every track.
Batch by product line, not by SKU
Group SKUs that share a category, benefit shape, and brand voice, then render one style prompt and one lyric template per group. Variants within a group differ only in the filled fields. This gives you sonic consistency across a category page while keeping per-product identity, and it dramatically reduces the number of distinct prompts you have to review.
Cache and deduplicate
Key every asset by a hash of the lyric payload plus the style prompt plus model version. Identical inputs return the cached asset; only changed fields trigger a new render. That keeps a catalog re-render cheap when you tweak one line for one product, and it gives you a stable URL per creative for the video pipeline to reference.
Queue and back off
Submit renders through a job queue with bounded concurrency and retries. Catalog refreshes are bursty; a queue smooths them and lets you prioritize products with upcoming campaigns. Log the request payload with each job so a failed render is reproducible without guesswork.
Keep creative governance lightweight
Version the templates and style prompts in the same repository as the product data. A change to the chorus template is then reviewable like code, and you can see exactly which products were rendered with which template revision. Retire old assets when a template changes rather than letting mixed revisions coexist on the storefront.
Start with one product line, prove the lyrics-to-mux path end to end, then expand category by category. The pipeline you build — structured lyric fields, an idempotent HiAPI request, a mux step, and a short checklist — stays the same as the catalog grows; only the volume changes. Explore the model on HiAPI when you are ready to wire the first request.
Related articles
View all articles →-
Guide
gpt-6.2-sol Getting Started Guide: Capability Boundaries, API Integration, and Token Pricing Essentials
Integration decisions and practical essentials for engineering teams
-
Guide
gpt-6.2-astra Getting Started Guide: Text Model Capability Boundaries, Integration Essentials, and Cost Control
-
Guide
Tripo H3.1 Getting Started Guide: Choosing Among Three Input Modes, Parameters, and Pricing
A practical guide for developers on 3D generation integration decisions and cost control