Let's emulate night and day with our backgrounds so that each sound changes the scene. Open a new Scratch project and begin:
If you do not have a PicoBoard, do not enable the sensor value block, as it may lock up your Scratch program or your computer.
Let's see what effect yodeling has. If anyone hears you, just blame it on an email you received, like this: "I can't believe someone would send that to me in an email." Your background should strobe to the sound of your yodel.
Click the stop sign to make Scratch stop accepting sound input.
Each time we made a sound, the stage flipped between night and day. Each time the PicoBoard registered a sound, the sensor assigned a numeric value to the sound that was measured on a scale from 0 to 100. Since our script was set to act on any sound greater than 0, we didn't need to be very loud to make the backgrounds switch.
Barely a whisper will make our script swap backgrounds, and that's indicative of the code we used. If the sound sensor value is greater than zero, display the next background. Use the sound sensor value monitor on the stage to find the level of your normal speech. Then, adjust your script to switch to the next background only if the sound sensor value is above the level of normal speech.
The PicoBoard turns the sound we make into a number from 0 to 100, where 0 represents silence. In addition to the sound sensors, the light, slider, and alligator clips use a numeric value to represent the strength of the stimulus.
Using the numeric sound value, we can perform other math functions by supplying the sensor value block as an input value. Think of all the other places we can use a numeric value to affect how our sprites display on the stage. The Motion, Looks, Pen, and Sound palettes all have blocks that take numeric input to transform some feature of a sprite. For example, the move block accepts a number as a way to control how many steps a sprite takes.