From jsyn at music.columbia.edu Sat Oct 4 08:13:46 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Sat Oct 4 08:14:07 2008 Subject: [jsyn] SynthNotes that use samples, applet vs application Message-ID: <48E75DFA.7000306@mail.rockefeller.edu> A student of mine asked me about SynthNotes that load samples, and how to deploy them to the www in an applet. I thought it would be helpful to drop my response to this list here... You will need to edit the SynthNote source code to load the sample from a URL when running as an Applet, or from a FileInputStream when running as an application Check the source code for your SynthNote as exported from Wire. You will see something like the following: public void loadSample_sample( SynthContext synthContext ) { try { InputStream stream = (InputStream) (new FileInputStream( "E:/documents/JMSLScoreWork/JMSLScoreSamples/ding.wav" )); sample = new SynthSampleWAV( synthContext, stream ); stream.close(); sample.setBaseFrequency( 440.00126386630535 ); } catch( IOException e) { System.err.println( e ); } } What you need is a class of your own, call it something like Globals, and in there you can make a couple of static public fields which can be referenced globally to check whether or not we're running as an applet public static boolean RUNNING_AS_APPLET; public static URL CODEBASE; Then in your Applet start(), before you create the new Synthnote, do this: Globals.RUNNING_AS_APPLET = true; Globals.CODEBASE = getCodebase(); (comment these out when testing locally, and uncomment them right before deploying to the www) Then modify loadSample to be able to switch between file and url, something like: /** warning, untested code! */ public void loadSample_sample( SynthContext synthContext ) { try { InputStream stream; if (Globals.RUNNING_AS_APPLET) { stream = new URL(Globals.CODEBASE, "ding.wav" ).openStream(); } else { stream = (InputStream) (new FileInputStream( "E:/documents/JMSLScoreWork/JMSLScoreSamples/ding.wav" )); } sample = new SynthSampleWAV( synthContext, stream ); stream.close(); sample.setBaseFrequency( 440.00126386630535 ); } catch( IOException e) { System.err.println( e ); } } This assumes "ding.wav" is directly inside your "classes" codebase folder online. Of course you could/should put sample files in a subdir called "samples" or something similar, and edit the URL above to read "samples/ding.wav" thanks Nick Didkovsky From jsyn at music.columbia.edu Wed Oct 29 19:43:11 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Wed Oct 29 18:41:23 2008 Subject: [jsyn] ParabolicEnvelope Message-ID: Hello, I am using ParabolicEnvelope to control the amplitude port of a SampleReader_16V1. My SampleReader_16V1 plays a sample and I'd like to set the frequency of the ParabolicEnvelope such that it completes it's cycle over the exact length of the sample (in Frames). I thought maybe the HZ freq for ParabolicEnvelope would indicate one pass through the envelope in one second at 1 Hz (and so on) and I could just match that accordingly to the length of my sample but it doesn't look like that's doing it. Ideas? Thanks, C>T> From jsyn at music.columbia.edu Wed Oct 29 19:08:38 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Wed Oct 29 19:08:50 2008 Subject: [jsyn] ParabolicEnvelope In-Reply-To: References: Message-ID: <4908ECF6.5060109@softsynth.com> Hello C>T> > I thought maybe the HZ freq for ParabolicEnvelope would indicate one > pass through the envelope in one second at 1 Hz (and so on) and I > could just match that accordingly to the length of my sample but it > doesn't look like that's doing it. That's the idea. The doc says "Fastest repeat rate of envelope if it were continually retriggered in Hertz." So if at frequency= 10 Hz it should 0.1 second to complete the envelope. Note that the internal calculations are recursive so roundoff errors can accumulate and cause slight deviations in time. Are you seeing big or little differences? If you want more precise control you could create arbitrarily shaped envelopes with the SynthEnvelope. You could stuff in the values by hand and then vary its playback rate. If the original envelope data has a total time of 1 second then you could use the "rate" knob as 1/duration in seconds. 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 Wed Oct 29 20:29:35 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Wed Oct 29 19:27:54 2008 Subject: [jsyn] ParabolicEnvelope In-Reply-To: <4908ECF6.5060109@softsynth.com> Message-ID: Thanks for this - A follow-up question regarding using SynthEnvelope: It will take a lot of data points to get the curve resolution required to make a decent parabolic shape. Do more data points make the underlying CSyn implementation of the envelope harder work or is the running of an envelope the same regardless of the original points used to define it. If the former would Parabolic Envelope thus be more efficient? I plan on running *lots* of these (like in a granular process)... Thanks, C>T> On 10/29/08 6:08 PM, "jsyn@music.columbia.edu" wrote: > Hello C>T> > >> I thought maybe the HZ freq for ParabolicEnvelope would indicate one >> pass through the envelope in one second at 1 Hz (and so on) and I >> could just match that accordingly to the length of my sample but it >> doesn't look like that's doing it. > > That's the idea. The doc says "Fastest repeat rate of envelope if it > were continually retriggered in Hertz." > > So if at frequency= 10 Hz it should 0.1 second to complete the envelope. > > Note that the internal calculations are recursive so roundoff errors can > accumulate and cause slight deviations in time. > > Are you seeing big or little differences? > > If you want more precise control you could create arbitrarily shaped > envelopes with the SynthEnvelope. You could stuff in the values by hand > and then vary its playback rate. If the original envelope data has a > total time of 1 second then you could use the "rate" knob as 1/duration > in seconds. > > 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@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 Oct 29 19:54:26 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Wed Oct 29 19:54:38 2008 Subject: [jsyn] ParabolicEnvelope In-Reply-To: References: Message-ID: <4908F7B2.2080002@softsynth.com> Hello C>T> > It will take a lot of data points to get the curve resolution > required to make a decent parabolic shape. Do more data points make > the underlying CSyn implementation of the envelope harder work or is > the running of an envelope the same regardless of the original points > used to define it. The envelope frame boundaries take more work than an individual sample but not a huge amount. At 44100 Hz, a one second envelope with 100 frames would have 441 samples per envelope frame. Thus the edge processing would be insignificant. 100 frames would give you a pretty smooth envelope of any shape. > If the former would Parabolic Envelope thus be > more efficient? I plan on running *lots* of these (like in a > granular process)... ParabolicEnvelopes are optimized for use as grain envelopes because they have the ability to cascade triggers along a daisy chain. They also involve less calculation and much less data access than an EnvelopePlayer+SynthEnvelope. Did you solve the frequency problem with ParabolicEnvelope? 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 Wed Oct 29 23:34:09 2008 From: jsyn at music.columbia.edu (jsyn@music.columbia.edu) Date: Wed Oct 29 22:32:21 2008 Subject: [jsyn] ParabolicEnvelope In-Reply-To: <4908F7B2.2080002@softsynth.com> Message-ID: > > Did you solve the frequency problem with ParabolicEnvelope? > Didn't quite nail it down but I'm pretty positive it had to do with some of my own code, scheduling events for future tick times perhaps... Switched over to the SynthEnvelope method for future flexibility, will go back only if this become to processor intensive. No need for "premature optimization" as they say. Thanks! C>T> > > 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@music.columbia.edu > To change digest mode or to make other administrative changes visit: > http://music.columbia.edu/mailman/listinfo/jsyn