Skip to content

Template 4: p5js and pd4web

Template designed for those who know how to program

Learn how to program, I really recommend watch the Coding Train channel. It is a great channel to learn how to program in a fun way.

This template is for the combination of p5js and pd4web. It is a simple template that uses the p5js library to create a canvas and pd4web to create a patch that can be used to control the canvas (or vice-versa).

Download Patch Template

There is no much to say about this template, it just use a personalized index.html and sketch.js, where you can code you p5js code.

Just download and have fun. If you have any question, please, let me know. If you have some questions about p5js or pd4web you can ask me too. I will be glad to help you.

Always check if Pd4Web is defined and not null

Always check if the Pd4Web object is defined before using it. This is because the Pd4Web object is only defined when the patch is loaded, which happens when the user click in the sound icon.

if (Pd4Web !== null && typeof Pd4Web !== "undefined") {
  Pd4Web.sendList("myList ", [1, 2, 3]);
}