let audioContext: AudioContext;
if (typeof window !== 'undefined') {
  audioContext = new (window.AudioContext || (window as any).webkitAudioContext)() as AudioContext;

  // On some browsers, the audioContext starts immediately, i suspect this happens in cases where the site is deemed trustworthy? not sure.
  // adding a `suspend` here to get uniform behavior, but it is probably slightly worse UX on trusted sites.
  // should undo this when we understand what's going on.
  audioContext.suspend();
} else {
  audioContext = {} as AudioContext;
}

export default audioContext;
