From jsyn at music.columbia.edu Tue Nov 11 17:07:12 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Tue Nov 11 16:05:19 2008 Subject: [jsyn] Waking a sleeping Synth thread In-Reply-To: <4908F7B2.2080002@softsynth.com> Message-ID: Hello, I'm using Synth.sleepUntilTick() in a loop. I would like to have the option to respond to a method call to preemptively wake up the Synthesis thread after calling this method before the specified tick count has been reached, in essence interrupting the sleep call [like a notify() method]. Is there a good way to do this? Call sleepUntilTcik() again with the current time perhaps? Thanks, C>T> From jsyn at music.columbia.edu Tue Nov 11 17:31:04 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Tue Nov 11 17:31:14 2008 Subject: [jsyn] Waking a sleeping Synth thread In-Reply-To: References: Message-ID: <491A07A8.3010406@softsynth.com> Any Thread can call Synth.sleepUntilTick(n). Any other Thread can wake it up by calling thatThread.interrupt(). This will generate an InterruptedException in the sleeping thread . Unfortunately I catch that inside the sleepUntilTick() method. (I wrote that in 1997.) But then the method returns and you can check the time or look for a flag set by your other thread. Thank you, Phil Burk --------------------------------------- SoftSynth, Audio Research and Development http://www.softsynth.com/ 75 Pleasant Lane, San Rafael, CA, 94901 USA Office: +1-415-453-4320 Mobile: +1-415-846-4370 FAX: +1-415-373-4428 --------------------------------------- jsyn@music.columbia.edu wrote: > Hello, > > I'm using Synth.sleepUntilTick() in a loop. > > I would like to have the option to respond to a method call to preemptively > wake up the Synthesis thread after calling this method before the specified > tick count has been reached, in essence interrupting the sleep call [like a > notify() method]. Is there a good way to do this? Call sleepUntilTcik() > again with the current time perhaps? > > Thanks, > > C>T> > > _______________________________________________ > JSyn mailing list > JSyn@music.columbia.edu > To change digest mode or to make other administrative changes visit: > http://music.columbia.edu/mailman/listinfo/jsyn > > From jsyn at music.columbia.edu Tue Nov 18 18:39:19 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Tue Nov 18 17:37:25 2008 Subject: [jsyn] Signal value triggers event In-Reply-To: <4908ECF6.5060109@softsynth.com> Message-ID: Hello, I'd like to call one of my SynthCiruit sub-class' methods when an incoming signal goes above a certain value, e.g. Detecting when a pulse goes above zero and then immediately executing some code. As I see it, either there is some Jsyn comparator unit that will provide a Java call-back I can register with when a certain signal condition is met (I don't think this is the case), or I have to constantly be polling this incoming signal from another thread to see if the trigger condition has been met. That would be unfortunate. Any other thoughts I may have missed? Thanks! C>T> From jsyn at music.columbia.edu Tue Nov 18 19:08:19 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Tue Nov 18 19:08:37 2008 Subject: [jsyn] Signal value triggers event In-Reply-To: References: Message-ID: <492358F3.8070200@softsynth.com> Hello C>T> Unfortunately it is the latter case. There is no 'C'-to-Java signaling mechanism in JSyn. You'll have to poll. This is yet another reason to rewrite the native synthesis code in Java. Thank you, Phil Burk --------------------------------------- SoftSynth, Audio Research and Development http://www.softsynth.com/ 75 Pleasant Lane, San Rafael, CA, 94901 USA Office: +1-415-453-4320 Mobile: +1-415-846-4370 FAX: +1-415-373-4428 --------------------------------------- jsyn@music.columbia.edu wrote: > Hello, > > I'd like to call one of my SynthCiruit sub-class' methods when an incoming > signal goes above a certain value, e.g. Detecting when a pulse goes above > zero and then immediately executing some code. > > As I see it, either there is some Jsyn comparator unit that will provide a > Java call-back I can register with when a certain signal condition is met (I > don't think this is the case), or I have to constantly be polling this > incoming signal from another thread to see if the trigger condition has been > met. That would be unfortunate. > > Any other thoughts I may have missed? > > Thanks! > > C>T> > > _______________________________________________ > JSyn mailing list > JSyn@music.columbia.edu > To change digest mode or to make other administrative changes visit: > http://music.columbia.edu/mailman/listinfo/jsyn > > From jsyn at music.columbia.edu Thu Nov 20 09:10:27 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Thu Nov 20 09:11:22 2008 Subject: [jsyn] TableOscillator and aliasing Message-ID: <72db3ce4bbd59e0af7b333dd88445f3f.squirrel@europa.cse.dmu.ac.uk> I'm getting an awful lot of aliasing when I use a table oscillator. At present I'm only playing back at fixed frequencies. One of 220Hz, 440Hz, or 1320Hz. These frequencies only change infrequently, and I am not worried about small clicks or glitches when they change. The waveforms are calculated from waveforms represented as segments, which are frequently not straight lines. From this, I render the waveform to an array of doubles, and then create a SynthTable from this. Before I noticed all the aliasing, I didn't think about this carefully, and just made a table of 1000 doubles. Since @44.1Khz, this table is much longer than the 33.41 samples each cycle of a 1320Hz is output in, the TableOscillator is effectively pitch-shifting the waveform up, presumably causing the aliasing. What strategy should I follow in order to get the best quality output from the TableOscillator. I could fit the size of the double array (and hence table) to the frequency. If I compromised on 1260Hz waveform, then each cycle would be 35 samples @ 44.1Khz sampling. I could then calculate my waveform accordingly, and then load the TableOscillator with the table. Or, I could stick to large tables. But I could filter my double array before creating the synthtable using standard filters. I'd have to use a time invariant filter (e.g. filter forwards then backwards) but this is not a problem. But I'd be concerned about glitches at the beginning and ends of the samples, and may have to render multiple cycles to avoid this problem (excising a "middle" rendered and filtered loop of the waveform for the table). If I was going to be safe and limit frequencies to 19Khz, then I could low pass filter my 1000 sample data @634Hz so that when pitch-shifted up, none of the frequencies exceed 19K. I'd guess that the best approach would depend on how TableOscillator is implemented. Phil, do you have any comments? Are there any issues in swapping the table for a TableOscillator's tablePort while it's running for a table with a different underlying number of samples? Small glitches at the time of table swap are not a major problem. Thanks in anticipation, Ross Clement From jsyn at music.columbia.edu Thu Nov 20 13:56:57 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Thu Nov 20 15:40:50 2008 Subject: [jsyn] TableOscillator and aliasing In-Reply-To: <72db3ce4bbd59e0af7b333dd88445f3f.squirrel@europa.cse.dmu.ac.uk> References: <72db3ce4bbd59e0af7b333dd88445f3f.squirrel@europa.cse.dmu.ac.uk> Message-ID: <4925B2F9.4010707@softsynth.com> Hello Ross, Since you are only rendering three frequencies, I would use three tables and band-limit the table for each intended frequency. You could run three TableOscillators, one for each table, at the same time and then just ramp the one you want to hear up or down. That would avoid pops and glitches. To filter the table contents you would need to repeat the waveform many times so that you can extract a stable loop. The load the table with the pre-filtered data. As you know, you cannot filter the audio after the aliasing has occurred because there is not enough information to reconstruct the signal. Thank you, Phil Burk --------------------------------------- SoftSynth, Audio Research and Development http://www.softsynth.com/ 75 Pleasant Lane, San Rafael, CA, 94901 USA Office: +1-415-453-4320 Mobile: +1-415-846-4370 FAX: +1-415-373-4428 --------------------------------------- jsyn@music.columbia.edu wrote: > I'm getting an awful lot of aliasing when I use a table oscillator. At > present I'm only playing back at fixed frequencies. One of 220Hz, 440Hz, > or 1320Hz. These frequencies only change infrequently, and I am not > worried about small clicks or glitches when they change. > > The waveforms are calculated from waveforms represented as segments, which > are frequently not straight lines. From this, I render the waveform to an > array of doubles, and then create a SynthTable from this. Before I noticed > all the aliasing, I didn't think about this carefully, and just made a > table of 1000 doubles. Since @44.1Khz, this table is much longer than the > 33.41 samples each cycle of a 1320Hz is output in, the TableOscillator is > effectively pitch-shifting the waveform up, presumably causing the > aliasing. > > What strategy should I follow in order to get the best quality output from > the TableOscillator. I could fit the size of the double array (and hence > table) to the frequency. If I compromised on 1260Hz waveform, then each > cycle would be 35 samples @ 44.1Khz sampling. I could then calculate my > waveform accordingly, and then load the TableOscillator with the table. > > Or, I could stick to large tables. But I could filter my double array > before creating the synthtable using standard filters. I'd have to use a > time invariant filter (e.g. filter forwards then backwards) but this is > not a problem. But I'd be concerned about glitches at the beginning and > ends of the samples, and may have to render multiple cycles to avoid this > problem (excising a "middle" rendered and filtered loop of the waveform > for the table). If I was going to be safe and limit frequencies to 19Khz, > then I could low pass filter my 1000 sample data @634Hz so that when > pitch-shifted up, none of the frequencies exceed 19K. > > I'd guess that the best approach would depend on how TableOscillator is > implemented. Phil, do you have any comments? > > Are there any issues in swapping the table for a TableOscillator's > tablePort while it's running for a table with a different underlying > number of samples? Small glitches at the time of table swap are not a > major problem. > > Thanks in anticipation, > > Ross Clement > > _______________________________________________ > JSyn mailing list > JSyn@music.columbia.edu > To change digest mode or to make other administrative changes visit: > http://music.columbia.edu/mailman/listinfo/jsyn > >