Loudness (value)

The Loudness value increases or decreases depending on how loud or quiet the sound is that is being detected by the microphone connected to Scratch. If no microphone is connected, the value is constantly 10, 0 or -1. It does not record sound on a recognized scale, but it ranges from 0-100; once it gets to 100, no matter how loud it gets, the value remains at 100.

Related Blocks

The following block can be used in conjunction with this value:

Prior to Scratch 2.0, there was also another block, Loud?.png, that reported true when the loudness exceeded 30. It could be displayed as a stage monitor.

In Scratch 1.3.0, the MIDI note, not just the volume, could be accessed by using the 1.3.0 note block.png block.

Example Uses

Some common uses for the Loudness value:

  • Voice analyzers
  • Depending on how loud a noise is, the greater response
  • Setting a microphone's size to a noise's loudness
  • Loudness graphing

Motion

While the loudness blocks sense microphone input, the Watch Me Move! blocks sense webcam input. Together, they can be used to sense real-life action, as shown below:

when gf clicked
forever
 if < <(video [motion v] on [Stage v]) < [30]> and <(loudness) < [30]>> then
  say [No fun!]
 end
 if < <(video [motion v] on [Stage v]) > [30]> and <(loudness) < [30]>> then
  say [Turn up the volume!]
 end
 if <<(video [motion v] on [Stage v]) < [30]> and <(loudness) > [30]>> then
  say [Start moving!]
 end
 if <<(video [motion v] on [Stage v]) > [30]> and <(loudness) > [30]>> then
  say [Party!]
 end

See Also

  • This page was last modified on 24 July 2017, at 01:13.