This document explains how to add audio files to the ZenTap game and integrate them with the existing audio system.
All audio files should be placed in the assets/audio/ directory:
assets/
└── audio/
├── source/
│ ├── bubble_pop.mp3 # Primary bubble pop sound
│ ├── bubble_pop_alt.mp3 # Alternative bubble pop sound
│ └── ambient_background.mp3 # Fallback background music
├── menu/
│ ├── menu_default.mp3 # Default theme menu music
│ ├── menu_spring.mp3 # Spring theme menu music
│ ├── menu_summer.mp3 # Summer theme menu music
│ ├── menu_autumn.mp3 # Autumn theme menu music
│ └── menu_winter.mp3 # Winter theme menu music
├── ingame/
│ ├── ingame_default_001.mp3 # Default theme ingame music
│ ├── ingame_spring_001.mp3 # Spring theme ingame music
│ ├── ingame_summer_001.mp3 # Summer theme ingame music
│ ├── ingame_autumn_001.mp3 # Autumn theme ingame music
│ ├── ingame_winter_001.mp3 # Winter theme ingame music (track 1)
│ └── ingame_winter_002.mp3 # Winter theme ingame music (track 2)
└── compressed/
├── bubble_pop.wav # Compressed bubble pop sound
├── bubble_pop_alt.wav # Compressed alternative pop sound
└── ambient_background.mp3 # Compressed background music
| File Name | Purpose | Duration | Description |
|---|---|---|---|
source/bubble_pop.mp3 |
Primary bubble pop sound | 0.1-0.3s | Satisfying pop sound when bubbles are tapped |
source/bubble_pop_alt.mp3 |
Alternative pop sound | 0.1-0.3s | Variation for audio diversity |
source/ambient_background.mp3 |
Fallback background | 2-5 minutes | Legacy background music file |
| File Name | Purpose | Duration | Description |
|---|---|---|---|
menu/menu_default.mp3 |
Default theme menu | 2-5 minutes | Menu music for default/fSociety theme |
menu/menu_spring.mp3 |
Spring theme menu | 2-5 minutes | Light, fresh menu music for spring |
menu/menu_summer.mp3 |
Summer theme menu | 2-5 minutes | Warm, bright menu music for summer |
menu/menu_autumn.mp3 |
Autumn theme menu | 2-5 minutes | Cozy, warm menu music for autumn |
menu/menu_winter.mp3 |
Winter theme menu | 2-5 minutes | Cool, serene menu music for winter |
| File Name | Purpose | Duration | Description |
|---|---|---|---|
ingame/ingame_default_001.mp3 |
Default theme gameplay | 3-8 minutes | Gameplay music for default theme |
ingame/ingame_spring_001.mp3 |
Spring theme gameplay | 3-8 minutes | Fresh, energetic gameplay music |
ingame/ingame_summer_001.mp3 |
Summer theme gameplay | 3-8 minutes | Upbeat, sunny gameplay music |
ingame/ingame_autumn_001.mp3 |
Autumn theme gameplay | 3-8 minutes | Contemplative autumn gameplay music |
ingame/ingame_winter_001.mp3 |
Winter theme gameplay (track 1) | 3-8 minutes | Calm winter gameplay music |
ingame/ingame_winter_002.mp3 |
Winter theme gameplay (track 2) | 3-8 minutes | Alternative winter gameplay music |
Place your audio files in the assets/audio/ directory with the exact filenames listed above.
The pubspec.yaml file already includes the audio assets:
flutter:
assets:
- assets/audio/
The AudioManager now supports:
// Theme-aware menu music
await AudioManager().playMenuMusic();
// Theme-aware ingame music with random selection
await AudioManager().playIngameMusic();
// Legacy compatibility method
await AudioManager().playBackgroundMusic(); // Falls back to menu music
The system supports multiple tracks per theme for variety:
// Example: Winter theme has 2 ingame tracks
static const Map<String, List<String>> _ingameMusicTracks = {
'winter': ['ingame/ingame_winter_001.mp3', 'ingame/ingame_winter_002.mp3'],
'spring': ['ingame/ingame_spring_001.mp3'],
// ... other themes
};
After adding files and updating the code:
flutter pub get
flutter run
File Not Found Errors
assets/audio/ exactly as namedflutter pub get after adding filespubspec.yaml includes the assets sectionAudio Not Playing
Performance Issues
# Clean and rebuild
flutter clean
flutter pub get
flutter run
# Check for audio file issues
flutter analyze
Note: The theme-based music system is now fully implemented. Replace the placeholder audio files with theme-appropriate music to complete the immersive ZenTap experience.