[−][src]Static p5_sys::global::soundFormats
pub static soundFormats: SoundFormatsInternalType
List the SoundFile formats that you will include. LoadSound will search your directory for these extensions, and will pick a format that is compatable with the client's web browser. Here is a free online file converter.
Examples
function preload() {
// set the global sound formats
soundFormats('mp3', 'ogg');
// load either beatbox.mp3, or .ogg, depending on browser
mySound = loadSound('assets/beatbox.mp3');
}
function setup() {
let cnv = createCanvas(100, 100);
background(220);
text('sound loaded! tap to play', 10, 20, width - 20);
cnv.mousePressed(function() {
mySound.play();
});
}
Parameters
formats?
i.e. 'mp3', 'wav', 'ogg'