Skip to main content

Audio Generation

Getting Started

Start from GUI

Menu: AI > Generate > Generate Audio, or refer to the beginning section of Generate 3D Models.

Start from CLI

Audio generation is divided into two tools, please choose according to your needs:

NeedToolDescription
Background Music (BGM) / Ambient Sound / Looping Musicgenerate_audio_clip30–120 seconds, WAV format
Sound Effects (SFX) / One-time Short Soundsgenerate_sound_effect1–22 seconds, multiple formats

After generation is complete, audio is automatically imported as AudioClip and can be used in the scene.


Common Models

BGM / Ambient Sounds: Huoshan Music

  • Use Cases: Background music, looping soundtrack, ambient atmosphere sounds
  • generator_id: huoshan_music (only, default)
  • Output: WAV file, automatically imported as AudioClip
  • Duration: 30–120 seconds (default 60)
  • Key Parameters:
    • prompt: Music style/atmosphere description (required)
    • duration: Duration (seconds, 30–120, default 60)
    • enable_input_rewrite: Whether to let AI improve the prompt (default true)
    • play_on_awake: Whether BGM AudioSource auto-plays when entering Play Mode (default true)

SFX / Sound Effects: SFX AI

  • Use Cases: Gunshots, footsteps, explosions, UI clicks, item pickups and other one-time short sounds
  • Output: Audio file, automatically imported as AudioClip
  • Duration: 1–22 seconds
  • Key Parameters:
    • prompt: Sound effect description (⚠️ Must be in English)
    • duration_seconds: Duration (seconds, 1–22, default 5)
    • prompt_influence: Prompt influence (0–1, default 0.5)
    • output_format: Default server default; optional mp3_44100_128 / mp3_44100_192 / pcm_44100 / opus_48000_128
    • loop: Whether to generate seamlessly looping sound effects (default false)
    • play_on_awake: Whether AudioSource auto-plays when entering Play Mode (default false)

Optimization

BGM Prompt Optimization

  • Describe music style and emotion: "epic orchestral battle theme with heavy drums and brass" > "battle music"
  • Specify instruments: "piano and strings, melancholic" / "electronic synth with deep bass"
  • Enable enable_input_rewrite: Let AI automatically optimize your prompts, usually better results

SFX Prompt Optimization

  • ⚠️ Must be in English: Chinese prompts cannot generate correctly
  • Describe sound details: "sharp wooden door knock, three rapid knocks" > "door knock"
  • Include material and action: "heavy metal sword slash through air, whoosh sound"
  • Adjust prompt_influence:
    • 0.3–0.5: AI has more creative freedom, may be more natural
    • 0.7–1.0: More strictly follow prompt, suitable for precise requirements

Output Format Selection

  • mp3_44100_128: Small size, universal for BGM/SFX
  • pcm_44100: Lossless WAV, best quality, large size
  • opus_48000_128: High compression, suitable for network/mobile

Parallel Generation

  • Maximum 5 concurrent tasks

Notes

  • ⚠️ SFX prompts must be in English, Chinese prompts will generate incorrect results; if user describes in Chinese, need to translate to English first
  • ⚠️ BGM ≠ SFX: Use generate_audio_clip for looping soundtrack, use generate_sound_effect for one-time short sounds, don't mix them
  • ⚠️ Generation time: BGM about 60–180 seconds, SFX about 10–60 seconds
  • ⚠️ AudioSource configuration: BGM usually loop: true + play_on_awake: true; SFX usually loop: false + play_on_awake: false
  • ⚠️ Output path: Default Assets/TJGenerators/History/
  • ⚠️ Domain Reload: Do not write .cs files to disk during generation