OAVp5.mic.db#
variableoav-p5OAVp5.mic.db
The loudness of the microphone in decibels relative to full scale (dBFS): 0 is as loud as it gets, −100 is silence or the microphone being off.
Decibels are what an ear hears: each 6 dB is twice the amplitude, so a number in dB moves the way loudness feels. micLevel maps it onto 0 to 1 between the room's noise floor (+6 dB) and −10 dBFS. Use db directly when you want your own scale, for example map(OAVp5.mic.db, -60, -10, 0, 1).
- Type
Number- Range
-100..0
20 * log10(rms), measured from OAVp5.mic.rms. −100 when the level is below about −100 dB and while the microphone is off. Updated once per display frame.
Examples
function setup() {
createCanvas(400, 300);
startMic();
}
function draw() {
background(20);
fill(255);
text(nf(OAVp5.mic.db, 1, 1) + ' dBFS', 20, 30);
const own = constrain(map(OAVp5.mic.db, -60, -10, 0, 1), 0, 1); // an own scale: -60 dB to -10 dB
circle(width / 2, height / 2, 50 + own * 300);
}Related
OAVp5.mic.rmsThe raw loudness of the microphone: a smoothed RMS, 0 to 1, before oav-p5 turns it into the decibel scale ofmicLevel.OAVp5.mic.floorThe room's own noise as oav-p5 has measured it, in dBFS: the level thatmicLeveltreats as silence (plus 6 dB).OAVp5.mic.levelThe same 0 to 1 loudness asmicLevel, read without ever turning the microphone on.micLevelHow loud the microphone hears things, from 0 (a quiet room) to 1 (shouting).