xxxxxxxxxx
31
let cVerb, sound;
function preload() {
// We have both MP3 and OGG versions of all sound assets
// Try replacing 'bx-spring' with other soundfiles like
// 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'
cVerb = createConvolver('assets/forks.wav');
// Try replacing 'Damscray_DancingTiger' with
// 'beat', 'doorbell', lucky_dragons_-_power_melody'
sound = loadSound('assets/drill_bit.wav');
}
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();
}