OAVp5.sound.error#
variableoav-p5OAVp5.sound.error
The message of the last thing that went wrong while loading sound, or null when nothing has.
It is the error the browser reported when @openav/sound or Tone.js could not be loaded. A card beside the 🎹 already tells the person at the keyboard what to do (try another network, or point the tone option at another copy of Tone.js); read this value to log it or to show your own message. To know whether sound is failing right now, use OAVp5.sound.state, not this.
- Type
String | null
Set when the state becomes 'error'. It stays until the page is reloaded: a later try that works does not clear it.
Examples
function setup() {
createCanvas(400, 300);
startSound('strings');
textAlign(CENTER, CENTER);
}
function draw() {
background(OAVp5.sound.error ? color(120, 30, 30) : 20);
fill(255);
text(OAVp5.sound.error ? OAVp5.sound.error : 'no error', width / 2, height / 2);
}Related
OAVp5.sound.stateWhere sound is:'off','waiting'(for a click),'loading','on'or'error'.startSound()Makes the keys you play heard through an instrument you name, and returns a promise that says whether sound is on.soundIsOnWhether notes are being heard right now: true oncestartSound()has finished, false before and after.