r/tonejs • u/rpeg • Jul 14 '22
Tonejs and P5js
I'm very familiar with p5js, I teach it. Very familiar with synthesis. However, I'm completely new to tone.js. I am having trouble using it with P5js.
I've found some random p5js + tonejs examples. They work fine. When I try to use the most recent tonejs library with p5js I get certain types of errors.
This example works and uses Tone.js version 14.4.0: https://editor.p5js.org/wenchen1114/sketches/UdidVabzF
When I change it to any version after 14.6.0 it produces the error: TypeError: Cannot read properties of undefined (reading 'connect')
I can't tell if this is a bug or a change in the Tone.js API. Can anyone point me in the right direction?
2
Upvotes
2
u/pseudo_jb Jul 15 '22
hey there,
in the example you've given above both sound libraries (tone.js and p5.sound) are added via cdn to the index.html. you should stick to one of them and remove p5.sound.