Skip to content

Commit

Permalink
Removed test code from STFT pitch shifter.
Browse files Browse the repository at this point in the history
  • Loading branch information
JorenSix committed Mar 3, 2015
1 parent e2898c2 commit 48dbe5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 187 deletions.
158 changes: 0 additions & 158 deletions src/core/be/tarsos/dsp/FunkyModulator.java

This file was deleted.

37 changes: 8 additions & 29 deletions src/core/be/tarsos/dsp/PitchShifter.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package be.tarsos.dsp;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;

import be.tarsos.dsp.io.TarsosDSPAudioFloatConverter;
import be.tarsos.dsp.io.jvm.AudioDispatcherFactory;
import be.tarsos.dsp.io.jvm.JVMAudioInputStream;
import be.tarsos.dsp.util.fft.FFT;

/**
Expand Down Expand Up @@ -38,11 +31,13 @@ public class PitchShifter implements AudioProcessor{

private double excpt;

/*
private SourceDataLine line;

TarsosDSPAudioFloatConverter converter;
*/

public PitchShifter(double sampleRate, int size, int overlap) throws LineUnavailableException{
/*
AudioFormat format = new AudioFormat((float) sampleRate, 16, 1, true, true);
converter = TarsosDSPAudioFloatConverter.getConverter(JVMAudioInputStream.toTarsosDSPFormat(format));
Expand All @@ -51,7 +46,9 @@ public PitchShifter(double sampleRate, int size, int overlap) throws LineUnavail
line = (SourceDataLine) AudioSystem.getLine(info);
line.open();
line.start();
*/

this.size = size;
this.sampleRate = sampleRate;
Expand Down Expand Up @@ -182,36 +179,18 @@ public boolean process(AudioEvent audioEvent) {

System.arraycopy(outputAccumulator, stepSize, outputAccumulator, 0, size);


/*
byte[] out = new byte[output.length*2];
converter.toByteArray(output, out);
line.write(out, 0, out.length);
*/





return true;
}

@Override
public void processingFinished() {

}

public static void main(String... args) throws LineUnavailableException{
int sampleRate = 44100;
int bufferSize = 2048;
int overlap = bufferSize-bufferSize/4;//75% overlap

AudioFormat format = new AudioFormat((float) sampleRate, 16, 1, true, true);

//converter = TarsosDSPAudioFloatConverter.getConverter(JVMAudioInputStream.toTarsosDSPFormat(format));

//AudioDispatcher adp = AudioDispatcherFactory.fromPipe("/home/joren/Desktop/02 My Ship.mp3", sampleRate, bufferSize,overlap);
AudioDispatcher adp = AudioDispatcherFactory.fromDefaultMicrophone(bufferSize, overlap);
adp.addAudioProcessor(new PitchShifter(sampleRate, bufferSize,overlap));
//adp.addAudioProcessor(new AudioPlayer(format));
adp.run();
}

}

0 comments on commit 48dbe5c

Please sign in to comment.