[−][src]Static p5_sys::global::createConvolver
pub static createConvolver: CreateConvolverInternalType
Create a p5.Convolver. Accepts a path to a soundfile that will be used to generate an impulse response.
Examples
let cVerb, sound;
function preload() {
// We have both MP3 and OGG versions of all sound assets
soundFormats('ogg', 'mp3');
// Try replacing 'bx-spring' with other soundfiles like
// 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'
cVerb = createConvolver('assets/bx-spring.mp3');
// Try replacing 'Damscray_DancingTiger' with
// 'beat', 'doorbell', lucky_dragons_-_power_melody'
sound = loadSound('assets/Damscray_DancingTiger.mp3');
}
function setup() {
let cnv = createCanvas(100, 100);
cnv.mousePressed(playSound);
background(220);
text('tap to play', 20, 20);
// disconnect from master output...
sound.disconnect();
// ...and process with cVerb
// so that we only hear the convolution
cVerb.process(sound);
}
function playSound() {
sound.play();
}
Parameters
path
path to a sound file
callback?
function to call if loading is successful.
The object will be passed in as the argument
to the callback function.
errorCallback?
function to call if loading is not successful.
A custom error will be passed in as the argument
to the callback function.