Struggling to generate a sound using createSound();
and here's the code snippet:
function preload(){
s = createAudio('sound.wav')
}
function setup(){
createCanvas(400, 400);
s.play();
}
function draw(){
background(0, 0, 0);
}
Encountering an error:
p5.js:60546 Uncaught (in promise) TypeError: Cannot read property 'src' of undefined at p5.js:60546
Have already tried defining the variable beforehand and introducing a delay before playing the sound, but sadly, the same error persists.