Generates high-quality audio through three-stage CoT reasoning pipeline: foundational foley synthesis, object-focused refinement, and instruction-guided editing. Uses fine-tuned VideoLLaMA for reasoning and flow-matching audio foundation model. Apply for professional audio design workflows or video-to-audio applications.
Scanned 9/9/2026
Install to Claude Code
npx -y skills add ADu2021/skillXiv --skill thinksound-audio-generation-reasoning --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Thinksound Audio Generation Reasoning?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/adu2021-thinksound-audio-generation-reasoning)More formats (shields.io, HTML) on the badges page.
---
name: thinksound-audio-generation-reasoning
title: "ThinkSound: Chain-of-Thought Reasoning in Multimodal LLMs for Audio Generation and Editing"
version: 0.0.2
engine: skillxiv-v0.0.2-claude-opus-4.6
license: MIT
url: "https://arxiv.org/abs/2506.21448"
keywords: [AudioGeneration, AudioEditing, Multimodal, ChainOfThought, DiffusionTransformer]
description: "Generates high-quality audio through three-stage CoT reasoning pipeline: foundational foley synthesis, object-focused refinement, and instruction-guided editing. Uses fine-tuned VideoLLaMA for reasoning and flow-matching audio foundation model. Apply for professional audio design workflows or video-to-audio applications."
---
# ThinkSound: Professional Audio Design Through Reasoning-Guided Synthesis
Professional audio designers don't generate sound directly—they reason about what's needed, build foundational elements, refine specific sounds, then polish through iterative editing. Most audio generation systems treat this as a single black-box transformation, failing to capture the reasoning that distinguishes professional results from naive synthesis. ThinkSound introduces a three-stage pipeline guided by chain-of-thought reasoning from a fine-tuned multimodal LLM, decomposing sound design into deliberate stages. The result is higher-quality audio with better temporal coherence and semantic accuracy than end-to-end systems.
The insight is that sound design involves compositional reasoning—understanding which sounds matter, in what order, with what properties. Explicit decomposition through reasoning captures this structure.
## Core Concept
ThinkSound replaces single-pass audio generation with a three-stage reasoning-guided process:
1. **Stage 1: Foundational Foley Analysis**: Fine-tuned VideoLLaMA generates comprehensive chain-of-thought analyzing the entire video, identifying all sound events, acoustic properties, and temporal dependencies.
2. **Stage 2: Object-Focused Refinement**: User can click on video regions (ROI selection) to focus refinement on specific objects, with LLM reasoning about their sounds.
3. **Stage 3: Instruction-Guided Editing**: Natural language editing instructions are decomposed through CoT into specific audio modifications (pitch, gain, reverb).
The audio foundation model is a multimodal diffusion transformer using flow matching, accepting combinations of video, text, and audio inputs. This flexibility enables the three-stage pipeline.
## Architecture Overview
- **Reasoning Component**: Fine-tuned VideoLLaMA2 generating structured chain-of-thought about sound design
- **Audio Foundation Model**: Conditional flow-matching transformer synthesizing from multimodal inputs
- **Dual-Pathway Text Encoding**: MetaCLIP for scene context, T5 for detailed reasoning
- **Adaptive Fusion**: Combines video and audio features flexibly
- **Three-Stage Pipeline**: Foundational → refinement → editing with reasoning at each stage
- **AudioCoT Dataset**: Paired reasoning annotations and audio for supervision
## Implementation
Reasoning-guided audio generation with VideoLLaMA:
```python
import torch
import torch.nn as nn
from typing import Optional, Tuple, Dict
class ReasoningGuidedAudioGeneration(nn.Module):
"""
Three-stage pipeline: reasoning generates structure,
audio foundation model synthesizes conditioned on structure.
"""
def __init__(self, reasoning_model, audio_model, device='cuda'):
super().__init__()
self.reasoning_model = reasoning_model # Fine-tuned VideoLLaMA2
self.audio_model = audio_model # Flow-matching transformer
self.device = device
def stage1_foundational_foley(
self,
video: torch.Tensor,
fps: int = 30
) -> Tuple[str, torch.Tensor]:
"""
Stage 1: Analyze entire video and generate foundational foley.
Args:
video: (T, H, W, 3) video tensor
fps: Frames per second
Returns:
reasoning_trace: CoT reasoning about sounds
generated_audio: Synthesized audio covering full video
"""
# Extract key frames and video features
num_frames = video.shape[0]
key_frame_indices = [0, num_frames // 4, num_frames // 2, 3*num_frames // 4, num_frames - 1]
key_frames = video[key_frame_indices]
# Generate comprehensive CoT reasoning
reasoning_prompt = f"""
Analyze this video ({num_frames} frames at {fps}fps, duration {num_frames/fps:.1f}s).
Identify all sound events:
1. What sounds are present?
2. What are their acoustic properties (frequency, intensity, duration)?
3. What is the temporal structure (when do sounds start/end)?
4. How do sounds interact (overlap, sequence)?
Provide detailed structured reasoning.
"""
with torch.no_grad():
reasoning_output = self.reasoning_model.generate(
video=key_frames,
prompt=reasoning_prompt,
max_length=500
)
reasoning_trace = reasoning_output['text']
# Extract sound design structure from reasoning
sound_events = self._parse_sound_events(reasoning_trace)
# Generate foundational audio using reasoning
audio = self.audio_model.synthesize(
video=video,
text_guidance=reasoning_trace, # Use reasoning as guidance
sound_events=sound_events,
num_samples=16000 * (num_frames // fps) # Audio duration
)
return reasoning_trace, audio
def stage2_object_focused_refinement(
self,
video: torch.Tensor,
audio: torch.Tensor,
roi_mask: torch.Tensor,
roi_description: str = None
) -> Tuple[str, torch.Tensor]:
"""
Stage 2: Focus on specific region (ROI) for targeted refinement.
Args:
video: (T, H, W, 3) video
audio: (num_samples,) audio from stage 1
roi_mask: (T, H, W) binary mask of region of interest
roi_description: Optional user description of region
Returns:
reasoning_trace: CoT about specific object
refined_audio: Stage 1 audio with refined region
"""
# Extract ROI from each frame
roi_frames = video * roi_mask.unsqueeze(-1)
# Generate reasoning about this specific object
if roi_description:
refine_prompt = f"""
Focus on this object in the video: {roi_description}
Generate detailed reasoning about:
1. What sounds does this object make?
2. How do these sounds change over time?
3. What acoustic properties are important?
4. How should this sound interact with background?
"""
else:
refine_prompt = """
For this region of interest, analyze:
1. What object/action is present?
2. What are the characteristic sounds?
3. How do they change temporally?
4. Acoustic details (timbre, envelope)?
"""
with torch.no_grad():
reasoning_output = self.reasoning_model.generate(
video=roi_frames,
prompt=refine_prompt,
max_length=300
)
refinement_reasoning = reasoning_output['text']
# Synthesize refined audio for ROI
roi_audio = self.audio_model.synthesize(
video=roi_frames,
text_guidance=refinement_reasoning,
mask=roi_mask,
condition_on_audio=audio, # Condition on stage 1 audio
num_samples=audio.shape[0]
)
# Blend refined ROI audio back into full audio
refined_audio = self._blend_roi_audio(audio, roi_audio, roi_mask)
return refinement_reasoning, refined_audio
def stage3_instruction_guided_editing(
self,
audio: torch.Tensor,
instruction: str,
video: Optional[torch.Tensor] = None
) -> Tuple[str, torch.Tensor]:
"""
Stage 3: Apply natural language editing instructions.
Args:
audio: Audio to edit
instruction: Natural language edit (e.g., "make drums louder", "add reverb")
video: Optional video for context
Returns:
reasoning_trace: CoT about how to apply instruction
edited_audio: Modified audio
"""
# Generate reasoning about how to apply instruction
editing_prompt = f"""
Audio editing task: "{instruction}"
Reasoning about how to modify the audio:
1. What aspect needs modification (timbre, loudness, reverb, etc)?
2. Which parts of the audio are affected?
3. What audio processing is needed (EQ, compression, delay)?
4. What are the target parameters?
Provide technical reasoning.
"""
with torch.no_grad():
reasoning_output = self.reasoning_model.generate(
text=editing_prompt,
video=video if video is not None else None,
max_length=300
)
editing_reasoning = reasoning_output['text']
# Extract editing parameters from reasoning
editing_params = self._parse_editing_params(editing_reasoning, instruction)
# Apply edits
edited_audio = self.audio_model.edit_audio(
audio=audio,
text_guidance=instruction,
editing_params=editing_params,
reasoning=editing_reasoning
)
return editing_reasoning, edited_audio
def _parse_sound_events(self, reasoning_text: str) -> list:
"""Extract structured sound event information from CoT reasoning."""
# Parse reasoning to identify sound events
# (simplified; full implementation uses NLP)
events = []
# Look for patterns like "At T seconds: [sound description]"
import re
pattern = r'(\d+\.?\d*)\s*s(?:econds?):\s*([^\.]+)'
matches = re.findall(pattern, reasoning_text)
for time_str, description in matches:
events.append({
'time': float(time_str),
'description': description.strip()
})
return events
def _blend_roi_audio(
self,
full_audio: torch.Tensor,
roi_audio: torch.Tensor,
roi_mask: torch.Tensor
) -> torch.Tensor:
"""Smoothly blend ROI-refined audio back into full audio."""
# Spatial blending: weight by mask spatial content
# Temporal blending: fade at ROI boundaries
blend_factor = 0.7 # Blend strength
# Simple mix: weighted sum
blended = full_audio * (1 - blend_factor) + roi_audio * blend_factor
return blended
def _parse_editing_params(self, reasoning_text: str, instruction: str) -> Dict:
"""Extract numerical parameters from reasoning about editing."""
params = {
'gain_db': 0.0,
'reverb_wet': 0.0,
'cutoff_hz': 20000
}
# Parse reasoning for numerical parameters
import re
if 'louder' in instruction.lower():
params['gain_db'] = 6.0 # +6dB
elif 'quieter' in instruction.lower():
params['gain_db'] = -6.0
if 'reverb' in instruction.lower():
params['reverb_wet'] = 0.3
# More sophisticated parsing from reasoning
db_match = re.search(r'(\d+)\s*dB', reasoning_text)
if db_match:
params['gain_db'] = float(db_match.group(1))
return params
```
Flow-matching audio foundation model for synthesis:
```python
class FlowMatchingAudioModel(nn.Module):
"""
Multimodal audio synthesis using flow matching.
Accepts video, text, and audio conditioning.
"""
def __init__(self, audio_dim=128, hidden_dim=512, num_layers=8):
super().__init__()
# Dual-pathway text encoding
self.metaclip_encoder = MetaCLIPEncoder(hidden_dim) # Scene context
self.t5_encoder = T5Encoder(hidden_dim) # Detailed reasoning
# Video feature extractor
self.video_encoder = VideoEncoder(hidden_dim)
# Flow-matching transformer
self.transformer = FlowMatchingTransformer(hidden_dim, num_layers)
# Audio decoder
self.audio_decoder = AudioDecoder(hidden_dim, audio_dim)
def synthesize(
self,
video: torch.Tensor = None,
text_guidance: str = None,
sound_events: list = None,
condition_on_audio: torch.Tensor = None,
num_samples: int = 16000
) -> torch.Tensor:
"""
Generate audio from multimodal conditions.
"""
# Extract features from available modalities
features = []
if video is not None:
video_feat = self.video_encoder(video)
features.append(video_feat)
if text_guidance is not None:
# Use both MetaCLIP (scene) and T5 (details)
scene_text = text_guidance.split('\n')[0]
detailed_text = text_guidance
scene_feat = self.metaclip_encoder(scene_text)
detail_feat = self.t5_encoder(detailed_text)
# Adaptive fusion of text encodings
fused_text = self._fuse_text_features(scene_feat, detail_feat)
features.append(fused_text)
if sound_events is not None:
event_feat = self._encode_sound_events(sound_events)
features.append(event_feat)
# Concatenate all features
if features:
combined_features = torch.cat(features, dim=-1)
else:
combined_features = torch.zeros(1, 512)
# Flow matching: denoise from pure noise to audio
audio = self.transformer.flow_match(
combined_features,
num_samples=num_samples
)
# Decode to waveform
waveform = self.audio_decoder(audio)
return waveform
def edit_audio(
self,
audio: torch.Tensor,
text_guidance: str,
editing_params: Dict,
reasoning: str = None
) -> torch.Tensor:
"""
Edit existing audio based on instructions and reasoning.
"""
# Encode existing audio
audio_embedding = self._encode_audio(audio)
# Encode editing instruction
instruction_feat = self.t5_encoder(text_guidance)
# Apply parameter adjustments from reasoning
edited_audio = self._apply_edits(
audio, audio_embedding, instruction_feat, editing_params
)
return edited_audio
def _fuse_text_features(self, scene_feat, detail_feat):
"""Adaptively combine scene and detailed text features."""
# Learned weighted combination
alpha = 0.4 # Learnable weight
return alpha * scene_feat + (1 - alpha) * detail_feat
def _encode_sound_events(self, events):
"""Encode structured sound events into features."""
# Each event: (time, description) → feature vector
event_features = []
for event in events:
time = event.get('time', 0)
desc = event.get('description', '')
feat = self.t5_encoder(desc)
# Add temporal information
feat = feat + torch.tensor([[time / 10.0]]) # Normalize by 10s
event_features.append(feat)
if event_features:
return torch.mean(torch.stack(event_features), dim=0)
return torch.zeros(1, 512)
def _encode_audio(self, audio):
"""Encode existing audio for conditioning."""
# Use pretrained audio encoder (e.g., encodec)
return audio # Simplified
def _apply_edits(self, audio, embedding, instruction_feat, params):
"""Apply structured edits to audio."""
# Apply gain
edited = audio * (10 ** (params['gain_db'] / 20))
# Apply reverb (simplified)
if params['reverb_wet'] > 0:
reverb = self._apply_reverb(edited, params['reverb_wet'])
edited = edited * (1 - params['reverb_wet']) + reverb
# Additional processing based on params...
return edited
def _apply_reverb(self, audio, wet_amount):
"""Simple reverb effect."""
# Convolution with impulse response (simplified)
decay = torch.exp(torch.linspace(0, -5, 5000))
reverb_out = torch.nn.functional.conv1d(
audio.unsqueeze(0).unsqueeze(0),
decay.unsqueeze(0).unsqueeze(0)
)
return reverb_out.squeeze()
```
## Practical Guidance
| Aspect | Value | Notes |
|--------|-------|-------|
| Stage 1: Foundational | Captures full-video semantics | Best for comprehensive soundscapes |
| Stage 2: Refinement | Object-focused sound design | Improves specific element quality |
| Stage 3: Editing | Instruction-guided modifications | Natural language control |
| Reasoning Model | Fine-tuned VideoLLaMA2 | Domain-specific for audio reasoning |
| Audio Model | Flow-matching transformer | Flexible multimodal inputs |
| Dual Text Encoding | MetaCLIP + T5 | Scene understanding + detail |
| Generalization | Out-of-distribution benchmarks | Strong transfer to new videos |
**When to use:**
- Professional audio design workflows for video content
- Video-to-audio generation requiring semantic accuracy
- Interactive audio editing with natural language instructions
- Applications where audio quality and semantic coherence matter
- Systems needing iterative refinement (Stage 1→2→3)
- Object-focused sound synthesis (Stage 2 with ROI)
**When NOT to use:**
- Real-time audio synthesis (three stages add latency)
- Simple sound effects where one-pass generation suffices
- Scenarios where reasoning is unnecessary overhead
- High-volume automated audio processing (complexity cost)
- Tasks without clear semantic sound structure
- Systems where speed dominates quality considerations
**Common pitfalls:**
- Reasoning quality depends on VideoLLaMA fine-tuning—insufficient training data hurts
- Not leveraging Stage 2 ROI refinement (skipping professional-level quality)
- Stage 3 instruction parsing too simplistic (requires robust NLU)
- Assuming reasoning from one video domain transfers to others
- Over-relying on text guidance without visual grounding
- Ignoring temporal coherence between stages (audio should flow smoothly)
## Reference
"ThinkSound: Chain-of-Thought Reasoning in Multimodal LLMs for Audio Generation and Editing", 2025. [arxiv.org/abs/2506.21448](https://arxiv.org/abs/2506.21448)
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!