title: using WebAudio AnalyserNode.getFloatFrequencyData() to shift pitch of a BufferSource
body: <p>I have a BufferSource, which I create thusly:</p>
  <pre><code>const proxyUrl = location.origin == 'file://' ? 'https://cors-anywhere.herokuapp.com/' : '';
  const request = new XMLHttpRequest();
  request.open('GET', proxyUrl + 'http://heliosophiclabs.com/~mad/projects/mad-music/non.mp3', true);
  // request.open('GET', 'non.mp3', true);
  request.responseType = 'arraybuffer';
  request.onload = () =&gt; {
      audioCtx.decodeAudioData(request.response, buffer =&gt; {
          buff = buffer;
      }, err =&gt; {
          console.error(err);
      });
  }
  request.send();
  </code></pre>
  <p>Yes, the CORS workaround is pathetic, but this is the way I found to be able to work locally without needing to run a HTTP server. Anyway...</p>
  <p>I would like to shift the pitch of this buffer.  I've tried various different forms of this:</p>
  <pre><code>const source = audioCtx.createBufferSource();
  source.buffer = buff;
  
  const analyser = audioCtx.createAnalyser();
  analyser.connect(audioCtx.destination);
  analyser.minDecibels = -140;
  analyser.maxDecibels = 0;
  
  analyser.smoothingTimeConstant = 0.8;
  analyser.fftSize = 2048;
  const dataArray = new Float32Array(analyser.frequencyBinCount);
  source.connect(analyser);
  analyser.connect(audioCtx.destination);
  source.start(0);
  analyser.getFloatFrequencyData(dataArray);
  console.log('dataArray', dataArray);
  </code></pre>
  <p>All to no avail. dataArray is always filled with -Infinity values, no matter what I try.</p>
  <p>My idea is to get this frequency domain data and then to move all the frequencies up/down by some amount and create a new Oscillator node out of these, like this:</p>
  <pre><code>    const wave = audioCtx.createPeriodicWave(real, waveCompnents);
      oscillator.setPeriodicWave(wave);
  </code></pre>
  <p>Anyway.  If anyone has a better idea of how to shift pitch, I'd love to hear it. Sadly, detune and playbackRate both seem to do basically the same thing (why are there two ways of doing the same thing?), namely just to speed up or slow down the playback, so that's not it.</p>