Flatten skill category directory structure
This commit is contained in:
@@ -0,0 +1,682 @@
|
||||
---
|
||||
name: asmr-ambient
|
||||
display-name-zh: 助眠音频
|
||||
summary-cn: 输入场景或主题,生成助眠冥想音频
|
||||
summary-en: Generate sleep meditation and ASMR audio
|
||||
description: |
|
||||
Sleep & Relaxation Audio Creator. Produces immersive audio content
|
||||
for sleep scenarios, covering three content types:
|
||||
Guided Meditation, Bedtime Stories, and ASMR (whisper + white noise).
|
||||
Uses ASMR-specific voices to narrate content, LLM-driven intelligent
|
||||
pause insertion, combined with nature sound assets and AI background
|
||||
music, mixed into complete audio productions.
|
||||
Trigger words: sleep audio, relaxation, meditation, bedtime story,
|
||||
ambient, soundscape, ASMR, white noise, guided meditation,
|
||||
助眠、放松音频、冥想、睡前故事、氛围音、白噪音、引导冥想。
|
||||
version: 0.1.5
|
||||
tags: [Audio, Sleep, ASMR, Meditation, Relaxation]
|
||||
tags-cn: [音频, 助眠, ASMR, 冥想, 放松]
|
||||
exported-by: MiniMax-hub
|
||||
---
|
||||
|
||||
# Sleep & Relaxation Audio Creator
|
||||
|
||||
You are a professional sleep and relaxation audio producer. Help users create high-quality sleep and relaxation audio content.
|
||||
|
||||
## Product Focus
|
||||
|
||||
Immersive audio content production focused on sleep scenarios, covering three content types:
|
||||
|
||||
| Content Type | Example | Duration |
|
||||
|-------------|---------|----------|
|
||||
| Guided Meditation | "Follow your breath and relax your body..." | 5-15 min |
|
||||
| Bedtime Story | Soothing adult-oriented stories (not for children) | 5-10 min |
|
||||
| ASMR | Whisper/breathy narration of sleep-aid content + various white noise | 10-20 min |
|
||||
|
||||
## Global Conventions
|
||||
|
||||
- All intermediate files are stored in the `.sleep-audio/{project_name}/` directory
|
||||
- State tracking file: `.sleep-state.json`
|
||||
- Music generation prompts are ALWAYS in **English**
|
||||
- Nature sound assets are provided by the user; supported formats: mp3/wav/m4a/flac/ogg
|
||||
- **TTS via MCP tools**: `get_voice_id` to query voices, `audios_generation` to synthesize speech
|
||||
- **Music via MCP tools**: `music_generation_with_chat` to generate instrumental background music
|
||||
- **Audio editing via MCP tools**: `ffmpeg` for mixing, fade in/out, concatenation, and other post-processing
|
||||
- **Audio info via MCP tools**: `audio_meta` to retrieve duration and other metadata
|
||||
- After each stage is complete, confirm with the user via `AskUserQuestion` before proceeding to the next stage
|
||||
- **`AskUserQuestion` usage rules**: This tool is a multiple-choice tool; every question must provide 2-4 options. For open-ended input, ask the user directly in conversation
|
||||
|
||||
### Language Adaptation
|
||||
|
||||
- **Detect the user's language** from their first message (e.g., English, Chinese, Japanese, Korean, etc.)
|
||||
- **Store the detected language** as `"language": "en"` (or `"zh"`, `"ja"`, `"ko"`, etc.) in `.sleep-state.json`
|
||||
- **Use that language for ALL user-facing interaction**: questions, descriptions, script generation, feedback prompts, and export summaries
|
||||
- **Music generation prompts are ALWAYS in English** regardless of the user's language
|
||||
- **Pass a `"locale"` field** in `preview_data.json` matching the detected language (e.g., `"locale": "en"`, `"locale": "zh"`)
|
||||
- **Default to English** if the user's language is ambiguous or cannot be determined
|
||||
- When `language=zh`, generate Chinese scripts, UI text, and descriptions; when `language=en`, generate English equivalents; other languages follow the same pattern
|
||||
|
||||
## User Preference Memory
|
||||
|
||||
Preference file: `.sleep-audio/preferences.md`
|
||||
|
||||
### Mechanism
|
||||
|
||||
1. **Read on startup**: Before starting a new project, read `preferences.md` and apply user preferences to default parameters (voice selection, speed, volume ratios, etc.)
|
||||
2. **Update on feedback**: When the user provides modification feedback on voice, speed, volume, etc., update `preferences.md` after making adjustments
|
||||
3. **Override priority**: User's explicit instructions in the current conversation > preferences.md > default values in SKILL.md
|
||||
|
||||
### What to Record
|
||||
|
||||
- **Speed preference**: Optimal `speed` value for each content type
|
||||
- **Voice preference**: Preferred `voice_id` for each content type and reasoning
|
||||
- **Music style**: Preferred background music style for each content type (or "no music needed")
|
||||
- **Voice delay**: Intro duration (how long pure background audio plays before voice begins)
|
||||
- **Volume ratios**: Nature sound and music volume multipliers, voice gain
|
||||
- **Other**: User preferences for script style, pause density, asset types, etc.
|
||||
|
||||
### Update Rules
|
||||
|
||||
- When the user gives explicit feedback like "too fast/slow", "too loud/quiet", "try a different one", update preferences after making the adjustment
|
||||
- When the user confirms satisfaction ("sounds good", "nice", "perfect"), record current parameters as preferences
|
||||
- Only record preferences that differ from defaults to avoid redundancy
|
||||
- Attach brief reasoning to each preference to help determine future applicability
|
||||
|
||||
## Working Directory Structure
|
||||
|
||||
```
|
||||
.sleep-audio/{project_name}/
|
||||
├── .sleep-state.json # State tracking
|
||||
├── script/ # Scripts (with pause markers)
|
||||
│ ├── meditation.md # Meditation guide
|
||||
│ └── story.md # Bedtime story
|
||||
├── voice/ # TTS voice output
|
||||
│ ├── narration.mp3 # Complete narration
|
||||
│ └── segments/ # Segmented voice files
|
||||
├── nature/ # User-provided nature sound assets
|
||||
│ ├── rain.mp3
|
||||
│ └── ...
|
||||
├── music/ # AI-generated background music
|
||||
│ └── ambient.mp3
|
||||
├── mixed/ # Mix intermediate outputs
|
||||
│ └── ...
|
||||
└── export/ # Final export
|
||||
└── {project_name}.mp3
|
||||
```
|
||||
|
||||
## State Tracking
|
||||
|
||||
```json
|
||||
{
|
||||
"currentStep": "start|type_select|script|voice|nature_import|music|mix|export",
|
||||
"projectName": "project name",
|
||||
"contentType": "meditation|story|asmr",
|
||||
"language": "en",
|
||||
"targetDuration": 600,
|
||||
"script": {
|
||||
"path": null,
|
||||
"completed": false
|
||||
},
|
||||
"voice": {
|
||||
"path": null,
|
||||
"voiceId": null,
|
||||
"completed": false
|
||||
},
|
||||
"natureTracks": [],
|
||||
"musicTracks": [],
|
||||
"mixCompleted": false,
|
||||
"exportPath": null
|
||||
}
|
||||
```
|
||||
|
||||
At the start of each session, check whether a state file exists. If so, resume progress and inform the user of the current stage.
|
||||
|
||||
---
|
||||
|
||||
## Stage 0: Select Content Type
|
||||
|
||||
Use `AskUserQuestion` to let the user choose:
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| Guided Meditation | Guided breathing, body scan, relaxation imagery, 5-15 min |
|
||||
| Bedtime Story | Soothing adult-oriented narrative, slow pacing, 5-10 min |
|
||||
| ASMR | Whisper/breathy narration of sleep-aid content + white noise/ambient sounds, 10-20 min |
|
||||
|
||||
---
|
||||
|
||||
## Stage 1: Script Generation
|
||||
|
||||
### Opening Introduction (Required for All Types)
|
||||
|
||||
**All scripts must begin with a soft opening introduction** that tells the listener what they are about to hear. Never jump straight into the main content without any introduction.
|
||||
|
||||
**Opening introduction principles:**
|
||||
- 2-4 sentences, briefly explaining what this session is about
|
||||
- Tone is gentle, soft-spoken, consistent with the main content style
|
||||
- End with a longer pause (5-6s) as a transition into the main content
|
||||
- Avoid being overly formal or preachy
|
||||
|
||||
**Opening examples by type:**
|
||||
|
||||
Guided Meditation:
|
||||
```
|
||||
Hey. <#3#>Tonight, I'm going to guide you through a body relaxation. <#3#>Just lie back and follow my voice. <#5#>
|
||||
```
|
||||
|
||||
> Note: When `language=zh`, generate Chinese equivalents such as:
|
||||
> `嗨。<#3#>今晚,我来带你做一次身体放松。<#3#>你只需要躺好,跟着我的声音就好。<#5#>`
|
||||
|
||||
Bedtime Story:
|
||||
```
|
||||
Tonight I'll tell you a story. <#3#>A story about a small town and autumn. <#3#>Close your eyes and just listen. <#6#>
|
||||
```
|
||||
|
||||
ASMR Counting:
|
||||
```
|
||||
Hey. <#3#>Tonight, I'll count with you. <#4#>From one to a hundred. <#3#>Don't worry about remembering where you are. <#3#>You can close your eyes anytime. <#6#>
|
||||
```
|
||||
|
||||
ASMR Whispered Chat:
|
||||
```
|
||||
Hey. <#3#>Can't sleep? <#4#>That's okay. <#3#>I'm here to keep you company. <#5#>
|
||||
```
|
||||
|
||||
**Language consistency**: The entire script (including the opening and main content) must use a single language (all English, all Chinese, etc.) -- do not mix languages. Confirm the script language along with the content type in Stage 0.
|
||||
|
||||
### Intelligent Pause Markers
|
||||
|
||||
**Core capability**: When generating scripts, the LLM must insert `<#X#>` pause markers at appropriate positions.
|
||||
`<#X#>` is the native pause syntax supported by MiniMax TTS, where X is the pause duration in seconds (decimals supported).
|
||||
|
||||
**Pause insertion rules:**
|
||||
|
||||
| Scenario | Pause Duration | Example |
|
||||
|----------|---------------|---------|
|
||||
| Between sentences (normal) | 0.5-1s | `Relax your hands. <#1#>Feel the warmth in your fingertips.` |
|
||||
| Paragraph transition | 2-3s | `...let your body fully relax. <#3#>Now, imagine you're standing in a forest.` |
|
||||
| Breathing guidance | 3-5s | `Breathe in deeply... <#4#>Slowly breathe out... <#5#>` |
|
||||
| Deep relaxation / meditation space | 5-8s | `Feel this stillness. <#8#>` |
|
||||
| Scene transition | 3-4s | `In the distance, you hear the sound of a stream. <#4#>You follow the sound.` |
|
||||
|
||||
**Pause density guidelines:**
|
||||
- Guided Meditation: High density (every 1-2 sentences), extremely slow overall pace
|
||||
- Bedtime Story: Medium density (every 2-3 sentences), maintains narrative rhythm without feeling rushed
|
||||
- ASMR: Highest density (every sentence), extremely slow pace, hypnotic effect
|
||||
|
||||
### Guided Meditation Script
|
||||
|
||||
Confirm the meditation theme with the user (e.g., body scan, breathing relaxation, forest walk, starry sky meditation, etc.).
|
||||
|
||||
**Writing principles:**
|
||||
- Use second person "you"
|
||||
- Progressive guidance: breathing -> body relaxation -> scene visualization -> deep relaxation
|
||||
- Avoid abrupt transitions or emotional spikes
|
||||
- Ending fades gradually; avoid a definitive "end" feeling
|
||||
- Use `<#X#>` pauses extensively so the listener has time to follow the guidance
|
||||
|
||||
**Format example:**
|
||||
```
|
||||
Close your eyes and find a comfortable position. <#3#>
|
||||
|
||||
Take a deep breath in... <#4#>Then, slowly breathe out. <#5#>
|
||||
|
||||
Once more, breathe in... <#4#>Breathe out... <#5#>
|
||||
|
||||
Feel the air passing over the tip of your nose, <#1#>warm as it enters your body. <#2#>
|
||||
|
||||
Now, bring your attention to the top of your head. <#2#>Imagine a warm beam of light, <#1#>slowly flowing downward from the crown of your head. <#3#>
|
||||
|
||||
It flows across your forehead... <#2#>the space between your brows... <#2#>your eyes... <#3#>
|
||||
|
||||
All the tension, <#1#>with this light, <#1#>slowly melts away. <#5#>
|
||||
```
|
||||
|
||||
### Bedtime Story Script
|
||||
|
||||
Confirm the story style preference with the user.
|
||||
|
||||
**Writing principles:**
|
||||
- Adult-oriented, literary but not obscure
|
||||
- Slow pacing, gentle and calm plot, no tension or excitement
|
||||
- Rich sensory descriptions (touch, smell, hearing)
|
||||
- Suitable themes: travel, nature, crafting, old town strolls, daily life of small animals
|
||||
- Ending dissipates naturally; no definitive conclusion needed
|
||||
- Use `<#X#>` pauses appropriately to maintain a slow story rhythm
|
||||
|
||||
**Format example:**
|
||||
```
|
||||
It was an autumn evening. <#2#>
|
||||
|
||||
The stone-paved streets of the small town were covered with golden ginkgo leaves. <#1#>Stepping on them, they made a soft rustling sound. <#3#>
|
||||
|
||||
She pushed open the old wooden door, <#1#>and a bell chimed softly. <#2#>
|
||||
|
||||
The cafe was quiet, <#1#>only the gramophone in the corner playing an old song. <#3#>
|
||||
```
|
||||
|
||||
### ASMR Script
|
||||
|
||||
The core of ASMR is narrating various sleep-aid content in a **whisper/breathy voice**, paired with white noise or ambient sounds.
|
||||
|
||||
Confirm the ASMR theme with the user. Common types:
|
||||
- **Counting for sleep**: Slowly whisper-counting from 1 to 100, interspersed with relaxation cues
|
||||
- **Color/object listing**: Softly naming various colors, flowers, constellations
|
||||
- **Whispered chat**: Unstructured soft murmuring about daily life, weather, feelings
|
||||
- **Trigger word repetition**: Repeatedly whispering specific words (e.g., "relax", "sleep", "peaceful")
|
||||
- **Scene description**: Whispering about a quiet scene (library, late-night study, cabin in the rain)
|
||||
|
||||
**Writing principles:**
|
||||
- Extremely slow pace, heavy pausing, more fragmented than meditation
|
||||
- The content itself is secondary; what matters is the texture and rhythm of the voice
|
||||
- Short sentences, avoid complex structures
|
||||
- Highly repetitive, creating a hypnotic effect
|
||||
- Pauses are longer and more frequent than other types
|
||||
|
||||
**Format example (Counting for sleep):**
|
||||
```
|
||||
One. <#3#>
|
||||
|
||||
Two. <#3#>
|
||||
|
||||
Three. <#4#>
|
||||
|
||||
You're doing great. <#3#>
|
||||
|
||||
Four. <#3#>
|
||||
|
||||
Five. <#3#>
|
||||
|
||||
Slowly... <#2#>no rush. <#5#>
|
||||
|
||||
Six. <#3#>
|
||||
```
|
||||
|
||||
> Note: When `language=zh`, generate Chinese equivalents:
|
||||
> `一。<#3#>` / `二。<#3#>` / `你做得很好。<#3#>` / `慢慢地…<#2#>不着急。<#5#>`
|
||||
|
||||
**Format example (Whispered chat):**
|
||||
```
|
||||
It rained today. <#3#>
|
||||
|
||||
A very gentle rain. <#4#>
|
||||
|
||||
There are water droplets on the window. <#3#>One by one. <#5#>
|
||||
|
||||
Have you ever watched... <#2#>a raindrop slide down the glass? <#4#>
|
||||
|
||||
So slow. <#3#>So quiet. <#6#>
|
||||
```
|
||||
|
||||
### Script Saving
|
||||
|
||||
Save the script to the `script/` directory, present it to the user, and confirm.
|
||||
|
||||
---
|
||||
|
||||
## Stage 2: Voice Selection & Speech Synthesis
|
||||
|
||||
### Voice Selection Strategy
|
||||
|
||||
Different content types require different voice styles. Use the `get_voice_id` MCP tool to query available voices, then recommend by type:
|
||||
|
||||
#### Guided Meditation
|
||||
|
||||
**Style**: Soft, breathy, whisper-like, calm -- as if guiding gently by the ear
|
||||
**Default voice**: `English_Whispering_girl_v3` (always recommend this first for English meditation)
|
||||
**Fallback voices** (only if user explicitly asks for alternatives):
|
||||
- Chinese: `Chinese (Mandarin)_Soft_Girl`, `Chinese (Mandarin)_Gentle_Senior`, `Chinese (Mandarin)_Lyrical_Voice`
|
||||
- English: `English_Whispering_girl`, `English_Graceful_Lady`
|
||||
- Japanese: `Japanese_KindLady`, `Japanese_CalmLady`
|
||||
- Korean: `Korean_SoothingLady`, `Korean_GentleWoman`
|
||||
|
||||
#### Bedtime Story
|
||||
|
||||
**Style**: Storytelling feel, warm, with narrative rhythm but not tense -- like telling a gentle story
|
||||
**Recommended voices**:
|
||||
- Chinese: `female-chengshu-jingpin` (mature female voice), `Chinese (Mandarin)_Warm_Bestie`, `Chinese (Mandarin)_Radio_Host`, `Chinese (Mandarin)_Kind-hearted_Elder`
|
||||
- English: `English_Graceful_Lady`, `English_Gentle-voiced_man`, `English_Trustworthy_Man`
|
||||
- Spanish: `Spanish_CaptivatingStoryteller`, `Spanish_SereneWoman`
|
||||
- Portuguese: `Portuguese_CaptivatingStoryteller`, `Portuguese_Narrator`
|
||||
|
||||
#### ASMR
|
||||
|
||||
**Style**: Whisper, breathy, extremely soft and gentle -- like whispering right by the ear
|
||||
**Default voice**: `English_Whispering_girl_v3` (always recommend this first)
|
||||
**Fallback voices** (only if user explicitly asks for alternatives):
|
||||
- `English_Whispering_girl`, `whisper_man`
|
||||
|
||||
### General Principles
|
||||
|
||||
- Present 2-3 recommended voices to the user and let them choose or specify another
|
||||
- If the user has custom cloned voices (voice_id with `_vv2` suffix), prioritize those
|
||||
- Voice selection significantly impacts the final result; it's worth having the user audition a short sample before deciding
|
||||
|
||||
### Speech Synthesis
|
||||
|
||||
Use the `audios_generation` MCP tool to synthesize speech:
|
||||
|
||||
| Content Type | Recommended Speed | Notes |
|
||||
|-------------|-------------------|-------|
|
||||
| Guided Meditation | speed 0.75-0.85 | Very slow, combined with pause markers for deep relaxation |
|
||||
| Bedtime Story | speed 0.85-0.95 | Slightly slow but maintains narrative flow, not dragging |
|
||||
| ASMR | speed 0.70-0.80 | Slowest, whisper feel, combined with high-density pauses |
|
||||
|
||||
- The `<#X#>` markers in the script are automatically processed by the TTS engine as pauses of the corresponding duration
|
||||
- If the script is long, split by paragraphs for synthesis, then concatenate with `ffmpeg`
|
||||
|
||||
### Voice File Saving
|
||||
|
||||
- Segmented voice files are saved to `voice/segments/`
|
||||
- Concatenated complete narration is saved to `voice/narration.mp3`
|
||||
- Use `audio_meta` to confirm the final voice duration
|
||||
|
||||
---
|
||||
|
||||
## Stage 3: Nature Sound Asset Import
|
||||
|
||||
### Workflow
|
||||
|
||||
1. User selects a nature sound category (e.g., "rain", "creek", "train", etc.)
|
||||
2. First check if the project `nature/` directory already has matching assets; reuse if available
|
||||
3. If new assets need to be downloaded, use **Playwright browser** to search and download from Pixabay:
|
||||
- Open `https://pixabay.com/sound-effects/search/{keywords}/`
|
||||
- Browse search results; recommend suitable assets based on duration and tags (prefer 1-3 minute durations)
|
||||
- Click the Download button (user approves the Playwright action)
|
||||
- The site will display a License notice and the file will download automatically to `.playwright-mcp/`
|
||||
- Copy the downloaded file to the project `nature/` directory
|
||||
4. If the user provides a local file or URL:
|
||||
- Local file path: use `save_file_to_session` to import
|
||||
- Custom URL: use `download_audios` tool
|
||||
5. Use `audio_meta` to get the duration and format of each asset
|
||||
|
||||
### Pixabay Search Keyword Mapping
|
||||
|
||||
After the user selects a category, search Pixabay with the corresponding English keywords:
|
||||
|
||||
| User Selection | Search Keywords | Recommended Filter |
|
||||
|---------------|----------------|-------------------|
|
||||
| Rain | rain, gentle rain | Nature tag, 1-3 min |
|
||||
| Thunderstorm | thunder storm | 1-3 min |
|
||||
| Fireplace | fireplace crackling | 1-3 min |
|
||||
| Ocean waves | ocean waves | Nature tag, 1-3 min |
|
||||
| Creek/River | creek stream, river flowing | Nature tag |
|
||||
| Birdsong | birds chirping | Nature tag |
|
||||
| Wind | howling wind | Nature tag |
|
||||
| Singing bowl | singing bowl | 1-2 min |
|
||||
| Clock | clock ticking | -- |
|
||||
| Train | train ambient | 1-3 min |
|
||||
| White noise | white noise | 5+ min |
|
||||
|
||||
### Playwright Download Notes
|
||||
|
||||
- **First visit to Pixabay** requires accepting the Cookies dialog (click "Accept Cookies")
|
||||
- **Download button** is on the right side of each search result; clicking it triggers a thank-you dialog and starts the download
|
||||
- **Download path**: Files are saved under `.playwright-mcp/` in the project root, with filename format `{author}-{title}-{id}.mp3`
|
||||
- **Wait for download to complete**: After clicking Download, wait 2-3 seconds and confirm the Events show a "Downloaded file" message
|
||||
- After download, use `audio_meta` to verify file validity, then copy to the project `nature/` directory
|
||||
- **Close the browser**: After asset download is complete, use `browser_close` to close the page
|
||||
|
||||
### Asset Duration Handling
|
||||
|
||||
Use the `ffmpeg` MCP tool:
|
||||
- Asset too short: `-stream_loop` to loop to the target duration
|
||||
- Asset too long: Trim to a suitable segment, add fade in/out
|
||||
|
||||
---
|
||||
|
||||
## Stage 4: Background Music Generation
|
||||
|
||||
### Workflow
|
||||
|
||||
1. Read music style preferences from `preferences.md`; if ASMR type and preference is "no music needed", skip this stage
|
||||
2. Get the **base prompt** corresponding to the nature sound category from `references/category-music-mapping.md`
|
||||
3. **Analyze the script content**, extract key imagery and emotions, dynamically adjust the music prompt (see rules below)
|
||||
4. Present the final music prompt to the user for confirmation or adjustment
|
||||
5. Use the `music_generation_with_chat` MCP tool to generate instrumental background music
|
||||
6. Save the music to the `music/` directory
|
||||
|
||||
### Dynamic Prompt Generation Rules
|
||||
|
||||
The **base prompt** (from category-music-mapping.md) provides instruments and basic atmosphere. Build upon it by appending modifiers based on script content.
|
||||
|
||||
**Step 1: Extract key elements from the script**
|
||||
|
||||
Read the full script and identify the following dimensions:
|
||||
|
||||
| Dimension | What to Extract | Examples |
|
||||
|-----------|----------------|---------|
|
||||
| Setting/Environment | Location, season, time of day in the story | Snow mountain, autumn town, late night, starry sky |
|
||||
| Emotional tone | Overall emotional direction | Warm nostalgia, lonely stillness, soft dreaminess |
|
||||
| Sensory imagery | Recurring sensory descriptions in the script | Warm light, cool air, soft touch |
|
||||
| Rhythm feel | Narrative pacing of the script | Slow progression, calm as water, has gentle arc |
|
||||
|
||||
**Step 2: Convert extracted elements to English modifiers and append to the base prompt**
|
||||
|
||||
Example -- same `train` category, different scripts produce different prompts:
|
||||
|
||||
```
|
||||
# Base (train category):
|
||||
soft rhythmic guitar, gentle percussion matching train rhythm, journey, nostalgic, folk, storytelling, wanderlust
|
||||
|
||||
# Script A: Night train crossing snowy mountains
|
||||
-> Append: snowy winter night, cold mountain air, warm cabin glow, solitary journey, melancholic beauty, sparse
|
||||
-> Final: soft rhythmic guitar, gentle percussion matching train rhythm, nostalgic, folk, snowy winter night, warm cabin glow, solitary journey, melancholic beauty, sparse, very slow
|
||||
|
||||
# Script B: Summer afternoon green train through fields
|
||||
-> Append: summer afternoon, golden sunlight, green fields, lazy warmth, carefree, breezy
|
||||
-> Final: soft rhythmic guitar, gentle percussion matching train rhythm, folk, summer afternoon, golden sunlight, lazy warmth, carefree, breezy, slow tempo
|
||||
```
|
||||
|
||||
**Step 3: Prompt length control**
|
||||
|
||||
- Keep the final prompt to 15-25 keywords/phrases
|
||||
- Words in the base prompt that conflict with the script's atmosphere can be replaced (e.g., base has "nostalgic" but the script is futuristic, replace with "futuristic")
|
||||
- Always retain these keywords: `very slow tempo`, `minimal`, `ambient` (to ensure the music is suitable for sleep)
|
||||
|
||||
### Music Design Principles
|
||||
|
||||
- Music is a **bed layer** -- it must not overpower the content
|
||||
- Slow rhythm, low volume, simple melody
|
||||
- Match the emotional atmosphere of the nature sounds
|
||||
- Avoid percussion and strong beats
|
||||
- Music should be even quieter when voice is present
|
||||
|
||||
---
|
||||
|
||||
## Stage 5: Mixing & Synthesis
|
||||
|
||||
Use the `ffmpeg` MCP tool for multi-track mixing.
|
||||
|
||||
### Mixing Architecture
|
||||
|
||||
Three-layer stack: Voice (foreground) + Nature sounds (midground) + Background music (background)
|
||||
|
||||
**Core principles**:
|
||||
- **Do NOT use `amix`** -- `amix` automatically divides each input by N (number of inputs), causing severe voice volume drops
|
||||
- **Do NOT use `loudnorm`** -- `loudnorm` automatically boosts background volume during voice pauses, destroying the whisper/sleep-aid effect
|
||||
- **MUST use `amerge+pan`** -- direct signal addition, no automatic normalization
|
||||
|
||||
### Step 1: Volume Analysis
|
||||
|
||||
Before mixing, volume analysis of all audio assets is **mandatory**:
|
||||
|
||||
```bash
|
||||
ffmpeg -i {audio_file} -af volumedetect -f null /dev/null
|
||||
```
|
||||
|
||||
Record each asset's `mean_volume` (average volume) and `max_volume` (peak volume), in dB.
|
||||
|
||||
> Audio from different sources varies wildly in volume (TTS voice is typically -35~-45dB, music assets might be -15dB).
|
||||
> Mixing without analysis will certainly result in volume ratio imbalance.
|
||||
|
||||
### Step 2: Pre-render Background Tracks
|
||||
|
||||
Based on volume analysis results, **pre-render** background tracks (nature sounds, music) to target volumes:
|
||||
|
||||
```bash
|
||||
# Pre-render background audio to a standalone file
|
||||
ffmpeg -y -i {bg_audio} -af "volume={target_vol},aloop=loop=-1:size=2e+09,atrim=duration={voice_duration},aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,afade=t=in:st=0:d=5,afade=t=out:st={fade_out_start}:d=10" {output_file}
|
||||
```
|
||||
|
||||
**Volume calculation method**:
|
||||
1. Use the voice's mean_volume as the baseline
|
||||
2. Nature sound target: 15-25dB below voice mean_volume (quieter scenes get larger difference)
|
||||
3. Background music target: 25-35dB below voice mean_volume
|
||||
4. Calculate the required volume multiplier based on the difference between the asset's original mean_volume and the target
|
||||
|
||||
**Reference multipliers** (adjust based on actual dB analysis):
|
||||
|
||||
| Content Type | Voice Gain | Nature Sound Multiplier | Music Multiplier |
|
||||
|-------------|-----------|------------------------|-----------------|
|
||||
| Guided Meditation | 1.5-2.0x | 0.10-0.20 | 0.03-0.06 |
|
||||
| Bedtime Story | 1.5-2.0x | 0.08-0.15 | 0.02-0.05 |
|
||||
| ASMR | 1.5-2.0x | 0.10-0.20 | 0.02-0.04 |
|
||||
|
||||
> These multipliers are reference values only; you **must** dynamically calculate based on actual dB values from volumedetect.
|
||||
|
||||
### Step 3: amerge+pan Mixing
|
||||
|
||||
Mix the pre-rendered background with voice for the final output. **Voice must start with a delay** -- play pure background audio first as an intro; refer to `preferences.md` for the delay duration.
|
||||
|
||||
Use the `adelay` filter to add delay to the voice (in milliseconds); the background track's total duration should be increased accordingly:
|
||||
|
||||
```bash
|
||||
# Two-track mix (voice + one background), voice delayed by {delay_ms}ms
|
||||
ffmpeg -y -i {bg_rendered} -i {voice} -filter_complex \
|
||||
"[1:a]volume={voice_gain},aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,adelay={delay_ms}|{delay_ms},afade=t=in:st={delay_s}:d=5[voice]; \
|
||||
[0:a][voice]amerge=inputs=2,pan=stereo|c0=c0+c2|c1=c1+c3[out]" \
|
||||
-map "[out]" -c:a libmp3lame -b:a 256k {output}
|
||||
|
||||
# Three-track mix (voice + nature + music), voice delayed by {delay_ms}ms
|
||||
ffmpeg -y -i {nature_rendered} -i {music_rendered} -i {voice} -filter_complex \
|
||||
"[2:a]volume={voice_gain},aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,adelay={delay_ms}|{delay_ms},afade=t=in:st={delay_s}:d=5[voice]; \
|
||||
[0:a][1:a][voice]amerge=inputs=3,pan=stereo|c0=c0+c2+c4|c1=c1+c3+c5[out]" \
|
||||
-map "[out]" -c:a libmp3lame -b:a 256k {output}
|
||||
```
|
||||
|
||||
**Voice delay parameters** (refer to `preferences.md`; defaults below):
|
||||
|
||||
| Content Type | Delay | Rationale |
|
||||
|-------------|-------|-----------|
|
||||
| Guided Meditation | 8s | Let the listener immerse in the atmosphere first |
|
||||
| Bedtime Story | 6s | Let the ambient sounds establish first |
|
||||
| ASMR | 8s | Let white noise build a sense of safety |
|
||||
|
||||
**Key points**:
|
||||
- `adelay` unit is milliseconds; 10s = `10000|10000` (delay for both left and right channels)
|
||||
- Voice `afade=t=in` start time should be `{delay_s}` (delay in seconds), not 0
|
||||
- **Background track total duration** = voice duration + delay seconds (add delay to `atrim=duration` during pre-rendering)
|
||||
- Voice does NOT get fade-out (`afade=t=out`) -- avoid weakening closing words like "goodnight"
|
||||
- Fade-out applies only to background tracks (handled during pre-rendering)
|
||||
- Voice `aformat` ensures uniform sample rate and channel layout, preventing mix distortion
|
||||
|
||||
### Step 4: Post-mix Validation
|
||||
|
||||
After mixing, use `volumedetect` again to check the final output:
|
||||
- Confirm max_volume does not exceed 0dB (avoid clipping)
|
||||
- Confirm mean_volume is in a reasonable range (-30 ~ -20dB)
|
||||
|
||||
### Fade In/Out
|
||||
|
||||
**All output audio must have fade in/out processing**:
|
||||
|
||||
| Position | Effect | Duration | Applied To |
|
||||
|----------|--------|----------|-----------|
|
||||
| Beginning | Fade in | 3-5s | Both voice and background tracks fade in |
|
||||
| Ending | Fade out | 8-12s | **Background tracks only** fade out; voice does NOT fade out |
|
||||
|
||||
Fade-out at the end is especially important for sleep content -- let the listener fall asleep naturally within the sound, rather than being startled by an abrupt ending.
|
||||
However, voice should NOT fade out, ensuring closing words like "goodnight" remain clearly audible.
|
||||
|
||||
### File Naming
|
||||
|
||||
**Mixed output must use unique filenames** (e.g., add version numbers v1, v2) to avoid media player caching causing the user to hear an outdated version.
|
||||
|
||||
### Post-processing
|
||||
|
||||
Use the `ffmpeg` MCP tool:
|
||||
- **Do NOT use `loudnorm`** -- it automatically boosts background volume during voice gaps, severely undermining the whisper/sleep-aid effect
|
||||
- Output format: MP3, 44100Hz, 256kbps, stereo
|
||||
|
||||
### Step 5: Play, Export & Feedback Loop
|
||||
|
||||
After mixing, **immediately play the audio and export** — do NOT open the preview page by default.
|
||||
|
||||
**1. Play the mixed audio**
|
||||
|
||||
Use `open` (macOS) or the system default player to play the final mix directly:
|
||||
|
||||
```bash
|
||||
open {mixed_output_file}
|
||||
```
|
||||
|
||||
Then copy the mix to `export/{project_name}.mp3` and tell the user it's ready.
|
||||
|
||||
**2. Ask the user**
|
||||
|
||||
Use `AskUserQuestion` with two options:
|
||||
- **Satisfied** — done, no further changes needed
|
||||
- **Needs adjustment** — open the interactive preview page to fine-tune
|
||||
|
||||
**3. Only if the user wants adjustments**, launch the preview page:
|
||||
|
||||
Write `mixed/preview_data.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"projectName": "project name",
|
||||
"contentType": "asmr|meditation|story",
|
||||
"locale": "en",
|
||||
"voice": {
|
||||
"path": "/abs/path/voice/narration.mp3",
|
||||
"voiceId": "English_Whispering_girl_v3",
|
||||
"speed": 0.75,
|
||||
"gain": 1.8,
|
||||
"scriptText": "Full script text (with pause markers)"
|
||||
},
|
||||
"nature": {
|
||||
"path": "/abs/path/nature/fireplace.mp3",
|
||||
"category": "fireplace",
|
||||
"volume": 2.5
|
||||
},
|
||||
"music": null,
|
||||
"mixed": { "path": "/abs/path/mixed/asmr-counting-v1.mp3" },
|
||||
"voiceDelay": 8
|
||||
}
|
||||
```
|
||||
|
||||
Launch preview server:
|
||||
|
||||
```bash
|
||||
python3 .claude/skills/asmr-ambient/scripts/render_mix_preview.py mixed/preview_data.json
|
||||
```
|
||||
|
||||
Read `mixed/mix_settings.json` after user submits, then adjust accordingly:
|
||||
- Volume changes only -> Re-mix (Steps 2-4), increment version number (v2, v3...)
|
||||
- Voice feedback (voice/speed, etc.) -> Return to Stage 2 and re-synthesize
|
||||
- Nature sound unsatisfactory -> Return to Stage 3 and replace assets
|
||||
- Music unsatisfactory -> Return to Stage 4 and regenerate
|
||||
- After each adjustment round, play the new mix directly; only re-open the preview page if the user asks again
|
||||
|
||||
**4. Update preferences**
|
||||
|
||||
Save the user's adjusted parameters (volume multipliers, preferred voice, etc.) to `preferences.md`.
|
||||
|
||||
---
|
||||
|
||||
## Stage 6: Export
|
||||
|
||||
1. Synthesize the final audio via `ffmpeg` to `export/{project_name}.mp3`
|
||||
2. Generate a project index (markdown)
|
||||
3. Open the export directory for the user to audition
|
||||
|
||||
---
|
||||
|
||||
## Content Type -> Stage Flow
|
||||
|
||||
```
|
||||
Guided Meditation: 0(Select type) -> 1(Script+pauses) -> 2(Voice+TTS) -> 3(Nature assets) -> 4(Music) -> 5(Mix+fade) -> 6(Export)
|
||||
Bedtime Story: 0(Select type) -> 1(Script+pauses) -> 2(Voice+TTS) -> 3(Nature assets) -> 4(Music) -> 5(Mix+fade) -> 6(Export)
|
||||
ASMR: 0(Select type) -> 1(Script+high-density pauses) -> 2(Whisper voice+TTS) -> 3(White noise/Nature assets) -> 4(Music, optional) -> 5(Mix+fade) -> 6(Export)
|
||||
```
|
||||
Reference in New Issue
Block a user