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)  



Run your scratch code

To run your code, click the flag button (right side of your code), Shout little bit to change of your size of the sprite😁




Comments

Popular posts from this blog

LOGIC GATE AND LOGIC GATE ICs | BUCKET OF PROJECTS

THE SG90 SERVO MOTOR WITH AN ARDUINO

KUMAR ANADEN AND HE'S GUINNESS WORLD RECORDS | BUCKET OF PROJECTS

Arduino - Ultrasonic Sensor

LOGIC GATE | XOR GATE | BUCKET OF PROJECTS

IMPORTANCE OF READING | BUCKET OF PROJECTS

LOGIC GATE | AND GATE | BUCKET OF PROJECTS

How to Draw a Rectangle using Pygame

Arduino - Led Blink