The q5 has been a very important tool in my processes. While p5 was a first step, q5 seems to lead me towards a better understanding of the processes and the possibility of being less and less dependent on a specific library. Thank you!
I'm trying to use the q5 together with the p5 sound and I followed everything that was indicated in the README: I included and linked the q5.p5acl.js in the correct sequence:
I was able to load the audio file using let mySound = addons.loadSound('soundfile.mp3'), but I can't use the same principle as p5 to play the sound: mySound.play().
This is my entire code:
let q5 = new Q5()
let mySound = addons.loadSound("Damscray_DancingTiger.mp3");
q5.setup = () => {
q5.createCanvas(100, 100)
q5.background(0)
}
q5.canvas.addEventListener('click', () => {
console.log('click')
mySound.play()
})
And this is the error on the console:
InvalidStateError: Failed to construct 'AudioWorkletNode': AudioWorkletNode cannot be created: AudioWorklet does not have a valid AudioWorkletGlobalScope. Load a script via audioWorklet.addModule() first. at undefined:2:97382
Am I making a mistake or is some additional code needed?
The q5 has been a very important tool in my processes. While p5 was a first step, q5 seems to lead me towards a better understanding of the processes and the possibility of being less and less dependent on a specific library. Thank you!
I'm trying to use the q5 together with the p5 sound and I followed everything that was indicated in the README: I included and linked the q5.p5acl.js in the correct sequence:
I was able to load the audio file using
let mySound = addons.loadSound('soundfile.mp3')
, but I can't use the same principle as p5 to play the sound:mySound.play()
.This is my entire code:
And this is the error on the console:
InvalidStateError: Failed to construct 'AudioWorkletNode': AudioWorkletNode cannot be created: AudioWorklet does not have a valid AudioWorkletGlobalScope. Load a script via audioWorklet.addModule() first. at undefined:2:97382
Am I making a mistake or is some additional code needed?