Boom Box (Super Mario 64 DS)
From the Super Mario Wiki
Boom Box is a minigame in Super Mario 64 DS. It is one of Yoshi's minigames, though Yoshi is only seen in the background pushing a treasure chest. It involves the player tapping a treasure chest on the touch screen to open it. When opened, the chest makes a sound, astonishing the Mario head on the top screen. For every chest that makes a certain sound, there is another chest that makes the same sound. The player must match all of the sounds with each other. As the player progresses, more chests appear. If the player makes a mistake, the Mario head frowns, while if the player succeeds, the Mario head beams at the player. If the player gets a Game Over, then Mario's face screams and looks dazed. When a player clears the round, Mario's face is astonished, then bursts out laughing.
 In-Game Instructions
Each time you open a treasure chest, you'll hear a sound. Open 2 chests with the same sound. Win by matching all the pairs!
Mario laughing is similarly based on him shouting when he catches on fire.