title: How to use p5.js sound in instance mode
body: <p>I'm trying to make a website with multiple p5 canvases on the same page, so after a lot of research, I came to the conclusion that the most adequate way to do that is by using instance mode on p5.
  I spent the whole day trying to understand the instance mode, i even found a converter online that converts it for me, but I'm trying to do it all by my self using it just to check errors. The problem is that i can't find a way to use sound in my sketch using instance mode. the code i have is a lot more complex, but even trying just the basic it still does not work.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var s = function(p) {
  
    let song;
  
    p.preload = function() {
      p.song = load('thunder.mp3')
    }
  
    p.setup = function() {
      p.createCanvas(720, 200);
      p.background(255, 0, 0);
      p.song.loop();
    };
  
  };
  
  var myp5 = new p5(s, 'c1');</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html, body {
    margin: 0;
    padding: 0;
  }
  canvas {
    display: block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"&gt;&lt;/script&gt;
      &lt;script language="javascript" type="text/javascript" src="sketch.js"&gt;&lt;/script&gt;
      &lt;style&gt; body {padding: 0; 
          margin: 0;
      } 
        &lt;meta charset="UTF-8"&gt;
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="c1"&gt;&lt;/div&gt; &lt;br&gt;
      &lt;div id="c2"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  
  you can test it here: <a href="https://editor.p5js.org/jgsantos.dsn/sketches/rUWb6Nurt" rel="nofollow noreferrer">https://editor.p5js.org/jgsantos.dsn/sketches/rUWb6Nurt</a></p>
  <p>This code works great in the global mode:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let song;
  
  function preload() {
    song = loadSound('thunder.mp3');
  }
  
  function setup() {
    createCanvas(720, 200);
    background(255,0,0);
    song.loop();
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>html, body {
    margin: 0;
    padding: 0;
  }
  canvas {
    display: block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
    &lt;head&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"&gt;&lt;/script&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
      &lt;meta charset="utf-8" /&gt;
  
    &lt;/head&gt;
    &lt;body&gt;
      &lt;script src="sketch.js"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  
  You can test it here <a href="https://editor.p5js.org/jgsantos.dsn/sketches/_lQcDqOsp" rel="nofollow noreferrer">https://editor.p5js.org/jgsantos.dsn/sketches/_lQcDqOsp</a></p>
  <p>It shows this error: &quot;Uncaught ReferenceError: load is not defined (: line 9)&quot;
  What am I'm doing wrong?
  Thanks in advance!</p>