Scratch - How to Change the Size of Sprite According to the Loudness
How to Change the Size of Sprite According to the Loudness
Hello guys. In this blog we are going to see about changing sprite size according to the loudness input given to the microphone
Coding with Blocks
1) Lets place "when flag clicked" Block from "Events panel". The "when flag clicked" Block triggers the Blocks/Block code connected to it below.
2) Now lets place "forever" Block from "Control" panel. The Blocks/Block inside the "forever" Block
will run continuously.
3) Now lets place "set size to _" Block from "Looks". The "set size to _" Block sets the size of sprite for giving value, here cat is the sprite. Play around by changing the value of it's size.
Note - "forever" is used here to change the value of "set size to_" Block continuously. It will be needed in 4th step and 5th step.
4) Now drag and drop "_*_" Block inside "set size to _" value area from "Operators" panel. It multiplies two values from each side.
5) Now drag and drop "loudness" Block inside the value area from "Sensing" panel. This Block gets value (0% - 100%) loudness value form microphone. After placing "loudness". Type value 2 to the remaining empty area in a multiplication operation (To check value of the loudness value in the corner, tick the loudness option)
Comments
Post a Comment