From jsyn at music.columbia.edu Tue Sep 8 10:42:00 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Tue, 08 Sep 2009 10:42:00 -0400 Subject: [jsyn] get() vs. getCurrent() Message-ID: <4AA66D38.7080809@mail.rockefeller.edu> Hi Phil Whats the difference between get() and getCurrent()? If I want to poll the period and confidence of a PitchDetector, which do I use? If I want the current peak value of a PeakFollower which do I use? I have been using get() for all of these. ie ... double currentPeak = peakFollower.output.get(); double currentConfidence = pitchDetector.confidence.get(); double currentPeriod = pitchDetector.period.get(); Thanks Nick D From jsyn at music.columbia.edu Tue Sep 8 12:34:28 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Tue, 08 Sep 2009 11:34:28 -0500 Subject: [jsyn] get() vs. getCurrent() In-Reply-To: <4AA66D38.7080809@mail.rockefeller.edu> References: <4AA66D38.7080809@mail.rockefeller.edu> Message-ID: <4AA68794.6040700@softsynth.com> Hi Nick, Good question. For SynthVariable, and its child SynthInput, the get() method returns the value last passed to set(). That value is stored at the Java level. The getCurrent() method reaches down into the native CSyn engine and grabs the actual current value. If the port is driven by a connection then it will get the current value coming into that connection. For SynthOutput there is no getCurrent() method. The get() method grabs the current value from the native engine. So if you want to get a generated value from a PeakFollower or PitchDetector then use get(). 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 at music.columbia.edu wrote: > Hi Phil > > Whats the difference between get() and getCurrent()? > > If I want to poll the period and confidence of a PitchDetector, which do > I use? If I want the current peak value of a PeakFollower which do I use? > > I have been using get() for all of these. ie ... > > double currentPeak = peakFollower.output.get(); > double currentConfidence = pitchDetector.confidence.get(); > double currentPeriod = pitchDetector.period.get(); > > > Thanks > Nick D > _______________________________________________ > JSyn mailing list > JSyn at 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 Sep 8 23:55:26 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Tue, 08 Sep 2009 23:55:26 -0400 Subject: [jsyn] SampleWriter, querying the number of frames read Message-ID: <4AA7272E.1020903@mail.rockefeller.edu> Hi Phil I am allocating a big SynthSample and writing to it with a SampleWriter: sampleWriter.samplePort.queue(sample); I have a Thread waking up every 0.1 sec to calculate the number of frames read, just by doing some Java arithmetic (current time - start time * 44100) I am wondering if there is a direct way to query the SynthSample or the SampleWriter and get the exact number of frames written? Thanks Nick D From jsyn at music.columbia.edu Tue Sep 8 23:55:46 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Tue, 08 Sep 2009 23:55:46 -0400 Subject: [jsyn] get() vs. getCurrent() In-Reply-To: <4AA68794.6040700@softsynth.com> References: <4AA66D38.7080809@mail.rockefeller.edu> <4AA68794.6040700@softsynth.com> Message-ID: <4AA72742.6090905@mail.rockefeller.edu> Thanks Phil! jsyn at music.columbia.edu wrote: > Hi Nick, > > Good question. > > For SynthVariable, and its child SynthInput, the get() method returns > the value last passed to set(). That value is stored at the Java level. > The getCurrent() method reaches down into the native CSyn engine and > grabs the actual current value. If the port is driven by a connection > then it will get the current value coming into that connection. > > For SynthOutput there is no getCurrent() method. The get() method grabs > the current value from the native engine. So if you want to get a > generated value from a PeakFollower or PitchDetector then use get(). > > 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 at music.columbia.edu wrote: > >> Hi Phil >> >> Whats the difference between get() and getCurrent()? >> >> If I want to poll the period and confidence of a PitchDetector, which do >> I use? If I want the current peak value of a PeakFollower which do I use? >> >> I have been using get() for all of these. ie ... >> >> double currentPeak = peakFollower.output.get(); >> double currentConfidence = pitchDetector.confidence.get(); >> double currentPeriod = pitchDetector.period.get(); >> >> >> Thanks >> Nick D >> _______________________________________________ >> JSyn mailing list >> JSyn at music.columbia.edu >> To change digest mode or to make other administrative changes visit: >> http://music.columbia.edu/mailman/listinfo/jsyn >> >> >> > _______________________________________________ > JSyn mailing list > JSyn at 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 Wed Sep 9 16:39:32 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Wed, 09 Sep 2009 13:39:32 -0700 Subject: [jsyn] SampleWriter, querying the number of frames read In-Reply-To: <4AA7272E.1020903@mail.rockefeller.edu> References: <4AA7272E.1020903@mail.rockefeller.edu> Message-ID: <4AA81284.3040906@softsynth.com> A SynthDataQueue keeps track of how many frames have passed through it. http://www.softsynth.com/jsyn/docs/autodocs/com/softsynth/jsyn/SynthDataQueue.html int moved = sampleWriter.samplePort.getNumFramesMoved() Note that it wraps after about 18 hours. 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 at music.columbia.edu wrote: > Hi Phil > > I am allocating a big SynthSample and writing to it with a SampleWriter: > sampleWriter.samplePort.queue(sample); > > I have a Thread waking up every 0.1 sec to calculate the number of > frames read, just by doing some Java arithmetic (current time - start > time * 44100) > > I am wondering if there is a direct way to query the SynthSample or the > SampleWriter and get the exact number of frames written? > > Thanks > Nick D > > > _______________________________________________ > JSyn mailing list > JSyn at 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 Sep 22 23:09:17 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Tue, 22 Sep 2009 23:09:17 -0400 Subject: [jsyn] start JSyn engine before a JFrame opens and Java hangs under OSX Message-ID: <4AB9915D.3050900@mail.rockefeller.edu> This is really odd (but I remember something like this years ago): Start synth engine before opening a JFrame and Java hangs. Open the JFrame first, all's well. Bug exhibited in OSX 10.5.8, java version 1.5.0_19, JSynV144 Source pasted below. Thanks Nick package com.punosmusic.test; import java.awt.Dimension; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import com.softsynth.jsyn.Synth; /* Java hangs! * start synth engine before opening a JFrame in OSX and Java hangs. * open the JFrame first, all's well. * Bug exhibited in OSX 10.5.8, java version 1.5.0_19, JSynV144 * * change wantToHang variable and see difference * * Nick Didkovsky */ public class TestWeirdBug { public static void main(String[] args) { boolean wantToHang = true; System.out.println(System.getProperty("java.version")); if (wantToHang) { Synth.startEngine(0); JFrame j = openFrame(); } else { JFrame j = openFrame(); Synth.startEngine(0); } System.out.println("Survived! Done!"); } private static JFrame openFrame() { JFrame jFrame = new JFrame("close to quit"); jFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Synth.stopEngine(); System.exit(0); } }); jFrame.setSize(new Dimension(320, 200)); jFrame.setVisible(true); return jFrame; } } From jsyn at music.columbia.edu Fri Sep 25 14:17:34 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Fri, 25 Sep 2009 11:17:34 -0700 Subject: [jsyn] start JSyn engine before a JFrame opens and Java hangs under OSX In-Reply-To: <4AB9915D.3050900@mail.rockefeller.edu> References: <4AB9915D.3050900@mail.rockefeller.edu> Message-ID: <4ABD093E.9060506@softsynth.com> Hello Nick, Thanks for reporting this. > This is really odd (but I remember something like this years ago): > Start synth engine before opening a JFrame and Java hangs. > Open the JFrame first, all's well. > Bug exhibited in OSX 10.5.8, java version 1.5.0_19, JSynV144 I found that I could get Java to hang doing just this: Synth.startEngine( 0 ); Label label = new Label( "hello" ); It dies in the Label creation in java.awt.Component.java when it tries to: private static final DebugHelper dbg = DebugHelper.create(Component.class); If I create a Label before starting the engine then I can create Labels later with no problem. I think this is related to having a thread running in native code before creating the DebugHelper. It may be the same Apple bug reported here: http://lists.apple.com/archives/java-dev/2008/May/msg00410.html http://lists.apple.com/archives/Java-dev/2006/May/msg00061.html For now I would just say "don't do that". The workaround is easy and it seems like Apple's bug. Also it doesn't happen with the upcoming pure Java JSyn. I will log it as a bug. 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 --------------------------------------- From jsyn at music.columbia.edu Fri Sep 25 15:51:37 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Fri, 25 Sep 2009 15:51:37 -0400 Subject: [jsyn] start JSyn engine before a JFrame opens and Java hangs under OSX In-Reply-To: <4ABD093E.9060506@softsynth.com> References: <4AB9915D.3050900@mail.rockefeller.edu> <4ABD093E.9060506@softsynth.com> Message-ID: <4ABD1F49.1050200@mail.rockefeller.edu> Hi Phil I think I first encountered this years ago, with some JNI library other than JSyn... it's not your bug. I've fixed my piece to open the JFrame first, that wasn't too difficult, took no more than an afternoon of moving some code around, refactoring, and extensive testing. I think we're ok Best Nick jsyn at music.columbia.edu wrote: > Hello Nick, > > Thanks for reporting this. > > > This is really odd (but I remember something like this years ago): > > Start synth engine before opening a JFrame and Java hangs. > > Open the JFrame first, all's well. > > Bug exhibited in OSX 10.5.8, java version 1.5.0_19, JSynV144 > > I found that I could get Java to hang doing just this: > > Synth.startEngine( 0 ); > Label label = new Label( "hello" ); > > It dies in the Label creation in java.awt.Component.java > when it tries to: > > private static final DebugHelper dbg > = DebugHelper.create(Component.class); > > If I create a Label before starting the engine then I can create Labels > later with no problem. > > I think this is related to having a thread running in native code before > creating the DebugHelper. > > It may be the same Apple bug reported here: > > http://lists.apple.com/archives/java-dev/2008/May/msg00410.html > > http://lists.apple.com/archives/Java-dev/2006/May/msg00061.html > > For now I would just say "don't do that". The workaround is easy and it > seems like Apple's bug. Also it doesn't happen with the upcoming pure > Java JSyn. > > I will log it as a bug. > > 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 mailing list > JSyn at 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 Fri Sep 25 17:28:25 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Fri, 25 Sep 2009 14:28:25 -0700 Subject: [jsyn] start JSyn engine before a JFrame opens and Java hangs under OSX In-Reply-To: <4ABD1F49.1050200@mail.rockefeller.edu> References: <4AB9915D.3050900@mail.rockefeller.edu> <4ABD093E.9060506@softsynth.com> <4ABD1F49.1050200@mail.rockefeller.edu> Message-ID: <4ABD35F9.1070603@softsynth.com> > I've fixed my piece to open the JFrame first, that wasn't too > difficult, took no more than an afternoon of moving some code around, > refactoring, and extensive testing. I think we're ok I think you might be able to get away with just doing new Label("hello"); at the very beginning of your program, before calling JSyn. You may not need to change anything else. That will initialize the static DebugHelper inside Component. 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 --------------------------------------- From jsyn at music.columbia.edu Fri Sep 25 17:30:49 2009 From: jsyn at music.columbia.edu (jsyn at music.columbia.edu) Date: Fri, 25 Sep 2009 17:30:49 -0400 Subject: [jsyn] start JSyn engine before a JFrame opens and Java hangs under OSX In-Reply-To: <4ABD35F9.1070603@softsynth.com> References: <4AB9915D.3050900@mail.rockefeller.edu> <4ABD093E.9060506@softsynth.com> <4ABD1F49.1050200@mail.rockefeller.edu> <4ABD35F9.1070603@softsynth.com> Message-ID: <4ABD3689.60400@mail.rockefeller.edu> yes I was just kidding - the change was trivial thanks Nick jsyn at music.columbia.edu wrote: >> I've fixed my piece to open the JFrame first, that wasn't too >> difficult, took no more than an afternoon of moving some code around, >> refactoring, and extensive testing. I think we're ok >> > > I think you might be able to get away with just doing > > new Label("hello"); > > at the very beginning of your program, before calling JSyn. You may not > need to change anything else. That will initialize the static > DebugHelper inside Component. > > 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 mailing list > JSyn at music.columbia.edu > To change digest mode or to make other administrative changes visit: > http://music.columbia.edu/mailman/listinfo/jsyn >