pxt-calliope/docs/reference/input/sound-level.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

546 B

sound Level

Find out what the the level of sound heard by the microphone is.

input.soundLevel()

Returns

  • a number between 0 (low sound) and 255 (loud sound) which tells how loud the sounds are that the microphone hears.

Example

Show a checkerboard icon while the sound level is greater than 100.

basic.forever(function () {
    if (input.soundLevel() > 100) {
        basic.showIcon(IconNames.Chessboard)
    } else {
        basic.clearScreen()
    }
})

See also

microphone