title: Using AudioWorkletProcessor for low-latency audio scheduling?
body: <p>I have an interactive music sequencing application using the following setup:</p>
  <ol>
  <li>User makes changes in UI to manipulate audio node graph.</li>
  <li>A simple WebWorker is responsible for keeping time. It sends a &quot;tick&quot; message to the main thread on a regular interval.</li>
  <li>A listener in the main thread receives the message and performs the next step in the song (playing a sample using AudioBufferSourceNode.start, adjusting volume parameters, etc).</li>
  </ol>
  <p>Having a timer in a WebWorker is more reliable than just using setInterval, but there can still be a delay before the message is processed by the main thread, leading to audio glitches.</p>
  <p>It seems like the ideal solution would be doing step 3 in the WebWorker but <a href="https://github.com/WebAudio/web-audio-api-v2/issues/16" rel="nofollow noreferrer">AudioContext is not supported in workers</a>. So that leaves AudioWorklet as the only low-latency web audio API. But it's a single node in the graph, while I'm looking for a way to manage the whole thing. Other than rewriting the whole system to run in the AudioWorkletProcessor (a lot of work) is there a way to use the processor for accurate scheduling, but keep the existing graph structure?</p>