Introduction: Foxonix Joke Box

In this Instructable we are going to explore some of the features of Foxonix Development Board used for adding the speech, music and other sounds to your projects.

In this example I decided to make a Joke Box out of several knock knock jokes that I edited from gradualreport video.

Step 1: Parts and Software You Will Need

To make the Joke Box, you will need electronics that can store the audio files, some buttons to trigger the sound, speaker and some kind of power supply. If you don't have sound files that you want to use ready, you will probably need a sound editing software. If you want to use your own voice you can use microphone that is in the laptop already.

Parts:

1.) Foxonix Fox Development Board
2.) Six pushbottons or Foxonix I/O Interface Board Kit
3.) Small speaker
4.) Battery holder for two or three batteries (AA or AAA), or if you are powering the board from an outlet, you can use cellphone charger (or any rectifier that gives USB output) to get 5V.
5.) Mini USB cable
6.) Software for editing sound. I used Audacity, it is free.
7.) Some type of microphone if you are interested in recording your own voice.

Step 2: Creating the Sound Files

To download an audio file (that is less than 20min) from a YouTube video I used YouTube to mp3 converter. To do this, you have to:

1.) Open the YouTube video you would like to get the sound from
2.) Copy the url from that video to YouTube to mp3 converter webpage.
3.) Click "Convert Video"
4.) Once it converts, it will download the .mp3 file by clicking on "download".

Now we have to covert the .mp3 file into single challenge .wav file. We also have to get it's sample rate between 2kHz and 21kHz. We can edit the .mp3 using Audacity, by following the next steps:

1.) File-> Open, navigate to you mp3 file, and click Open again.
2.) In the bottom left corner, change the "Project Rate (Hz)" to desired sample rate frequency. I used 12kHz
3.) To make it single channel, click Tracks -> Stereo Track to Mono
4.) With the mouse, highlight the part of the audio you want to take out, then press CTRL+C, open a new empty window in Audacity and then press CTRL+V to post it.
5.) Finally, to save it in .wav format, go to File -> Export Selected Audio... give it a name, choose .wav extension and save it.

Step 3: Hardware

This diagram shows how to connect your buttons, speakers and the Foxonix Development Board.

1.) The speaker connects to the PWM jack
2.) Every button is connect to Px.y on one end (where 'x' is 1,2 or 6, and 'y' is any number from 0-4), and the other end of the button is connected to 3.3V. I connected mine on P1.0, P1.1, P2.0, P2.1, P6.0 and P6.1, but you can rearrange your buttons any way you wish.

Step 4: The Code

To make changes to the code, you will need Code Editor which is the part of the Foxonix software bundle.

To open the code, click on Open, and on the bottom, there will be a drop down menu for choosing "Files of type:". Choose "Easy-Format [*.ez]" and select the file that contains your code.

To customize audio with your sounds, simply move the sound file in the folder where your code file is, and change the names of it in the code. To change the functionality of the buttons, you can look at my example, or look at plenty of other sample programs on the Foxonix webpage.

Step 5: Programming the Board

Finally, once you are done with editing your code and you want to test it out, you will have to upload the code to the Foxonix Development Board. You will need to:
1.) Connect the board to one of your USB ports
2.) Open Foxonix Programmer that comes with the software bundle
3.) Select the port your board is connected to
4.) Choose "Foxonix Fox Board" as the Target
5.) Navigate to your .bin file
6.) Program device

Once your board has been flashed you are ready to play with it.

Enjoy and have lots of laughs!