tone#
optionoav-p5?oav_tone=an ES module URL
Where Tone.js, the sound engine behind startSound(), is loaded from: an ES module address. Empty means jsDelivr.
Sound (startSound(), the sound option, the 🔊 button) uses Tone.js 15, which oav-p5 loads the first time sound is wanted. By default it comes from jsDelivr. Point tone at your own copy when the page is behind a school firewall or an ad blocker that stops the CDN, or when you serve everything yourself. If it cannot be loaded, a card says which host was unreachable and what to try.
- Type
String (URL)- Values
an ES module URL- default
'' (jsDelivr)
The address of Tone.js version 15 as an ES module. Left empty, it is https://cdn.jsdelivr.net/npm/tone@15.0.4/+esm, and OAVp5.options.tone reads ''.
Notes
- Set it before oav-p5 loads.
window.OAV_P5 = { tone: … };above the loader line wins, then?oav_tone=…on the page address, then?tone=…on the script's own URL. Values inwindow.OAV_P5are turned into text, so write'off', notfalse. On OpenProcessing the page address takes?sketch_oav_tone=…(the project's README says OpenProcessing forwards it to the sketch).
Examples
window.OAV_P5 = { tone: 'https://cdn.jsdelivr.net/npm/tone@15.0.4/+esm' };
function setup() {
createCanvas(400, 300);
}
function draw() {
background(20);
fill(255);
text('Tone.js from: ' + OAVp5.options.tone, 20, 30); // the address here is the built-in one
}Related
soundWhether notes are heard:click(only afterstartSound()or 🔊),off(never), or an instrument id that starts at the first click.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.