Your browser version is not supported by this site. CS First may not work properly. Learn more.
3. Add a Repeating Sound
This screen cast will show youhow to make your DJ controlthe frequency of a repeating soundusing the scroll bars on the screen.
DJs make short sounds called samplesor other musical soundsinto their underlying trackto create a new song.
As a DJ drags the scroll bar,the sound of the sample speeds upor slows down.
To start, choose a sample soundthat you wanna mix into your song.
Just like with the musical loop track,you want it to play foreveronce the flag is clicked.
Go ahead and add the blocks needed to play the sound foreverand to start runnin' the codewhen the flag is clicked.
This block stack probably looks familiar to you.
The starting event block,when flag clicked,will start running this stackwhen the flag is clicked.
And since there are two of theseboth the ya sound and the techno soundwill start when the flag is clicked.
This example shows a forever loopand the play sound blockthat will make the ya soundkeep playing over and over againonce 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 againso 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 oneis to keep trying blocksand testin' the code until you find the fixthat works for your program.
That's better,but if you wanna speed up or slow down the ya sound,you can change the one secondto any number you want, like four.
That works, but it would be too hardto keep changing that numberwhile 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 mindwhen they build, for example,the computer scientists who built the DJ mixing toolsyou saw in today's starting screen cast,had to think about making a toolfor the DJs that was both powerfuland easy to use.
Ya. You want this toolto be as easy to use as possiblefor future contestantsin your battle of the DJs.
It is too hard to change the numberto control the speed of the soundand press the space bar to make the soundplay at the same time.
In the next screen cast,you'll learn how to make a sliding controlto adjust the speed of your repeating sound.
Now it's your turn.
Add a sound that will play repeatedlyonce the green flag is clicked.
Remember, if you get stuck,you can always ask your neighbor for help.
Choose a new sample sound to mix over the background track.
Program the sample sound to play continuously.
Add a "wait" block to slow down the speed of the sample.