Phase 4: Audio & Music Generation · 50 min · Python · Demucs · pydub
Audio Generation Engineering
Stem separation, structure control, voice cloning — the engineering layer that turns raw generation into production audio.
Hiring signal: Audio engineering skills (stem separation, structure control, format handling) demonstrate you can work with audio as an engineer, not just generate it.
What you will learn
- Differentiate text-to-audio (SFX) vs text-to-music (full songs)
- Handle audio formats: WAV, MP3, FLAC, sample rates (44.1kHz, 48kHz), bit depth
- Implement stem separation: splitting generated audio into individual instrument tracks (Demucs, Moises)
- Control music structure: intro/verse/chorus/outro, mood prompts, tempo control
The Problem
A team generates a song with Suno. The song sounds good, but:
- They need to remove the vocals and keep only the instrumental — they don't know about stem separation
- They need the audio in 48kHz WAV for a video project, but Suno outputs 44.1kHz MP3 — they don't know how to convert
- They need the song to have a specific structure (intro → verse → chorus) — they don't know how to control structure
- They need to clone a specific voice for the vocals — they don't know voice cloning
Audio engineering skills (stem separation, structure control, format handling) demonstrate you can work with audio as an engineer, not just generate it.
What you'll build
Implement stem separation with Demucs to split generated audio into individual instrument tracks. Handle audio format conversion (WAV, MP3, FLAC, sample rates). Control music structure with prompt engineering. Document audio engineering best practices.
Audio Formats
Common Formats
| Format | Use Case | Quality | Size |
|---|
| WAV | Master/archive | Lossless | Large |
| FLAC | Archive/storage | Lossless compressed | Medium |
| MP3 | Delivery/streaming | Lossy | Small |
| Opus | Streaming/real-time | Lossy, efficient | Smallest |
| AAC | Streaming (Apple) | Lossy | Small |
Sample Rates
| Rate | Use Case |
|---|
| 44.1 kHz | CD quality, music standard |
| 48 kHz | Video/film standard |
| 22.05 kHz | Voice-only (low quality) |
| 96 kHz | High-resolution audio |
Bit Depth
| Depth | Dynamic Range | Use Case |
|---|
| 16-bit | 96 dB | CD quality, standard delivery |
| 24-bit | 144 dB | Production/mastering |
| 32-bit float | Unlimited | DAW, processing |
Format Conversion with pydub
from pydub import AudioSegment
# Load MP3
audio = AudioSegment.from_mp3("generated_song.mp3")
# Convert to WAV at 48kHz, 24-bit
audio = audio.set_frame_rate(48000)
audio = audio.set_sample_width(3) # 24-bit = 3 bytes
audio.export("output_48k_24bit.wav", format="wav")
# Convert to Opus for streaming
audio.export("output.opus", format="opus", bitrate="128k")
You generated a song with Suno (44.1kHz MP3) but need it in 48kHz WAV for a video project. How do you convert it?
Use pydub: audio = AudioSegment.from_mp3("song.mp3"); audio.set_frame_rate(48000); audio.export("output.wav", format="wav"). This converts the sample rate from 44.1kHz to 48kHz and the format from MP3 to WAV. You can't just rename the extension — the actual audio data needs to be re-encoded.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Stem Separation, Music Structure Control, Voice Cloning for Music, Audio Analysis with librosa, Key Takeaways, What's Next — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy