This screen cast will show you
how to make your DJ control
the frequency of a repeating sound
using the scroll bars on the screen.
DJs make short sounds called samples
or other musical sounds
into their underlying track
to create a new song.
As a DJ drags the scroll bar,
the sound of the sample speeds up
or slows down.
To start, choose a sample sound
that you wanna mix into your song.
Ya, ya.
Just like with the musical loop track,
you want it to play forever
once the flag is clicked.
Go ahead and add the blocks needed to play the sound forever
and to start runnin' the code
when the flag is clicked.
This block stack probably looks familiar to you.
The starting event block,
when flag clicked,
will start running this stack
when the flag is clicked.
And since there are two of these
both the ya sound and the techno sound
will start when the flag is clicked.
This example shows a forever loop
and the play sound block
that will make the ya sound
keep playing over and over again
once it has started.
Try out your code.
Ya, ya, ya, ya, ya.
That doesn't sound so good,
the ya is playing over and over again
so quickly, no single ya, ever finishes.
Try adding a wait block to space out the sound.
Usually, the best way to solve a problem like this one
is to keep trying blocks
and testin' the code until you find the fix
that works for your program.
Ya,
ya,
ya,
ya.
That's better,
but if you wanna speed up or slow down the ya sound,
you can change the one second
to any number you want, like four.
That works, but it would be too hard
to keep changing that number
while the user is mixing in more sounds.
Computer scientists often build tools others will use,
so, they need to keep the users of their programs in mind
when they build, for example,
the computer scientists who built the DJ mixing tools
you saw in today's starting screen cast,
had to think about making a tool
for the DJs that was both powerful
and easy to use.
Ya. You want this tool
to be as easy to use as possible
for future contestants
in your battle of the DJs.
It is too hard to change the number
to control the speed of the sound
and press the space bar to make the sound
play at the same time.
In the next screen cast,
you'll learn how to make a sliding control
to adjust the speed of your repeating sound.
Now it's your turn.
Add a sound that will play repeatedly
once the green flag is clicked.
Remember, if you get stuck,
you can always ask your neighbor for help.