Guides
Volume Synchronization
How FMOD API automatically syncs with Minecraft volume sliders
Volume Synchronization
FMOD API automatically synchronizes with all Minecraft volume settings, ensuring FMOD sounds respect user preferences.
🔊 Synchronized Volume Categories
Minecraft Audio Categories
Category | FMOD Mapping | Behavior |
---|---|---|
Master Volume | Global multiplier | Affects all FMOD audio |
Music | Background/ambient events | Loops and music tracks |
Sound Effects | One-shot events | Impact sounds, UI audio |
Blocks | Block-related events | Breaking, placing sounds |
Hostile | Monster/combat events | Combat and creature audio |
Neutral | Neutral mob events | Animals, NPCs |
Players | Player action events | Footsteps, voice |
Ambient | Environment events | Weather, atmosphere |
⚙️ Real-Time Updates
Automatic Detection
// Monitors Minecraft's audio settings
@SubscribeEvent
public static void onVolumeChange(VolumeChangeEvent event) {
float masterVolume = Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.MASTER);
float categoryVolume = Minecraft.getInstance().options.getSoundSourceVolume(event.getCategory());
// Update FMOD volumes in real-time
FMOD.ChannelGroup_SetVolume(getChannelGroup(event.getCategory()),
masterVolume * categoryVolume);
}
Instant Response
- Slider moved → FMOD volume updates immediately
- No restart required → Changes apply instantly
- Smooth transitions → No audio pops or clicks
- Accurate mapping → Matches Minecraft's volume curves
🎛️ Volume Categories in Practice
Mapping Your Sounds
When playing FMOD events, specify the appropriate category:
// Music/ambient sounds
FMODAPI.playEvent("event:/yourmod/ambient_forest", position,
SoundCategory.AMBIENT);
// Combat sounds
FMODAPI.playEvent("event:/yourmod/sword_clash", position,
SoundCategory.HOSTILE);
// UI sounds
FMODAPI.playEvent("event:/yourmod/button_click", position,
SoundCategory.MASTER);
// Block interaction
FMODAPI.playEvent("event:/yourmod/custom_break", position,
SoundCategory.BLOCKS);
Automatic Category Detection
// FMOD API can auto-detect categories based on event naming
FMODAPI.playEvent("event:/yourmod/music/battle_theme", position);
// → Automatically maps to MUSIC category
FMODAPI.playEvent("event:/yourmod/blocks/stone_break", position);
// → Automatically maps to BLOCKS category
🔄 Volume Curve Mapping
Minecraft's Volume Curves
FMOD API replicates Minecraft's exact volume curves:
- Linear mapping for most categories
- Logarithmic scaling for master volume
- Category-specific curves where applicable
- Mute behavior when slider is at 0%
Technical Implementation
public static float calculateFMODVolume(SoundSource category, float sliderValue) {
float masterVolume = options.getSoundSourceVolume(SoundSource.MASTER);
float categoryVolume = options.getSoundSourceVolume(category);
// Apply Minecraft's volume curve
return applyMinecraftVolumeCurve(masterVolume * categoryVolume * sliderValue);
}
📊 Volume Priorities
Hierarchy
- Master Volume - Global override (top priority)
- Category Volume - Per-category control
- Event Volume - Individual sound level
- Distance Attenuation - 3D positioning (if applicable)
Calculation Order
finalVolume = masterVolume
× categoryVolume
× eventVolume
× distanceAttenuation
× customModifiers
🎮 User Experience
What Users See
- Familiar Controls - Same volume sliders as vanilla
- Consistent Behavior - FMOD sounds respond like vanilla sounds
- Real-time Preview - Volume changes apply immediately
- No Additional Setup - Works with existing preferences
Benefits
- Accessibility - Respects user hearing preferences
- Consistency - Matches user expectations
- Control - Fine-grained volume control
- Persistence - Settings saved with Minecraft profile
🔧 Advanced Volume Control
Custom Volume Multipliers
// Apply custom volume multipliers
FMODAPI.setGlobalVolumeMultiplier(0.8f); // 80% of calculated volume
FMODAPI.setCategoryVolumeMultiplier(SoundCategory.MUSIC, 1.2f); // 120% music volume
Dynamic Volume Changes
// Gradually fade volume over time
FMODAPI.fadeEventVolume(instanceId, 0.0f, 2000); // Fade to silence over 2 seconds
FMODAPI.fadeEventVolume(instanceId, 1.0f, 1000); // Fade in over 1 second
Volume Groups
// Create custom volume groups
VolumeGroup combatSounds = FMODAPI.createVolumeGroup("combat");
combatSounds.linkToCategory(SoundCategory.HOSTILE);
combatSounds.setMultiplier(0.9f); // Slightly quieter combat sounds
📈 Performance
Optimization Techniques
- Batched updates - Multiple volume changes processed together
- Change detection - Only updates when sliders actually move
- Efficient mapping - Pre-calculated volume curves
- Minimal overhead - <0.1ms per volume update
Memory Usage
- Zero additional memory for basic volume sync
- Minimal overhead for advanced features
- No persistent storage - Uses Minecraft's settings
🐛 Troubleshooting
Common Issues
FMOD sounds don't respect volume sliders
- Check FMOD initialization
- Verify event category mappings
- Enable debug logging to see volume updates
Volume changes are delayed
- Check for event loop blocking
- Verify no other audio mods are interfering
- Look for exceptions in volume update code
Debug Tools
// Monitor volume changes
FMODAPI.setVolumeDebugLogging(true);
// Check current volume levels
Map<SoundCategory, Float> volumes = FMODAPI.getCurrentVolumes();
System.out.println("Current volumes: " + volumes);
🌟 Best Practices
Event Design
- Use appropriate categories - Map sounds to correct Minecraft categories
- Consider user expectations - Music should be music, effects should be effects
- Test with different volumes - Ensure sounds work at all volume levels
- Respect mute settings - Handle 0% volume gracefully
Implementation
- Cache volume calculations - Don't recalculate every frame
- Handle edge cases - Muted categories, extreme values
- Provide overrides - Allow custom volume behavior when needed
- Test thoroughly - Verify volume sync across all categories
Perfect volume integration ensures your FMOD sounds feel native to Minecraft!
Next: 3D Audio System - Spatial audio positioning and tracking