Csound Csound-dev Csound-tekno Search About

[Csnd] RMS feedback system help

Date2014-08-06 11:55
FromAskwazzup
Subject[Csnd] RMS feedback system help
Hello friends!

For the past few months i concentrated on learning a bit of supercollider,
and now that i'm back to learning csound again, i feel i'm a bit rusty.

This is an example from the floss manual, it is supposed to lower the amount
of feedback when it gets too high, but there are a few places where i'm not
sure what's going on:

------------------------------------------------------------------------------------------------------------------------------------------------------
giSine    ftgen     0, 0, 2^10, 10, 1 ;table with a sine wave

instr 1
a3        init      0
kamp      linseg    0, 1.5, 0.2, 1.5, 0 ;envelope for initial input
asnd      poscil    kamp, 440, giSine ;initial input
 if p4 == 1 then ;choose between two sines ...
adel1     poscil    0.0523, 0.023, giSine
adel2     poscil    0.073, 0.023, giSine,.5
 else ;or a random movement for the delay lines
adel1     randi     0.05, 0.1, 2
adel2     randi     0.08, 0.2, 2
 endif
a0        delayr    1 ;delay line of 1 second
a1        deltapi   adel1 + 0.1 ;first reading
a2        deltapi   adel2 + 0.1 ;second reading
*krms      rms       a3 ;rms measurement
printk     1, 
          delayw    asnd + exp(-krms) * a3 ;feedback depending on rms++
a3        reson     -(a1+a2), 3000, 7000, 2 ;calculate a3*
aout      linen     a1/3, 1, p3, 1 ;apply fade in and fade out
          outs      aout, aout
endin
----------------------------------------------------------------------------------------------------------------------------------------------------

On this line:

*delayw    asnd + exp(-krms) * a3 *

1) a3 is being used, but at the start of the instrument it's initialized to
0, is that how it's supposed to work? First time the delayw is modified by 
+0, and then whatever comes out of the reson filter?

2) Also, i'm not really sure how does delayw work? In the manual it says it
writes to a digital delay line. What is a digital delay line?

On this line:

*a3        reson     -(a1+a2), 3000, 7000, 2*

3) Why is (a1+a2) with a minus sign?




--
View this message in context: http://csound.1045644.n5.nabble.com/RMS-feedback-system-help-tp5736633.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2014-08-06 17:40
FromAndres Cabrera
SubjectRe: [Csnd] RMS feedback system help
Hi,


On Wed, Aug 6, 2014 at 5:55 AM, Askwazzup <aistiskaikaris@mail.com> wrote:
1) a3 is being used, but at the start of the instrument it's initialized to
0, is that how it's supposed to work? First time the delayw is modified by
+0, and then whatever comes out of the reson filter?


init works only at init time, i.e. when the note starts, so only the first control pass will have 0s for a3, the next pass it will have the previous value of a3 (because it hasn't been rewritten by the reson line (so this in fact delays a3 by one control block, which is a bit unusual as the behavior changes if you change ksmps, not sure if this is deliberate)
 
2) Also, i'm not really sure how does delayw work? In the manual it says it
writes to a digital delay line. What is a digital delay line?

It's a delay line made of digital samples. Digital delay lines work like analog ones, where you have a "read" head and a "write" head, that's why you have two opcodes. You can hide this inside a single opcode like vdelay3.
 

On this line:

*a3        reson     -(a1+a2), 3000, 7000, 2*

3) Why is (a1+a2) with a minus sign?

It looks like the purpose is to invert the phase so that it cancels the input signal in:
delayw    asnd + exp(-krms) * a3

But with filtering and the ksmps delay, you can't really predict that it will cancel...

Cheers,
Andrés

 




--
View this message in context: http://csound.1045644.n5.nabble.com/RMS-feedback-system-help-tp5736633.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2014-08-06 19:12
FromAskwazzup
Subject[Csnd] Re: RMS feedback system help
Thank you Andres!



--
View this message in context: http://csound.1045644.n5.nabble.com/RMS-feedback-system-help-tp5736633p5736656.html
Sent from the Csound - General mailing list archive at Nabble.com.