10MAGIC MUSIC BOX

IN THIS CHAPTER, YOU’LL CREATE A PERSONALIZED MP3 PLAYER THAT WE’LL CALL THE MAGIC MUSIC BOX. YOU’LL USE YOUR RASPBERRY PI’S PYGAME TO BUILD AN MP3 PLAYER THAT CAN PLAY PRELOADED MUSIC TO A SPEAKER AND THEN ADD FOUR INTERACTIVE BUTTONS: ONE TO SKIP SONGS, TWO TO ADJUST THE VOLUME, AND A POWER SWITCH TO TURN OFF THE PLAYER.

You’ll combine all the hardware into a fancy box to create your MP3 music system (Figure 10-1). The program code uses PyGame, the Python library for creating games that you used in Chapter 5. PyGame allows you to add and control sounds, images, and videos by using Python code. In this project, you’ll use PyGame to control the MP3 files, start and stop them, and adjust the music’s volume.

FIGURE 10-1 The finished ...

Get Raspberry Pi Projects for Kids 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.