Your robot has an on-board speaker. You've already made some sounds using it but they've used simple tones. We can actually play digital recorded sounds from 'WAV' files.
Your robot has an on-board speaker. You've already made some sounds using it but they've used simple tones. We can actually play digital recorded sounds from 'WAV' files.
We're going to use an online sound effect creator to make some sound effects. Go to https://sfxr.me/
To get an idea of the sort of sounds it can create, click on the Random button, or try clicking one one of the sound types below this button. For example,clicking on 'Explosion' might be a good starting point for a crash sound for your robot.
By changing the sliders on the right you can customise the sound. Spend a few minutes experimenting with these sliders. If you want to see some tips, read on ...
The top 'Envelope' sliders affect the length of your sound. The start of the sound is called the 'attack', the middle is called the 'sustain', and the end is called the 'decay'. You can adjust all of these independently.
The 'frequency' sliders below this affect the pitch. If you set a 'slide', the pitch will change as the note plays. This is good for something like a siren sound.
The 'retrigger' will make the sound repeat. This is also useful for siren-type sounds.
The 'gain' controls the loudness of the sound
You need to create three sound effects:
When you've created each sound, you'll need to download the 'wav' files. Make sure you've selected the '8 bit' and '6k' options shown and then click on the filename to download.
To upload your files to the robot, you'll need to click on the 'Files' tab.
If you click on the 'Refresh' icon shown, you'll see what existing files are stored in your robot's memory.
Use the button shown to upload each file.
To see and select the 'WAV' file you have downloaded, you'll need to select 'All Files' as shown.
To play the sound, find this block and change the name of 'sound.wav' to the filename of the 'WAV' file that you have downloaded.
Give it a try by running your program. The tiny speaker on the robot is pretty quiet but hopefully you can recognise your sound!
You're now going to make a remote-control robot with sound effects. This is what it should do: