1

So I know that with JS and a lot of JS frameworks you can simply do the following to put your sketch into html:

<script src="FirstScript.js"></script>
<script src="SecondScript.js"></script>

and so on.

But in Processing, you do the following:

<canvas id="your-id-here" data-processing-sources="Code.pde"></canvas>

Since it is inside the canvas, you can't add multiple files. I have looked around and haven't found a solution.

If it matters, I am trying to link a sound file. How can I do this?

Also, I know I could just switch over to some other JS framework, like p5, but I would rather stay in Processing.

Daneel Rakow
  • 81
  • 1
  • 1
  • 9
  • You can load the audio file at an ` – guest271314 Dec 11 '16 at 03:31

1 Answers1

0

In order to load multiple pde files in a webpage by using processing.js library, you can simply mention all the files inside the data-processing-sources tag.

e.g. <canvas id="your-id-here" data-processing-sources="file1.pde file2.pde"></canvas>

For playing sounds in processing.js you can use a java-to-javascript binding workaround:

https://funprogramming.org/141-Processing-js-with-sound-audio-I.html https://funprogramming.org/142-Processing-js-with-sound-audio-II.html

ovidiu-miu
  • 57
  • 2
  • 9