[Cs-dev] delay opcode suggestion w/code
Date | 2011-08-01 19:43 |
From | Casey Mongoven |
Subject | [Cs-dev] delay opcode suggestion w/code |
Hi guys, I am a total newbie to Csound development but recently I thought it would be useful if the delay opcode, for which the manual states "There is no minimum delay period.", would accept delay times which are 0 or lower than representable in the sample rate (.000001 does not work, for example in 96kHz because it is rounded to 0). These low values can be useful in scores utilizing spatialization based on delay. I am not really a developer at this point, and you are all welcome to disagree with the suggestion or suggest improvements, so maybe I could just give recommended changes in OOps/ugens6.c functions "delset" and "delay": 1. Perhaps in the "delset" function: if (UNLIKELY((npts = (int32) (FL(0.5) + *p->idlt * csound->esr)) <= 0)) { return csound->InitError(csound, Str("illegal delay time")); } could be replaced with if (UNLIKELY((npts = (int32) (FL(0.5) + *p->idlt * csound->esr)) <= 0)) { if (*p->idlt < 0) csound->InitError(csound, Str("illegal negative delay time")); else return OK; } or simply if (UNLIKELY((npts = (int32) (FL(0.5) + *p->idlt * csound->esr)) <= 0)) { return OK; } 2. Then in the "delay" function a bypass such as: int delay(CSOUND *csound, DELAY *p) { MYFLT *ar, *asig, *curp, *endp; int n, nsmps = csound->ksmps; ar = p->ar; asig = p->asig; if (UNLIKELY(p->npts==0)) goto bypass; if (UNLIKELY(p->auxch.auxp==NULL)) goto err1; /* RWD fix */ curp = p->curp; endp = (MYFLT *) p->auxch.endp; for (n=0; n<nsmps; n++) { MYFLT in = asig[n]; /* Allow overwriting form */ ar[n] = *curp; *curp = in; if (UNLIKELY(++curp >= endp)) curp = (MYFLT *) p->auxch.auxp; } p->curp = curp; /* sav the new curp */ return OK; bypass: for (n=0; n<nsmps; n++) { ar[n] = asig[n]; } return OK; err1: return csound->PerfError(csound, Str("delay: not initialised")); } Does that sound reasonable or totally lame? Casey -- View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4656029.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-08-02 19:52 |
From | Casey Mongoven |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
I think I am going to just try creating my own plug-in for these purposes ... -- View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4659951.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-08-03 10:08 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
what do you need to do that can't be done with vdelay and delayr/w/ tapi or tap3 Victor On 2 Aug 2011, at 19:52, Casey Mongoven wrote: > I think I am going to just try creating my own plug-in for these > purposes ... > > > -- > View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4659951.html > Sent from the Csound - Dev mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos & much more. Register early & save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-08-05 16:39 |
From | Casey Mongoven |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
Hi Victor, Thanks for the response. What I am trying to do can be implemented with current opcodes but I decided in the end that it would be pretty messy if I didn't create my own plugin. In the manual, it says that "delay" accomodates any duration of delay - it should maybe be added that it does NOT support delay times less than half the length of one sample (which I simply round to 0 delay in my plugin). The plugin I created enables me to give simple arguments for a stereo delay as follows a1, a2 delayst asig, iazim [, ihwid, isos] where ihwid is head width and isos is the speed of sound. In my notation, iazim is between -30 and 30 degrees. I noticed that Steven has a page with a bunch of UDOs but I don't know of any similar database of plugins written directly in c. Is there one? If so I would like to add my opcode. I am not sure how useful it would be for others. If anyone is curious, what I ended up coming up with was this: (delayst.h) #include |
Date | 2011-08-05 17:56 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
yes, delay is a truncating delay, maybe this should be made more clear in the manual. However, I have the impression that what you want to do can be done with vdelay and with delayr/delayw with either deltapi, deltap3 and deltapx. In addition, you can also implement any type of delayline with tables, table reader and writer opcodes. I'm not sure a new opcode is needed. Victor On 5 Aug 2011, at 16:39, Casey Mongoven wrote: > Hi Victor, > > Thanks for the response. What I am trying to do can be implemented > with > current opcodes but I decided in the end that it would be pretty > messy if I > didn't create my own plugin. In the manual, it says that "delay" > accomodates > any duration of delay - it should maybe be added that it does NOT > support > delay times less than half the length of one sample (which I simply > round to > 0 delay in my plugin). > > The plugin I created enables me to give simple arguments for a > stereo delay > as follows > > a1, a2 delayst asig, iazim [, ihwid, isos] > > where ihwid is head width and isos is the speed of sound. In my > notation, > iazim is between -30 and 30 degrees. > > I noticed that Steven has a page with a bunch of UDOs but I don't > know of > any similar database of plugins written directly in c. Is there one? > If so I > would like to add my opcode. > > I am not sure how useful it would be for others. If anyone is > curious, what > I ended up coming up with was this: > > (delayst.h) > > #include |
Date | 2011-08-05 22:10 |
From | Casey Mongoven |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
Actually delay does not truncate (if I understand you correctly) but rounds to the nearest sample. However, like I said if the delay is less than half a sample in length it throws an error "illegal delay time" - something which could presumably be fixed by upping the sample rate. I would maybe just put in the manual "Note: Delay times less than half a sample in length are illegal." or something like that, instead of "There is no minimum delay period." Most people probably don't use delays so small but when using them to simulate interaural differences you are working with a maximum delay of about a half of a millisecond based on a 17cm head width. I am not sure about the other opcodes, I am sure you are right I could do what I wanted with multiple existing opcodes. I am doing a lot of calculation which I would rather have encapsulated in a plugin though. Thanks as always for your help, Victor. Best, Casey -- View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4670823.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-08-07 06:19 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
Attachments | None None |
Casey, Wonderful that you have developed this new opcode. At Berklee, in my composition class, my students and I are huge fans of all your Fibonacci work with Csound! Will you be at the Csound Conference in Hanover. Hope so. Dr. B. Richard Boulanger, Ph.D.
Professor of Electronic Production and Design Music Technology Division Berklee College of Music 1140 Boylston Street Boston, MA 02215 617-747-2485 (office) 774-488-9166 (cell) rboulanger@berklee.edu http://csounds.com/boulanger On Aug 5, 2011, at 11:39 AM, Casey Mongoven wrote:
|
Date | 2011-08-08 14:39 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
You are right, delay rounds, whereas deltapn can be used to truncate (or round) to a given time in samples. But there are plenty of interpolating delays that will give you anything above 0 secs delay, with varying levels of accuracy. Victor On 5 Aug 2011, at 22:10, Casey Mongoven wrote: > Actually delay does not truncate (if I understand you correctly) but > rounds > to the nearest sample. However, like I said if the delay is less > than half a > sample in length it throws an error "illegal delay time" - something > which > could presumably be fixed by upping the sample rate. I would maybe > just put > in the manual "Note: Delay times less than half a sample in length are > illegal." or something like that, instead of "There is no minimum > delay > period." Most people probably don't use delays so small but when > using them > to simulate interaural differences you are working with a maximum > delay of > about a half of a millisecond based on a 17cm head width. > > I am not sure about the other opcodes, I am sure you are right I > could do > what I wanted with multiple existing opcodes. I am doing a lot of > calculation which I would rather have encapsulated in a plugin though. > Thanks as always for your help, Victor. > > Best, > Casey > > -- > View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4670823.html > Sent from the Csound - Dev mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > The must-attend event for mobile developers. Connect with experts. > Get tools for creating Super Apps. See the latest technologies. > Sessions, hands-on labs, demos & much more. Register early & save! > http://p.sf.net/sfu/rim-blackberry-1 > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-08-09 00:45 |
From | Casey Mongoven |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
Hi Richard, Thanks very much for the message and encouragement. Unfortunately, I won't be at the first conference in Hanover - I would love to attend some day though. Is the Csound conference going to be annual? Sounds like a good time. Best, Casey -- View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4680199.html Sent from the Csound - Dev mailing list archive at Nabble.com. ------------------------------------------------------------------------------ FREE DOWNLOAD - uberSVN with Social Coding for Subversion. Subversion made easy with a complete admin console. Easy to use, easy to manage, easy to install, easy to extend. Get a Free download of the new open ALM Subversion platform now. http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-08-14 02:36 |
From | "Dr. Richard Boulanger" |
Subject | Re: [Cs-dev] delay opcode suggestion w/code |
Attachments | None None |
We will miss you Casey as your Csound compositions are really great. In fact, I think John ffitch would be one of your biggest fans! Hopefully there will be other International Csound Conferences after this one.... maybe at Berklee? -dB Richard Boulanger, Ph.D.
Professor of Electronic Production and Design Music Technology Division Berklee College of Music 1140 Boylston Street Boston, MA 02215 617-747-2485 (office) 774-488-9166 (cell) rboulanger@berklee.edu http://csounds.com/boulanger On Aug 8, 2011, at 7:45 PM, Casey Mongoven wrote:
|