[jsyn] SampleQueueInputStream not available()?

jsyn at music.columbia.edu jsyn at music.columbia.edu
Mon Aug 15 23:31:20 EDT 2005


Hello,

I'm using SampleQueueInputStream, hoping to keep the last 6 seconds of
sample data in memory at all times, periodically grabbing this data as a
short[] for maniuplation at the Java level.  My (working code for this) is
simply:

SampleWriter_16F1 writer = new SampleWriter_16F1();
writer.input.connect(output);
SampleQueueInputStream inStream = new
SampleQueueInputStream(writer.samplePort, (int) (Synth.getFrameRate() *
    AUDIO_INPUT_BUFFER_SECONDS), 1);
writer.start();
inStream.start(0);

Where output is the SynthOutput I'm interesting in capturing from.

Later I simply call:

short[] audioData = new short[this.bufferSize];
this.inStream.read(audioData,0,this.bufferSize);

(where inStream is my SampleQueueInputStream ) to get the short[] data.

This seems to be working except that periodically the SampleQueueInputStream
is not available(), having very few samples in it.

I'm of course hoping that once this "queue" is filled up w/ 6 seconds of
audio, it more or less stays full, dequeueing samples more than 6 seconds
old while enqueueing new ones as they stream in from the SampleWriter and
thus keeping the queue full.  Is this not how this Class works?  Is there
another, better way to achieve this goal using JSyn?

Thanks for any feedback on this,

C>T>   



More information about the JSyn mailing list