O'Reilly logo

Scratch Cookbook by Brandon Milonovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Integrating the sound sensor

The sound sensor can be a useful tool in getting your program to interact with the outside environment.

Just like the other blocks we've used so far, the sound returns a value between 0 and 100. It is simply a measure of how loud the area around the sensor is, and it is not a microphone.

Getting ready

In this recipe we are going to explore the sound sensor by making the cat make a meow sound when a loud noise is detected by the sensor. To prepare for this, all you need to do is open a new Scratch file.

How to do it...

Here are the steps we'll need to get this going:

  1. Drag over a How to do it... block.
  2. Similar to the forever loop we've used ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required