title: AudioContext on Safari
body: <p>Yesterday, I had <a href="https://stackoverflow.com/questions/29356041/createoscillator-noteon-not-working">a question about the noteOn method of the AudioContext object</a>.
  I've gotten myself all turned around now on this AudioContext object.
  Here's what I've tried and their associated error messages in Safari on my desktop:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> var ctx
  // ctx = new(AudioContext || webkitAudioContext); // ReferenceError: Can't find variable: AudioContext
  // ctx = new(audioContext || webkitAudioContext); // ReferenceError: Can't find variable: audioContext
  // ctx = new(window.AudioContext || webkitAudioContext); // ReferenceError: Can't find variable: webkitAudioContext
   ctx = new(window.AudioContext || window.webkitAudioContext);
  // TypeError: 'undefined' is not a constructor (evaluating 'new(window.AudioContext || window.webkitAudioContext)')</code></pre>
  </div>
  </div>
  </p>
  
  <p>Q: How do I define myAudioContext such that it works on all browsers?</p>