title: RealTime Pitch Shifting using TarsosDSP on Android
body: <p>Here is what I want : <br>
  1. Real time pitch shift while playing song.<br>
  2. Pitch shift should also be recorded to a file.</p>
  
  <p>code : </p>
  
  <pre><code>    double rate = 1.0;
      RateTransposer rateTransposer;
      AudioDispatcher dispatcher;
      WaveformSimilarityBasedOverlapAdd wsola;
  
      dispatcher = AudioDispatcherFactory.fromPipe(mAudiopath, 44100, 5000, 2500);
      rateTransposer = new RateTransposer(rate);
      wsola = new WaveformSimilarityBasedOverlapAdd(WaveformSimilarityBasedOverlapAdd.Parameters.musicDefaults(rate, 44100));
      WaveformWriter writer = new WaveformWriter((TarsosDSPAudioFormat) dispatcher.getFormat(), BASE_PATH + "Recorded" + File.separator + "PITCHED_" + mVideoFileName + ".mp3");
  
      wsola.setDispatcher(dispatcher);
      dispatcher.addAudioProcessor(wsola);
      dispatcher.addAudioProcessor(rateTransposer);
      dispatcher.addAudioProcessor(new AndroidAudioPlayer(dispatcher.getFormat()));
      dispatcher.setZeroPadFirstBuffer(true);
      dispatcher.setZeroPadLastBuffer(true);
      dispatcher.addAudioProcessor(writer);
  </code></pre>
  
  <p>But here I am facing following error : </p>
  
  <pre><code>Error:(362, 41) error: cannot access AudioFormat
  class file for javax.sound.sampled.AudioFormat not found
  </code></pre>
  
  <p>for line </p>
  
  <pre><code>   WaveformWriter writer = new WaveformWriter((TarsosDSPAudioFormat) dispatcher.getFormat(), BASE_PATH + "Recorded" + File.separator + "PITCHED_" + mVideoFileName + ".mp3");
  </code></pre>
  
  <p>If I remove this line everything works fine only song is not recorded to file.<br>
  Please let me know if someone could help.</p>