Skip to content

Commit

Permalink
cq
Browse files Browse the repository at this point in the history
  • Loading branch information
jimomulloy committed Jul 21, 2024
1 parent d7d16ee commit 2c28f25
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void playFrameSequence(ToneTimeFrame toneTimeFrame, String streamId, int
AudioFeatureFrame aff = afp.getAudioFeatureFrame(sequence);
TreeMap<Double, ResynthInfo> features = aff.getResynthFeatures()
.getFeatures();

AudioQueueMessage audioQueueMessage = new AudioQueueMessage(toneTimeFrame, features, sequence);

audioStream.bq.add(audioQueueMessage);
Expand Down Expand Up @@ -262,7 +262,7 @@ public AudioStream(String streamId) {
generator = new AudioGenerator(ResynthAudioSynthesizer.this.getWindowSize(), 0);
try {
generator.addAudioProcessor(resynthProcessor);
generator.addAudioProcessor(new AudioPlayer(new AudioFormat(44100, 16, 1, true, true)));
generator.addAudioProcessor(new AudioPlayer(new AudioFormat(44100, 16, 1, true, false)));
} catch (LineUnavailableException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,7 @@ public void run() {
// if (audioEvent.getEndTimeStamp() == time) {
this.audioStream.getGenerator()
.process();
if (count > 0) {
LOG.severe(
">>Audio gen process COUNT: " + time + ", " + count + ", " +
audioEvent.getTimeStamp());
}
count++;
LOG.severe(">>Audio gen process: " + time + ", " +
audioEvent.getTimeStamp());
audioEvent = this.audioStream.getGenerator()
.getAudioEvent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void initialise() {
binWidth = windowSize / sampleRate;
binHeight = 1200 / (float) binsPerOctave;

TarsosDSPAudioFormat tarsosDSPFormat = new TarsosDSPAudioFormat(sampleRate, 16, 1, true, true);
TarsosDSPAudioFormat tarsosDSPFormat = new TarsosDSPAudioFormat(sampleRate, 16, 1, true, false);
DispatchJunctionProcessor djp = new DispatchJunctionProcessor(tarsosDSPFormat, windowSize, overlap);
djp.setName("PD");
dispatcher.addAudioProcessor(djp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public ResynthSource(AudioDispatcher dispatcher) {
this.usePureSine = true;
previousFrequencies = new double[5];
previousFrequencyIndex = 0;
LOG.finer(">>RS window: " + this.windowSize);
}

public ResynthSource(AudioDispatcher dispatcher, int bufferSize) {
Expand Down Expand Up @@ -114,7 +113,7 @@ public float getSampleRate() {
}

void initialise() {

LOG.severe(">>!!RS init: " + this.windowSize);
PitchEstimationAlgorithm algo = PitchEstimationAlgorithm.FFT_YIN;

binStartingPointsInCents = new float[windowSize];
Expand All @@ -128,7 +127,7 @@ void initialise() {
binWidth = windowSize / sampleRate;
binHeight = 1200 / (float) binsPerOctave;

TarsosDSPAudioFormat tarsosDSPFormat = new TarsosDSPAudioFormat(sampleRate, 16, 1, true, true);
TarsosDSPAudioFormat tarsosDSPFormat = new TarsosDSPAudioFormat(sampleRate, 16, 1, true, false);
DispatchJunctionProcessor djp = new DispatchJunctionProcessor(tarsosDSPFormat, windowSize, overlap);
djp.setName("RS");
dispatcher.addAudioProcessor(djp);
Expand All @@ -141,6 +140,7 @@ public boolean process(AudioEvent audioEvent) {
.clone();
ResynthInfo ri = new ResynthInfo(audioFloatBuffer, envelopeAudioBuffer);
putFeature(audioEvent.getTimeStamp(), ri);
LOG.severe(">>!!RS process");
return true;
}

Expand All @@ -156,7 +156,7 @@ public void processingFinished() {
@Override
public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) {
double frequency = pitchDetectionResult.getPitch();

LOG.severe(">>!!RS handlePitch: " + audioEvent.getTimeStamp());
if (frequency == -1) {
frequency = prevFrequency;
} else {
Expand All @@ -180,6 +180,7 @@ public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent au
envelopeAudioBuffer = audioEvent.getFloatBuffer()
.clone(); // !!TODO CLONED
float[] envelope = null;
LOG.severe(">>!!RS handlePitch ENVELOP: " + audioEvent.getTimeStamp());
if (followEnvelope) {
envelope = envelopeAudioBuffer.clone();
envelopeFollower.calculateEnvelope(envelope);
Expand Down

0 comments on commit 2c28f25

Please sign in to comment.