惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
量子位
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
T
Threat Research - Cisco Blogs
Latest news
Latest news
Spread Privacy
Spread Privacy
C
Cyber Attacks, Cyber Crime and Cyber Security
NISL@THU
NISL@THU
T
Tor Project blog
Hacker News: Ask HN
Hacker News: Ask HN
V2EX - 技术
V2EX - 技术
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
博客园 - 叶小钗
博客园 - 聂微东
Last Week in AI
Last Week in AI
爱范儿
爱范儿
腾讯CDC
博客园 - Franky
美团技术团队
J
Java Code Geeks
O
OpenAI News
L
Lohrmann on Cybersecurity
Simon Willison's Weblog
Simon Willison's Weblog
有赞技术团队
有赞技术团队
T
Threatpost
G
GRAHAM CLULEY
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
I
Intezer
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
S
Security @ Cisco Blogs
Forbes - Security
Forbes - Security
N
News | PayPal Newsroom
Stack Overflow Blog
Stack Overflow Blog
Scott Helme
Scott Helme
H
Hacker News: Front Page
Cloudbric
Cloudbric

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work Top 15 Reinforcement Learning Questions That Will Appear in Exams The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation
2026-04-16 · via DEV Community

"Disclosure: I'm building MusicWave, one of the tools mentioned below. This post is based on my actual workflow — I've named alternatives throughout, and the code here works with any of them."

The Problem Every Indie Developer Hits

Picture this: you've shipped the MVP, the UI is clean, the feature works. You drop it into a demo video or add ambient audio to your landing page and... crickets. Silence kills vibe. So you do what every dev does:

  • Open YouTube Audio Library → everything sounds like a 2014 vlog
  • Try Epidemic Sound or Artlist → $15-25/month just to try it
  • Find "royalty-free" music on Google → land on a 10-page licensing agreement you don't have time to parse
  • Give up and ship without music

I've been through this cycle on three side projects. For my latest one — a browser-based rhythm game built with Phaser — I needed 12 distinct tracks for different levels. Licensing that legitimately would have cost me $200+/month on Artlist or similar. So I tried a different route: generate everything with AI.

By the end of the weekend, I had 50+ royalty-free tracks, each tailored to a specific scene, level, or mood. This post is about what I learned, the code I wrote to automate it, and the gotchas.

Why AI Music Generation is Actually Useful for Developers Now
There's been a Cambrian explosion of AI music tools in the last 18 months:

  • Suno — best-in-class vocals, consumer-friendly
  • Udio — excellent genre variety
  • Stable Audio — Stability AI's offering, strong for instrumental
  • Meta's MusicGen — open-source, great for tinkering
  • Riffusion — novel spectrogram-based approach
  • Mubert — API-first for developers
  • MusicWave — the one I ended up using most (more on why below)

The outputs aren't SoundCloud-hit quality yet, but for:

  • Game/app background music
  • YouTube video soundtracks
  • Podcast intros
  • Demo reels
  • Landing page ambient audio

...they're more than good enough. And the killer feature for developers: most let you own commercial rights to what you generate on paid plans, so you don't need to relicense anything.

My Workflow
Here's what my weekend looked like, broken down into reproducible steps.

Step 1: Define the Scenes

I built a simple JSON spec for every track I needed. This turned into the single source of truth that drove the whole pipeline. (If you've read Kent C. Dodds on schema-driven development, this will feel familiar.)

{
  "tracks": [
    {
      "id": "menu_ambient",
      "prompt": "Soft ambient electronic menu music, minimalistic synths, calm and inviting, loopable",
      "duration": 60,
      "instrumental": true,
      "genre": "ambient"
    },
    {
      "id": "level_1_tutorial",
      "prompt": "Upbeat chiptune with 8-bit synths, cheerful and encouraging, 120 BPM",
      "duration": 90,
      "instrumental": true,
      "genre": "chiptune"
    },
    {
      "id": "boss_fight",
      "prompt": "Intense orchestral hybrid with driving drums, epic strings, and synth bass, 140 BPM, dramatic",
      "duration": 120,
      "instrumental": true,
      "genre": "epic"
    }
  ]
}

Enter fullscreen mode Exit fullscreen mode

Lesson learned: specificity in prompts matters more than cleverness.

"Upbeat music" generates garbage. "Upbeat chiptune with 8-bit synths, cheerful and encouraging, 120 BPM" generates what you actually want.

This mirrors what OpenAI documented about prompt engineering — specificity always wins.

Step 2: Write a Prompt-Engineering Helper

I noticed most tools generate better results when the prompt includes:

  1. Genre (specific, not generic)
  2. Instrumentation (what instruments to feature)
  3. Mood/Energy
  4. Tempo in BPM (if you don't know what BPM fits your genre, this reference is useful)
  5. Structural hints (intro, loop, drop, outro)

Here's a small TypeScript helper I wrote that enforces this structure:

interface TrackSpec {
  genre: string;
  instruments: string[];
  mood: string;
  bpm: number;
  structure?: 'loopable' | 'intro-buildup' | 'drop-focused' | 'cinematic';
}

function buildPrompt(spec: TrackSpec): string {
  const parts = [
    spec.genre,
    `featuring ${spec.instruments.join(', ')}`,
    `${spec.mood} energy`,
    `${spec.bpm} BPM`,
  ];

  if (spec.structure === 'loopable') {
    parts.push('seamless loop, no fade-in or fade-out');
  } else if (spec.structure === 'intro-buildup') {
    parts.push('starts sparse, builds intensity toward the end');
  } else if (spec.structure === 'drop-focused') {
    parts.push('builds tension then releases into a powerful drop at 30 seconds');
  } else if (spec.structure === 'cinematic') {
    parts.push('three-act structure with emotional climax');
  }

  return parts.join(', ');
}

// Usage
const bossTrack = buildPrompt({
  genre: 'epic orchestral hybrid',
  instruments: ['taiko drums', 'strings', 'synth bass', 'brass'],
  mood: 'intense',
  bpm: 140,
  structure: 'intro-buildup',
});

console.log(bossTrack);
// "epic orchestral hybrid, featuring taiko drums, strings, synth bass, brass, 
//  intense energy, 140 BPM, starts sparse, builds intensity toward the end"

Enter fullscreen mode Exit fullscreen mode

This one abstraction saved me ~30% of my time because I stopped retrying generations with ambiguous prompts.

Step 3: Generate in Batches

I ended up going with MusicWave because it gave me two generations per request (good for picking the better take) and supported instrumental mode natively.

Suno would have worked too — honestly, if you need vocal-heavy tracks, Suno is still my first recommendation. For instrumental game music with specific BPM targets, MusicWave nailed it more consistently for me.

The API was straightforward — a POST with the prompt, poll for status, download when ready. This follows a standard async job pattern common in media generation APIs.

Rough pseudocode for what the loop looked like:

async function generateTracks(specs: TrackSpec[]) {
  const results = [];

  for (const spec of specs) {
    const prompt = buildPrompt(spec);
    console.log(`[${spec.id}] Generating: ${prompt}`);

    const job = await startGeneration({
      prompt,
      instrumental: true,
      duration: spec.duration,
    });

    const result = await pollUntilComplete(job.id, {
      timeoutMs: 180_000,
      intervalMs: 3000,
    });

    results.push({ id: spec.id, audioUrl: result.audioUrl });
    console.log(`[${spec.id}] Done → ${result.audioUrl}`);
  }

  return results;
}

Enter fullscreen mode Exit fullscreen mode

Gotcha: generations take 1-3 minutes each, and most APIs rate-limit you to 1-2 concurrent jobs on free/starter plans.

Run overnight if you're generating 50+ tracks. Or batch-submit with retries — p-queue is my go-to library for this kind of concurrency control.

Step 4: Post-Processing for Loop Points

AI-generated music doesn't always loop cleanly. I wrote a quick FFmpeg wrapper to find zero-crossings and trim to a clean loop point. If you're new to FFmpeg, this guide is the canonical reference:

#!/bin/bash
# loop-trim.sh: Finds a clean loop point and trims the track

INPUT=$1
OUTPUT=${INPUT%.mp3}_looped.mp3

# Detect silences (often where a natural loop point exists)
SILENCE=$(ffmpeg -i "$INPUT" -af "silencedetect=noise=-30dB:d=0.5" -f null - 2>&1 \
  | grep "silence_end" | head -1 | awk '{print $5}')

if [ -z "$SILENCE" ]; then
  # No silence found — use FFmpeg's loop-friendly fade
  ffmpeg -i "$INPUT" -af "afade=t=out:st=55:d=2" -y "$OUTPUT"
else
  ffmpeg -i "$INPUT" -t "$SILENCE" -y "$OUTPUT"
fi

echo "Looped version saved to $OUTPUT"

Enter fullscreen mode Exit fullscreen mode

For game music, I also separated stems (vocals/drums/bass/other) so I could dynamically mix layers based on game state — e.g., drums only during exploration, full mix during combat.

Most AI music platforms have stem-splitter endpoints, and there are great open-source options too like Spleeter by Deezer and Demucs by Meta if you want to run it locally.

Step 5: Integrate with Web Audio API

Here's the minimal code I ended up with for crossfading between tracks based on game state. If you haven't used it before, MDN's Web Audio API guide is an excellent starting point:

class SoundtrackManager {
  private ctx = new AudioContext();
  private tracks = new Map<string, AudioBuffer>();
  private currentSource: AudioBufferSourceNode | null = null;
  private currentGain: GainNode | null = null;

  async load(id: string, url: string) {
    const res = await fetch(url);
    const arrayBuffer = await res.arrayBuffer();
    const audioBuffer = await this.ctx.decodeAudioData(arrayBuffer);
    this.tracks.set(id, audioBuffer);
  }

  async crossfadeTo(id: string, durationMs = 2000) {
    const buffer = this.tracks.get(id);
    if (!buffer) throw new Error(`Track ${id} not loaded`);

    const source = this.ctx.createBufferSource();
    source.buffer = buffer;
    source.loop = true;

    const gain = this.ctx.createGain();
    gain.gain.value = 0;
    source.connect(gain).connect(this.ctx.destination);
    source.start();

    // Fade in new track
    gain.gain.linearRampToValueAtTime(
      1,
      this.ctx.currentTime + durationMs / 1000
    );

    // Fade out old track
    if (this.currentGain) {
      this.currentGain.gain.linearRampToValueAtTime(
        0,
        this.ctx.currentTime + durationMs / 1000
      );
      const oldSource = this.currentSource;
      setTimeout(() => oldSource?.stop(), durationMs);
    }

    this.currentSource = source;
    this.currentGain = gain;
  }
}

// Usage in my game
const soundtrack = new SoundtrackManager();
await soundtrack.load('menu', '/audio/menu_ambient.mp3');
await soundtrack.load('level1', '/audio/level_1_tutorial.mp3');

// On game state change:
soundtrack.crossfadeTo('level1', 3000);

Enter fullscreen mode Exit fullscreen mode

If you want a higher-level abstraction, Howler.js wraps the Web Audio API beautifully and handles mobile autoplay quirks. Tone.js is another fantastic option if you're doing anything more musical (sequencing, instruments, effects).

What Actually Worked & What Didn't

Worked

  • Instrumental-only mode for game/app background. Vocals are distracting unless you want them front-and-center.
  • Generating 2 variations per prompt and picking the better one. Even the same prompt can produce wildly different takes (this is basically temperature-based sampling in disguise).
  • Iterating on prompts, not on the output. Don't try to "fix" a generation — regenerate with a tighter prompt.
  • Being specific about BPM and key. Big improvement in coherence.

Didn't Work

  • Trying to generate lyrics for specific narrative points. AI lyrics are still generic; write your own and use "Add Vocals" features. ChatGPT or Claude will draft better lyrics than most music-specific models.
  • Relying on one tool. Different models excel at different things — Suno for vocals, MusicGen for ambient, Minimax for structure-heavy tracks. I rotated between them.
  • Skipping post-processing. Even good AI music needs mastering, loop-point trimming, and volume normalization before it's production-ready. If you want to go deep on audio mastering, iZotope's blog is a goldmine.

The Licensing Question (Important)
If you're going to ship this stuff commercially, read the license. Most AI music tools require a paid plan for commercial rights:

  • 1. Free tier usually = personal use only
  • 2. Paid tier = commercial license (usually non-exclusive, royalty-free, worldwide)
  • 3. Some platforms issue downloadable license certificates per song for legal peace of mind

I'm on MusicWave's Pro plan which includes a downloadable license PDF per track — useful when a platform like YouTube flags the audio and you need to submit proof via YouTube's copyright dispute form.

Double-check the specific tool's terms before you publish anything on a monetized channel. The EFF has a solid overview of creator-side IP issues if you want to go deeper.

TL;DR — What I'd Tell Past-Me

  1. Stop paying for stock music libraries if you're a solo dev. Generate once, own forever.
  2. Build a prompt helper function. It's the single highest-leverage abstraction.
  3. Generate 2-3x what you need and curate. Takes 5 minutes to pick, saves headaches later.
  4. Automate the boring parts: loop-trimming, volume normalization, file naming.
  5. Keep a license folder alongside every track you publish commercially.

Resources & Tools I Used
AI Music Generators

  • MusicWave.ai — my main generator (multiple models, stem splitter, mastering built-in)
  • Suno — best for vocal-heavy tracks
  • Udio — great genre variety
  • Stable Audio — strong instrumental output
  • MusicGen (Meta) — open source, run locally

Audio Processing

  • FFmpeg — the swiss army knife of media processing
  • Audacity — free desktop audio editor
  • Spleeter — open-source stem separation
  • Demucs — Meta's stem separation model

Web Audio

Game Dev Adjacent

  • Phaser — HTML5 game framework (what I used)
  • Godot — open-source game engine with great audio support
  • FMOD — pro-level adaptive audio middleware (free for indies under a revenue threshold)

Further Reading

  • Wwise's guide to adaptive audio
  • Designing Sound by Andy Farnell — the bible of procedural audio
  • Game Audio Implementation by Richard Stevens

Drop your workflow in the comments. Happy to share more of my pipeline if folks are interested — I might do a Part 2 on dynamic layered soundtracks (music that reacts to game state).