* 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
1.3 KiB
set Silence Level
Set the level for audio pin output during periods of silence.
music.setSilenceLevel(1000)
~ reminder
This function requires the micro:bit V2 hardware. If you use this function with a micro:bit v1 board, you will see the 927 error code on the screen.
~
Normally the output signal level at the audio pin is 0
when no sounds are playing. This is the silence level and it stays constant since actual tones have varying levels over a period of time. Some devices (headphones, external speakers, etc.) which are sensitive to slight signal changes might play sounds from signal noise encountered along the connection between the audio pin and the audio device.
To reduce the effect of this signal noise it can be helpful to set an constant signal level for silence that is greater than 0
.
Parameters
- level: a number between
0
and1024
to use as the silence level for the audio pin output when no sounds are playing. The default level is0
.
Example #example
Set silence level to 512
for the current audio pin.
pins.setAudioPin(AnalogPin.P1)
music.setSilenceLevel(512)
See also
music