open-audiovisual
Search GitHub

oav-p5 reference · Microphone and audio analysis

OAVp5.mic.level#

variableoav-p5
OAVp5.mic.level

The same 0 to 1 loudness as micLevel, read without ever turning the microphone on.

micLevel is a getter that returns this number and, the first time it is read, asks for the microphone. OAVp5.mic.level is the number itself, so reading it is safe anywhere: before the user has chosen, with ?oav_mic=click, or in a library. Start the microphone with startMic() or 🎤, then it moves. How it is measured (decibels, the room as zero, −10 dBFS as 1) is described under micLevel.

Type
Number
Range
0..1

Updated once per display frame while the microphone is on; 0 while it is off, asking, blocked or missing.

Examples

jsOpenProcessing ↗
function setup() {
  createCanvas(400, 300);
  startMic();
}

function draw() {
  background(20);
  circle(width / 2, height / 2, 50 + OAVp5.mic.level * 300);
}
The loudness circle, written with the raw number instead of micLevel. Allow the microphone and talk. Asks for the microphone

Related

  • micLevel How loud the microphone hears things, from 0 (a quiet room) to 1 (shouting).
  • OAVp5.mic.rms The raw loudness of the microphone: a smoothed RMS, 0 to 1, before oav-p5 turns it into the decibel scale of micLevel.
  • OAVp5.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.
  • OAVp5.mic.floor The room's own noise as oav-p5 has measured it, in dBFS: the level that micLevel treats as silence (plus 6 dB).
  • startMic() Turns the microphone on and returns a promise that says whether it worked.

p5/oav-p5.js, line 899

↑ Back to top · All names