© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
A. Cruz YorisFlame Game Developmenthttps://doi.org/10.1007/979-8-8688-0063-4_14

14. Audio

Andrés Cruz Yoris1  
(1)
Caracas, Venezuela
 
Sound is a crucial part in almost any game today. Background music and when the player or enemy walks, dies, attacks, or is injured are scenarios in which a chord sound is commonly played to enhance the experience. In Flame, to use sounds, we must install an additional extension to the Flame package:
flutter pub get flame_audio

The official documentation and use can be found at the following link:

https://pub.dev/packages/flame_audio

Its use is very simple. If you want to use background music, you use
FlameAudio.bgm.initialize(); ...

Get Flame Game Development: Your Guide to Creating Cross-Platform Games in 2D Using Flame Engine in Flutter 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.