title: Webaudio: record audio after loud syncing sound
body: <p>I am building a web app which records audio from the microphone directly after its hears a loud syncing noise (like a clap). I am looking for a solution that will work for chrome on desktop and android.</p>
  <p>I have tried the following approaches</p>
  <ol>
  <li>use a scriptprocessor node which listens to the microphone and detects a loud node and saves the raw data directly after.</li>
  </ol>
  <p>This approach does work. But the audio recorded is rubbish and glitchy due to the node running in the main thread and dropping frames.</p>
  <ol start="2">
  <li>Use an audioWorklet to put the audio processing in a different thread and send the recorded data back to the main thread using the port.</li>
  </ol>
  <p>This approach works much better. It works on chrome desktop.  But the recorded audio sounds rubbish on android. I raised a issue on chrome see the ticket <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=1180844#c6" rel="nofollow noreferrer">here</a></p>
  <p>Does anyone have any other approaches they would suggest? Perhaps by using a MediaRecorder somehow? However with this we don't have access to the raw audio so can't tell if the loud syncing sound has been played, unless there is some clever way.</p>
  <p>Please note I am not interested in a approach which syncs postrecording.</p>
  <p><strong>Update</strong></p>
  <p>Using a script proccessor node to listen for the loud clap and trigger the MediaRecorder to start is a great solution!</p>