Creating and Playing a Sound File

1) Learning the Hardware

In order to play custom sounds, you need to have a Micro SD Card.  It comes with a MicroSD and adapter.

If getting sound files from the computer you need to put the MicroSD inside the SD adapter so it will fit into your computer or standard card reader.  It is important that the prongs are both pointing in the same direction as shown.

To Place into your computer place the MicroSD completely inside the SD adapter correctly and place the assembly into the computer as shown.

After you add the files, then remove the MicroSD card from the SD adapter and place into robot.  IMPORTANT: Insert card all the way in with your nail, until your hear card “click”.  Also, reboot robot by TURNING OFF AND ON ROBOT

2) How to Play a Sound from the Memory Card

Add in the code “call sound.play(#)”  Where instead of #, put the number of the sound file that you are wanting to play.

Important: Only put the actual number and not the p#.

3) Recording a Custom Sound

Required Lesson Materials:

Lesson Objectives:

  • Learn about how to input music or sound files from Audicity into Aseba, ultimately into Thymio so that it can be played in Thymio.

Lesson Activity:

  • Download and Install Audacity.
  • Optional: Download and Install Soundflower for Mac to record sound directly from computer
    • Create sound file by watching the Instructional video
Sound file must be named p#.wav, where # is replaced by a number you assign and call in your program using: call sound.play(#)

Extra:

In addition, here’s a list of pre-recorded sound files included to use with your MicroSD.

How to Record Sound Directly from Computer to Audacity with a Mac

Step 1: Configure Soundflower

Click the Apple menu to Open System Preferences on your Mac, select Sounds, switch to the Output tab and set Soundflower (2ch) as the device for sound output. Open the Soundflowerbed app (you can find it through Spotlight) and it will add a Flower item to your menu bar. Click the flower and set Built-in Output for Soundflower 2ch.

Step 2: Configure Audacity

Go to Audacity> Preferences

Switch to the devices tab and select Soundflower (2ch) as the Recording device. Next switch to the Recording tab and select Software Playthrough. You will then be able to listen to the audio while it’s getting recorded inside Audacity. Click OK to save your preferences.

You are now all set to record system audio on your Mac. Play the audio inside any app, switch to Audacity and hit the record button. When you are done, just export the audio as an MP3 file and return your Mac’s sound settings to the original state (set Output as Internal Speakers or Line Out).

Order a sound card from us, we will include a folder full of sound files for you to use with Thymio!

Troubleshooting a Custom Sound that isn’t playing on Thymio

To troubleshoot, first you need to figure out if it is the recorded sound, the fact that the robot hasn’t been restarted, or the code.  So this is the order in which I would troubleshoot.
1) Restart Thymio and make sure you are using the Robot that has the correct Sound Card Inserted that has the sound file transferred to it.
2) In Aseba load the correct code that calls the sound file… call sound.play(#)
3) If it doesn’t work, then create a new program with ONLY the line that calls the sound file….  call sound.play(#)
  • If the sound file plays then the code is wrong
    • Check your code, making sure the sound file is called after the “if statement” and before the ‘end”
  • If the robot just makes a beep noise then the sound was not properly recorded and/or loaded onto the memory card.  To test that this is true, call a sound that you know works on the memory card like call sound.play(22) 
    •  If so, rewatch the video on how to create a custom sound and carefully follow all instructions