3 Making a F.A.R.T. box, a disgusting soundboard

 

This chapter covers

  • Using layouts
  • Making pushbuttons
  • Assign sounds to Pushbuttons and playing audio
  • Creating functions

Have you heard the term “soundboard”? A soundboard usually consists of a computer program, a physical device, or a website that has a selection of buttons. When you press a button, it plays an audio clip. The clip is commonly a quote from a film, a lyric from a song, or a sound effect. Soundboards are self-contained, requiring no outside media player; you simply press a button and sound is played.

Trumps, bottom burps, gas, pump noises are funny and make most people laugh. Farts have an amazing habit of being able to distract anyone hearing one, especially if they are trying really hard to concentrate. So, in this project we will build a twisted GUI that combines a selection of noises to create a Fluff Audio Resonance Transmission (F.A.R.T.).

WHAT YOU WILL BUILD

In this chapter you will build a soundboard (figure 3.1) that consists of seven buttons. When the user presses one of the six buttons, the app plays a sound. Press a different button and it plays a different sound. The Exit button closes the soundboard.

Figure 3.1 The Fluff Audio Resonance Transmission (F.A.R.T.) soundboard

Creating the project

Downloading and storing the audio files

Creating the Functions to play audio

Closing the soundboard

Creating the GUI for the soundboard

Adjusting the size and color of the soundboard

Adding text and an image to the soundboard

Using the Box object to lay out the buttons

Coding the buttons that trigger the sounds

Creating a button to close the F.A.R.T. soundboard

Running and testing your GUI program

Two other things to try

Changing the background color of the buttons

Adding more buttons and sounds

Summary

Using Simple Audio