Csound Csound-dev Csound-tekno Search About

[Cs-dev] delay opcode suggestion w/code

Date2011-08-01 19:43
FromCasey 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

Date2011-08-02 19:52
FromCasey Mongoven
SubjectRe: [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

Date2011-08-03 10:08
FromVictor Lazzarini
SubjectRe: [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

Date2011-08-05 16:39
FromCasey Mongoven
SubjectRe: [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 

typedef struct {
    OPDS    h;
    MYFLT   *a1, *a2, *asig, *iazim, *irad, *ihwid, *isos;
    MYFLT   *curp, *curp1, *curp2;
    int32   npts;
    AUXCH   auxch;
} DELAYST;

int delaystset(CSOUND *, DELAYST *p);
int delayst(CSOUND *, DELAYST *p);

(delayst.c)

#include "delayst.h"

int delaystset(CSOUND *csound, DELAYST *p)
{
    int32      npts, npts1, npts2;
    char        *auxp;
    MYFLT iazim, irad, ihwid, isos, delmin, del1, del2;
    
    /* based on 60 degree speaker placement, define azimuth from -30 to 30
degrees in radians, radius, head width, speed of sound*/
    iazim = ((90.0-*p->iazim)/180.0)*PI;
    irad = *p->irad;
    if ((ihwid = *p->ihwid) == 0.0) ihwid = 0.165;
    if ((isos = *p->isos) == 0.0) isos = 344.514;
    
    /* delmin is the minimum distance in seconds to an ear from a speaker
based on variables */
    delmin = sqrt(pow(cos((1.0/3.0)*PI)*irad-ihwid/2.0,
2.0)+pow(sin((1.0/3.0)*PI)*irad, 2.0))/isos;
    del1 = sqrt(pow(cos(iazim)*irad+ihwid/2.0, 2.0)+pow(sin(iazim)*irad,
2.0))/isos-delmin;
    del2 = sqrt(pow(cos(iazim)*irad-ihwid/2.0, 2.0)+pow(sin(iazim)*irad,
2.0))/isos-delmin;

    /* define number of points in delays, npts is the size of largest delay
plus 1 to support 0 sample delays */
    npts1 = (int32) (FL(0.5) + del1 * csound->esr);    
    npts2 = (int32) (FL(0.5) + del2 * csound->esr);
    npts = (npts1 >= npts2) ? npts1+1 : npts2+1;
    
    if ((auxp = p->auxch.auxp) == NULL || npts != p->npts) {
        csound->AuxAlloc(csound, (int32)npts*sizeof(MYFLT), &p->auxch);
        auxp = p->auxch.auxp;
        p->npts = npts;
    }
    else {
        memset(auxp, 0, npts*sizeof(MYFLT));
    }
    
    /* if delay is equal to 0 for a speaker, set it to beginning of aux
array, where asig begins writing, else set according to delay */
    p->curp = (MYFLT *) auxp;
    p->curp1 = (UNLIKELY(npts1 == 0)) ? (MYFLT *) p->auxch.auxp : (MYFLT *)
p->auxch.endp - npts1;
    p->curp2 = (UNLIKELY(npts2 == 0)) ? (MYFLT *) p->auxch.auxp : (MYFLT *)
p->auxch.endp - npts2;   

    return OK;
}

int delayst(CSOUND *csound, DELAYST *p)
{
    MYFLT       *a1, *a2, *asig, *curp, *curp1, *curp2, *endp;
    int n, nsmps = csound->ksmps;
    
    if (UNLIKELY(p->auxch.auxp==NULL)) goto err1;
    a1 = p->a1;
    a2 = p->a2;
    asig = p->asig;
    curp = p->curp;
    curp1 = p->curp1;
    curp2 = p->curp2;
    endp = (MYFLT *) p->auxch.endp;
    for (n=0; n<nsmps; n++) {
        *curp = asig[n];   
        a1[n] = *curp1;
        a2[n] = *curp2;
        if (UNLIKELY(++curp == endp)) curp = (MYFLT *) p->auxch.auxp;
        if (UNLIKELY(++curp1 == endp)) curp1 = (MYFLT *) p->auxch.auxp;
        if (UNLIKELY(++curp2 == endp)) curp2 = (MYFLT *) p->auxch.auxp;
    }   
    p->curp = curp;
    p->curp1 = curp1;
    p->curp2 = curp2;
    
    return OK;
 err1:
    return csound->PerfError(csound, Str("delay: not initialised"));
}

#define S sizeof

static OENTRY localops[] = {
    { "delayst",  S(DELAYST),   5,  "aa", "aiioo",  (SUBR)delaystset, NULL,  
(SUBR)delayst }
};

LINKAGE

--
View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4669910.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

Date2011-08-05 17:56
FromVictor Lazzarini
SubjectRe: [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 
>
> typedef struct {
>    OPDS    h;
>    MYFLT   *a1, *a2, *asig, *iazim, *irad, *ihwid, *isos;
>    MYFLT   *curp, *curp1, *curp2;
>    int32   npts;
>    AUXCH   auxch;
> } DELAYST;
>
> int delaystset(CSOUND *, DELAYST *p);
> int delayst(CSOUND *, DELAYST *p);
>
> (delayst.c)
>
> #include "delayst.h"
>
> int delaystset(CSOUND *csound, DELAYST *p)
> {
>    int32      npts, npts1, npts2;
>    char        *auxp;
>    MYFLT iazim, irad, ihwid, isos, delmin, del1, del2;
>
>    /* based on 60 degree speaker placement, define azimuth from -30  
> to 30
> degrees in radians, radius, head width, speed of sound*/
>    iazim = ((90.0-*p->iazim)/180.0)*PI;
>    irad = *p->irad;
>    if ((ihwid = *p->ihwid) == 0.0) ihwid = 0.165;
>    if ((isos = *p->isos) == 0.0) isos = 344.514;
>
>    /* delmin is the minimum distance in seconds to an ear from a  
> speaker
> based on variables */
>    delmin = sqrt(pow(cos((1.0/3.0)*PI)*irad-ihwid/2.0,
> 2.0)+pow(sin((1.0/3.0)*PI)*irad, 2.0))/isos;
>    del1 = sqrt(pow(cos(iazim)*irad+ihwid/2.0,  
> 2.0)+pow(sin(iazim)*irad,
> 2.0))/isos-delmin;
>    del2 = sqrt(pow(cos(iazim)*irad-ihwid/2.0,  
> 2.0)+pow(sin(iazim)*irad,
> 2.0))/isos-delmin;
>
>    /* define number of points in delays, npts is the size of largest  
> delay
> plus 1 to support 0 sample delays */
>    npts1 = (int32) (FL(0.5) + del1 * csound->esr);
>    npts2 = (int32) (FL(0.5) + del2 * csound->esr);
>    npts = (npts1 >= npts2) ? npts1+1 : npts2+1;
>
>    if ((auxp = p->auxch.auxp) == NULL || npts != p->npts) {
>        csound->AuxAlloc(csound, (int32)npts*sizeof(MYFLT), &p->auxch);
>        auxp = p->auxch.auxp;
>        p->npts = npts;
>    }
>    else {
>        memset(auxp, 0, npts*sizeof(MYFLT));
>    }
>
>    /* if delay is equal to 0 for a speaker, set it to beginning of aux
> array, where asig begins writing, else set according to delay */
>    p->curp = (MYFLT *) auxp;
>    p->curp1 = (UNLIKELY(npts1 == 0)) ? (MYFLT *) p->auxch.auxp :  
> (MYFLT *)
> p->auxch.endp - npts1;
>    p->curp2 = (UNLIKELY(npts2 == 0)) ? (MYFLT *) p->auxch.auxp :  
> (MYFLT *)
> p->auxch.endp - npts2;
>
>    return OK;
> }
>
> int delayst(CSOUND *csound, DELAYST *p)
> {
>    MYFLT       *a1, *a2, *asig, *curp, *curp1, *curp2, *endp;
>    int n, nsmps = csound->ksmps;
>
>    if (UNLIKELY(p->auxch.auxp==NULL)) goto err1;
>    a1 = p->a1;
>    a2 = p->a2;
>    asig = p->asig;
>    curp = p->curp;
>    curp1 = p->curp1;
>    curp2 = p->curp2;
>    endp = (MYFLT *) p->auxch.endp;
>    for (n=0; n<nsmps; n++) {
>        *curp = asig[n];
>        a1[n] = *curp1;
>        a2[n] = *curp2;
>        if (UNLIKELY(++curp == endp)) curp = (MYFLT *) p- 
> >auxch.auxp;
>        if (UNLIKELY(++curp1 == endp)) curp1 = (MYFLT *) p->auxch.auxp;
>        if (UNLIKELY(++curp2 == endp)) curp2 = (MYFLT *) p->auxch.auxp;
>    }
>    p->curp = curp;
>    p->curp1 = curp1;
>    p->curp2 = curp2;
>
>    return OK;
> err1:
>    return csound->PerfError(csound, Str("delay: not initialised"));
> }
>
> #define S sizeof
>
> static OENTRY localops[] = {
>    { "delayst",  S(DELAYST),   5,  "aa", "aiioo",  (SUBR)delaystset,  
> NULL,
> (SUBR)delayst }
> };
>
> LINKAGE
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4669910.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

Date2011-08-05 22:10
FromCasey Mongoven
SubjectRe: [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

Date2011-08-07 06:19
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] delay opcode suggestion w/code
AttachmentsNone  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:

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 <csdl.h>

typedef struct {
   OPDS    h;
   MYFLT   *a1, *a2, *asig, *iazim, *irad, *ihwid, *isos;
   MYFLT   *curp, *curp1, *curp2;
   int32   npts;
   AUXCH   auxch;
} DELAYST;

int delaystset(CSOUND *, DELAYST *p);
int delayst(CSOUND *, DELAYST *p);

(delayst.c)

#include "delayst.h"

int delaystset(CSOUND *csound, DELAYST *p)
{
   int32      npts, npts1, npts2;
   char        *auxp;
   MYFLT iazim, irad, ihwid, isos, delmin, del1, del2;

   /* based on 60 degree speaker placement, define azimuth from -30 to 30
degrees in radians, radius, head width, speed of sound*/
   iazim = ((90.0-*p->iazim)/180.0)*PI;
   irad = *p->irad;
   if ((ihwid = *p->ihwid) == 0.0) ihwid = 0.165;
   if ((isos = *p->isos) == 0.0) isos = 344.514;

   /* delmin is the minimum distance in seconds to an ear from a speaker
based on variables */
   delmin = sqrt(pow(cos((1.0/3.0)*PI)*irad-ihwid/2.0,
2.0)+pow(sin((1.0/3.0)*PI)*irad, 2.0))/isos;
   del1 = sqrt(pow(cos(iazim)*irad+ihwid/2.0, 2.0)+pow(sin(iazim)*irad,
2.0))/isos-delmin;
   del2 = sqrt(pow(cos(iazim)*irad-ihwid/2.0, 2.0)+pow(sin(iazim)*irad,
2.0))/isos-delmin;

   /* define number of points in delays, npts is the size of largest delay
plus 1 to support 0 sample delays */
   npts1 = (int32) (FL(0.5) + del1 * csound->esr);    
   npts2 = (int32) (FL(0.5) + del2 * csound->esr);
   npts = (npts1 >= npts2) ? npts1+1 : npts2+1;

   if ((auxp = p->auxch.auxp) == NULL || npts != p->npts) {
       csound->AuxAlloc(csound, (int32)npts*sizeof(MYFLT), &p->auxch);
       auxp = p->auxch.auxp;
       p->npts = npts;
   }
   else {
       memset(auxp, 0, npts*sizeof(MYFLT));
   }

   /* if delay is equal to 0 for a speaker, set it to beginning of aux
array, where asig begins writing, else set according to delay */
   p->curp = (MYFLT *) auxp;
   p->curp1 = (UNLIKELY(npts1 == 0)) ? (MYFLT *) p->auxch.auxp : (MYFLT *)
p->auxch.endp - npts1;
   p->curp2 = (UNLIKELY(npts2 == 0)) ? (MYFLT *) p->auxch.auxp : (MYFLT *)
p->auxch.endp - npts2;   

   return OK;
}

int delayst(CSOUND *csound, DELAYST *p)
{
   MYFLT       *a1, *a2, *asig, *curp, *curp1, *curp2, *endp;
   int n, nsmps = csound->ksmps;

   if (UNLIKELY(p->auxch.auxp==NULL)) goto err1;
   a1 = p->a1;
   a2 = p->a2;
   asig = p->asig;
   curp = p->curp;
   curp1 = p->curp1;
   curp2 = p->curp2;
   endp = (MYFLT *) p->auxch.endp;
   for (n=0; n&lt;nsmps; n++) {
       *curp = asig[n];   
       a1[n] = *curp1;
       a2[n] = *curp2;
       if (UNLIKELY(++curp == endp)) curp = (MYFLT *) p-&gt;auxch.auxp;
       if (UNLIKELY(++curp1 == endp)) curp1 = (MYFLT *) p->auxch.auxp;
       if (UNLIKELY(++curp2 == endp)) curp2 = (MYFLT *) p->auxch.auxp;
   }   
   p->curp = curp;
   p->curp1 = curp1;
   p->curp2 = curp2;

   return OK;
err1:
   return csound->PerfError(csound, Str("delay: not initialised"));
}

#define S sizeof

static OENTRY localops[] = {
   { "delayst",  S(DELAYST),   5,  "aa", "aiioo",  (SUBR)delaystset, NULL,  
(SUBR)delayst }
};

LINKAGE

--
View this message in context: http://csound.1045644.n5.nabble.com/delay-opcode-suggestion-w-code-tp4656029p4669910.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
BlackBerry&reg; 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


Date2011-08-08 14:39
FromVictor Lazzarini
SubjectRe: [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

Date2011-08-09 00:45
FromCasey Mongoven
SubjectRe: [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

Date2011-08-14 02:36
From"Dr. Richard Boulanger"
SubjectRe: [Cs-dev] delay opcode suggestion w/code
AttachmentsNone  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:

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
https://lists.sourceforge.net/lists/listinfo/csound-devel