| It works for me, with ksmps > 1. Or should I say, it produces the same
result regardless of the orch ksmps. I used this
instrument:
instr 1
api = .1
kenv phasor -0.25
ain rand kenv*kenv
aout modern_waveguide ain/20,440, 0.25, api
outs aout, aout
endin
Maybe we need to see the full CSD.
Victor
On 11 Sep 2010, at 00:21, Johann Bach wrote:
> I have enjoyed using this UDO in previous versions of csound, a
> waveguide model with true fractional sample delay for pitch accuracy.
> Note that it sets ksmps to 1. This has always worked before in orc's
> with ksmps= . However, I just tried it in
> 5.12, and it misbehaves unless I set ksmps (for the whole orc) = 1.
> Did something change about the way csound processes opcodes like this,
> or is there something else wrong I'm doing?
>
>
>
>
> opcode modern_waveguide, a, aiia
>
> setksmps 1
>
> /* now we combine the modern waveguide model
> with the ideas developed with the KS model */
>
> ain, ifun, idec, apkpos xin
>
> ipi = -4*taninv(-1)
>
> idts = sr/ifun /* total delay time (samples) */
> idtt = int(sr/ifun) /* truncated delay time */
> idel = idts/sr /* delay time (secs) */
>
>
> ifac init 1 /* decay shortening factor (fdb gain) */
> is init 0.5 /* loss filter coefficient */
>
> igf pow 10, -idec/(20*ifun) /* gain required for a certain decay */
> ig = cos(ipi*ifun/sr) /* unitary gain with s=0.5 */
>
> if igf > ig igoto stretch /* if decay needs lengthening */
> ifac = igf/ig /* if decay needs shortening */
> goto continue
>
> stretch:
> icosfun = cos(2*ipi*ifun/sr)
> ia = 2 - 2*icosfun
> ib = 2*icosfun - 2
> ic = 1 - igf*igf
> id = sqrt(ib*ib - 4*ia*ic)
> is1 = (-ib + id)/(ia*2)
> is2 = (-ib - id)/(ia*2)
> is = (is1 < is2 ? is1 : is2)
>
> continue:
> ax1 init 0 /* filter delay variable */
> apx1 init 0 /* allpass fwd delay variable */
> apy1 init 0 /* allpass fdb delay variable */
>
> idtt = ((idtt+is) > (idts) ? idtt - 1: idtt)
> ifd = (idts - (idtt + is)) /* fractional delay */
> icoef = (1-ifd)/(1+ifd) /* allpass coefficient */
>
> atmp delayr 1.0
>
> adel deltapn idtt
>
> aflt = (adel*(1-is) + ax1*is)*ifac /* LP filter */
> ax1 = adel
> alps = icoef*(aflt - apy1) + apx1 /* AP filter */
> apx1 = aflt
> apy1 = alps
>
> ;;; tablew alps, awp, itab1, 0 ,0 ,1
>
> atap1 deltapn (1-apkpos) * idtt / 2
> atap2 deltapn apkpos * idtt / 2
> delayw alps + ain
>
> aout = atap1 + atap2
> xout aout
> endop
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|