Exemplo n.º 1
0
 @Override
 public boolean process(AudioEvent audioEvent) {
   float[] audioFloatBuffer = audioEvent.getFloatBuffer();
   float[] transformbuffer = new float[bufferSize * 2];
   System.arraycopy(audioFloatBuffer, 0, transformbuffer, 0, audioFloatBuffer.length);
   fft.forwardTransform(transformbuffer);
   fft.modulus(transformbuffer, amplitudes);
   panel.drawFFT(pitch, amplitudes, fft);
   panel.repaint();
   return true;
 }
Exemplo n.º 2
0
  @Override
  public boolean process(AudioEvent audioEvent) {
    float[] audioFloatBuffer = audioEvent.getFloatBuffer();
    int overlap = audioEvent.getOverlap();

    for (int i = overlap; i < audioFloatBuffer.length; i++) {
      if (position >= echoBuffer.length) {
        position = 0;
      }

      // output is the input added with the decayed echo
      audioFloatBuffer[i] = audioFloatBuffer[i] + echoBuffer[position] * decay;
      // store the sample in the buffer;
      echoBuffer[position] = audioFloatBuffer[i];

      position++;
    }

    applyNewEchoLength();

    return true;
  }