# Activity 1 - Set tempo & add sounds

Workshop Resources

Let’s take a closer look at the pre-existing code and understand what it means. We will be placing our new code between the setTempo() and finish() functions. The setTempo() function allows you to set the overall project tempo.

## Activity 1

1. Now that our tempo is set, it is time to add sounds. To do so, we must utilize the fitMedia() function.
2. Make sure the cursor in your program is between setTempo() and finish() functions.
3. Navigate to the Api Browser icon on the left side menu. Scroll through the list to the fitMedia() function.
4. Click on Paste icon on the right corner of fitMedia() to insert the function between the setTemp and finish functions.
5. You may notice that when you paste the function, Earsketch produces some placeholder texts that we will need to replace later. These placeholder texts are also known as parameters.

You can specify your own values for the following:

• fileName - Navigate to the 'Sounds' pane and find a sound you like.
• trackNumber - Select any positive integer as the track number.
• startLocation/endLocation - These parameters are quantified in measures. A measure is a segment of time which correlates to a specific number of beats.

If you are not sure what values to choose, try this:

• fitMedia(YG_TRAP_ELECTRIC_PIANO_FILTERED_1, 3, 1, 17)

Your code should now look something like this:

1. Once you have input your own parameters, press run, then click on play to listen to your audio clip!
• If you see any red text, you have encountered some errors! Please ask for help. The fitMedia() function is the backbone to making music in Earsketch. We will be using this function a lot, so if you have any questions regarding its usage, please ask!