- This article is about the block. For more information on the value this block reports, see Loudness (value).
| Loudness | |
loudness | |
| Category | Sensing |
| Type | Reporter |
| Introduced in | 26Jun06 (0.x) |
The Loudness block is a Sensing block and a Reporter block. The block reports the loudness of the sound received by the computer's microphone, on a scale of 0 to 100.
To use this block, a microphone must be connected and detected. It does not have to be a dedicated microphone; headsets and earbuds with microphones also work.
Later, a message will appear on the screen, asking for permission to use the microphone. If permission is denied, the block will report a loudness of -1.[1]
This block can be displayed as a Stage Monitor.
Example Uses
Some common uses for the Loudness block are:
- Voice analyzers
wait until <key (space v) pressed?>
if <(loudness) > (30)> then
say [You are a very loud and outgoing person. You like to speak up when there is the need.] for (5) seconds
else
say [You are a timid person, but one to be wary of. There is more than meets the eye.] for (5) seconds
end
- Games with interactions involving noise
say [the baby is sleeping] wait until <(loudness) > (20)> say [you woke the baby!]
- Audio visualizers using the user's microphone
forever
set size to ((100) + (loudness))%
end
- Recording audio. Note that the block doesn't update frequently enough for many uses. For example, at a sample rate of 30 times per second, only sounds up to 15 Hz can be recorded (Nyquist frequency).
reset timer
delete all of [audio samples v]
repeat until <(timer) > [10]>
add (loudness) to [audio samples v]
end