# HomuraHime Audio System Analysis ## Game Overview - **Engine**: Unity 2022.3.x - **Audio Engine**: FMOD Studio 2.02.x with Google Resonance spatial audio - **Voice Manager**: UtageFmodVoiceManager (adapted Utage framework) - **Platform**: Steam (uses Steamworks.NET) ## Audio Architecture ### Directory Structure ``` HomuraHime_Data\ ├── Managed\ │ ├── Assembly-CSharp.dll (7.08 MB - main game logic) │ ├── Assembly-CSharp-firstpass.dll (3.92 MB - runtime code) │ ├── FMODUnity.dll (239 KB - FMOD Unity integration) │ ├── FMODUnityResonance.dll (11 KB - FMOD Resonance extension) │ └── UnityEngine.AudioModule.dll ├── Plugins\x86_64\ │ ├── fmodstudio.dll (3.16 MB - FMOD core) │ └── resonanceaudio.dll (817 KB - Google Resonance spatial) └── StreamingAssets\FMOD\Desktop\ └── (49 FMOD bank files - ~1.3 GB total) ``` ### FMOD Bank Files | Bank | Purpose | Size (streams) | |------|---------|----------------| | Master.bank | Main mixer and routing | 98.5 KB | | BGM.bank | Background music (general) | 63.83 MB | | BGM_Default.bank | Default BGM | 224.07 MB | | BGM_Hub.bank | Hub area music | 14.67 MB | | BGM_Lv0-Lv5, BGM_LvF | Level-specific music | 14-64 MB each | | Ambience.bank | Environmental sounds | 150.97 MB | | SFX.bank | Sound effects | 188.97 MB | | Voice.bank | Character voice | 19.83 MB | | PreLoad_Jump.bank | Pre-cached jump sounds | ~533 KB | | PreLoad_FootStep_Land.bank | Pre-cached footstep sounds | ~1 MB | **Total Audio: ~1.3 GB across 49 bank files** ## Key Audio Classes ### Voice Management - **UtageFmodVoiceManager** - Main voice manager (Utage framework adapted) - **CFVoiceData** / **CFVoiceEventUtility** - Custom voice event system - **CharacterVoiceData** - Character voice data handling - **FmodVoiceStopper** - Voice stop controller - **get_CountVoice** / **get_IsPlayingVoice** - Voice count monitoring ### Sound Management - **FMODSoundManager** - Main FMOD sound manager - **SoundManager** (Utage base) - Base sound manager - **FmodSFXEventSO**, **FmodSFXEventRef**, **FmodSFXEventDispatcher** - Custom SFX system - **FMODEventInstance** - FMOD event instance wrapper ### Channel/Volume Control - **FMOD_Channel** - Custom FMOD channel wrapper - **VCASetting** - Volume control area settings - **TaggedMasterVolume** - Per-tag master volume control - **BGMChannel** - BGM channel management ### Audio Effects - **UpdateDucking** / **DuckVolume** - Audio ducking system - **SnapshotManager** - Snapshot management - **FmodReverbEventController** - Reverb control - **ZoneReverbHandler** - Zone-based reverb ### Spatial Audio - **HHFmodListenerPosController** - FMOD listener position controller - **resonanceaudio.dll** - Google Resonance spatial audio ### Pooling - **SimplePool** / **ObjectPool** - Generic object pooling - **DEFAULT_POOL_SIZE**, **VfxObjectPoolSize** - Pool size constants ## Voice Event Constants (CFVOICE Events) The game triggers voice events for various situations: - `CFVOICE_REWARD` - Reward sounds - `CFVOICE_CHALLENGEBATTLE` - Challenge battle start - `CFVOICE_BATTLE` - Battle start - `CFVOICE_NOTE` - Note/commentary - `CFVOICE_MHCHASING` - Chasing sequences - `CFVOICE_ELECTRIFYING` - Electrifying events - `CFVOICE_HH` / `HH_Behaviour` - HomuraHime behavior events - `CFVOICE_ENEMY` - Enemy-related voice - `CFVOICE_QTE_SHIKIGAMI` - QTE shikigami events - `CFVOICE_BATTLERANK` - Battle rank announcements - And many more... ## Enemy System ### Enemy Audio Triggers - **EnemyBehaviorManger** - Enemy behavior management - **EnemyAttackBase**, **EnemyAttackAction**, **EnemyAttackBlockedAction** - Attack handling - **EnemyIndicatorController** - Visual indicators for enemies - **SetEnemyAI** - AI setting method - **EnemyState** - Enemy state tracking ### HUD/Indicator Classes - **HUDIndicatorPhase** / **HUDIndicatorPhaseHandler** - Phase indicator handling - **CDHUDIndicatorHandler** - Cooldown HUD indicator - **IndicatorManager** - Indicator management ## Audio Configuration ### Pool-Related Constants - `DEFAULT_POOL_SIZE` - Default pool size - `VfxObjectPoolSize` - VFX pool size - `ObjectPoolSize` - Generic object pool size - `poolPreloadnum` - Pool preload count - `preloadCountPerPrefab` - Per-prefab preload count ### FMOD Channel Constants - `MAXCHANNELS` - Maximum channel count - `ERR_TOOMANYCHANNELS` - Channel overflow error - `ERR_CHANNEL_ALLOC` - Channel allocation error - `VIRTUALVOICE` - Virtual voice management - `CHANNELPRIORITY` - Channel priority setting - `MAX_CHANNEL_WIDTH` - Maximum channel width ## Key Findings 1. **No explicit voice limit constants** visible in string analysis - voice limit may be managed internally by FMOD or Utage framework 2. **Audio ducking system exists** - `UpdateDucking` and `DuckVolume` present 3. **Voice pooling exists** - Object pooling with `DEFAULT_POOL_SIZE` constants 4. **Lip-sync support** - Using `uLipSyncFMOD` for voice synchronization 5. **Priority system** - `CHANNELPRIORITY` and `Priority` fields for channel prioritization 6. **Event-driven voice system** - Voices triggered via CFVOICE event constants ## Source File Paths (from DLL strings) These are the original Unity asset paths in the game source: - `Assets/4.Developer/Andy/UtageVoiceManager/UtageFmodVoiceManager.cs` - `Assets/4.Developer/Andy/UtageVoiceManager/UtageFmodVoiceSetting.cs` - `Assets/4.Developer/Andy/UtageVoiceManager/FmodVoiceStopper.cs` - `Assets/4.Developer/Andy/UtageVoiceManager/DEAudioFadeManager.cs` - `Assets/4.Developer/Andy/UtageVoiceManager/SnapshotManager.cs` - `Assets/4.Developer/Andy/UtageVoiceManager/FmodReverbEventController.cs` - `Assets/1.HonoHime/Core/FMODUtility/Scripts/FMODSoundManager.cs` - `Assets/1.HonoHime/Core/FMODUtility/Scripts/MMFeedbacks/FMOD_Channel.cs` - `Assets/1.HonoHime/Core/mLibrary/ObjectPool/SimplePool.cs` ## Game Data Files Audio-related configuration may exist in: - `HomuraHime_Data\StreamingAssets\HomuraHimeData\csv\EnemyData.json` - `HomuraHime_Data\StreamingAssets\HomuraHimeData\json\BattleRound.json` - `HomuraHime_Data\StreamingAssets\HomuraHimeData\json\EnemyData.json` ## Potential Audio Glitch Causes Based on architecture analysis: 1. **Voice Limit Exhaustion** - Too many simultaneous FMOD events 2. **Missing Audio Ducking Rules** - No automatic volume reduction during intense combat 3. **Improper Event Instance Cleanup** - Voices not being released properly 4. **CPU Pressure from Spatial Audio** - Resonance audio processing overhead 5. **Pool Size Limitations** - Object pool too small for audio components ## Enemy Behavior Indicator Issues Potential causes for unclear enemy audio cues: 1. **Low Mix Volume** - Enemy sounds mixed too low in Master.bank 2. **Insufficient Spatial Positioning** - Sounds not directional enough 3. **Lack of State Variation** - Same sounds for all enemy states 4. **Audio Masking** - Other sounds drowning out enemy cues 5. **Missing Parameter Changes** - No FMOD parameter automation for enemy state