Chapter 7: Sound Effects and Music
Take a moment and think of the game Tetris. If you're like me, you're probably already humming its theme song, Korobeiniki, because that song is so synonymous with the game itself. Beyond the appeal of music, sound effects are crucial for creating an immersive experience. We play games with more than just the touch of a keyboard or joystick and the use of our eyes; we hear Mario jump or Sonic catch a ring. While our game may be playable, it's just not a game without some sound. To play sound in our game, we'll need to learn how to use the browser's Web Audio API for both short and long sounds.
In this chapter, we will cover the following topics:
- Adding the Web Audio API to the engine
- Playing sound effects ...