[Csnd] Sample-accurate delay
Date | 2020-07-30 18:56 |
From | Alex Weiss |
Subject | [Csnd] Sample-accurate delay |
For an instrument I'm building I need to specify the delay in samples. Delay times will be under 1s on average but it is pivotal that they're sample-accurate.
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Obviously, I can convert from samples to seconds but is the resolution of floats accurate enough to be able to resolve to each individual sample from, say, 0 to 48000? |
Date | 2020-07-30 23:01 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Sample-accurate delay |
Use delayr/delayw and deltapn which takes an integral number of delay samples.
Prof. Victor Lazzarini
Maynooth University
Ireland
On 30 Jul 2020, at 18:57, Alex Weiss <alexweiss86@gmail.com> wrote:
|
Date | 2020-07-31 02:53 |
From | Alex Weiss |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Sample-accurate delay |
Thanks. On a similar note, when scheduling instruments, how are p2 times rounded to the nearest ksmps boundary? Are they always rounded up or down? On Thu, Jul 30, 2020 at 3:01 PM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
|
Date | 2020-07-31 05:14 |
From | Kevin Welsh |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Sample-accurate delay |
I had written a UDO a while back that used a k-rate array with ksmps=1 as a buffer and shiftin and shiftout. I don't know if this is an acceptable way to do it, but it seemed to work ok when I tried. ; UDO to delay by a specific number of samples opcode DelaySample,aa,aak aSigL, aSigR, kSamples xin setksmps 1 if(changed(kSamples)==1) then reinit DelaySampleReinit endif DelaySampleReinit: iSamples = round(i(kSamples)) if (iSamples>0) then kBufL[] init iSamples kBufR[] init iSamples aOutL shiftout kBufL aOutR shiftout kBufR kBufL shiftin aSigL kBufR shiftin aSigR else aOutL = aSigL aOutR = aSigR endif xout aOutL, aOutR endop On Thu, Jul 30, 2020 at 9:54 PM Alex Weiss <alexweiss86@gmail.com> wrote:
|
Date | 2020-07-31 09:18 |
From | Victor Lazzarini |
Subject | Re: [Csnd] [EXTERNAL] [Csnd] Sample-accurate delay |
They are rounded to the nearest ksmps boundary, unless --sample-accurate is used, then Csound starts playing the instrument at the time requested. Prof. Victor Lazzarini
Maynooth University
Ireland
On 31 Jul 2020, at 02:54, Alex Weiss <alexweiss86@gmail.com> wrote:
|