Csound Csound-dev Csound-tekno Search About

[Csnd] Realtime changes delayed by one note when using i(kvar) and linenr

Date2012-03-01 13:12
FromDavid Banks
Subject[Csnd] Realtime changes delayed by one note when using i(kvar) and linenr
Hey list,

I am designing a simple realtime MIDI synth and I want the ability to
change the envelope attack and release time in realtime.  I don't need
the changes to affect notes that are still in progress (though that
would be cool), but when I change the attack and release times it should
affect the next note I trigger.  Most envelope opcodes however only take
the attack and release times at i-rate.  The only way around this that I
know is to use a cast, i.e. i(katt).  However, when I use this method,
the next note I play on the keyboard does not use the new setting.
Instead, the note AFTER the next will use it, so I'll have to play
another note with the old setting before I get the new one.

Is there any way I can get the change to affect the next note directly?
 I am not particularly attached to this casting method, if anyone has
any other ideas on how to do this.  CSD below.



-odac -Ma


sr     = 44100
ksmps  = 20
nchnls = 2
0dbfs  = 1.0

alwayson 99

instr 1
    kpch = p4
    kvel = 127
    midinoteonpch kpch, kvel
    kcps = cpspch(kpch)

    katt ctrl7 01, 73, 0.0, 1.0
    kdec ctrl7 01, 72, 0.0, 1.0

    a0 oscil ampdbfs(-21), kcps, 1
    a1 linenr a0, i(katt), i(kdec), 0.01

    aout = a1
    outs aout, aout
endin


; wave tables
f 1 0 16384 10 1
e 3600



Cheers,
David


Date2012-03-01 13:54
FromIain McCurdy
SubjectRE: [Csnd] Realtime changes delayed by one note when using i(kvar)
Hi David,

Using i-rate versions of ctrl7 will solve this:

    iatt ctrl7 01, 1, 0.0, 1.0
    idec ctrl7 01, 2, 0.0, 1.0
 
    a0 oscil ampdbfs(-21), kcps, 1
    a1 linenr a0, iatt, idec, 0.01

Hope this helps,
Iain

----------------------------------------
> To: csound@lists.bath.ac.uk
> From: amoebae@gmail.com
> Date: Thu, 1 Mar 2012 13:12:36 +0000
> Subject: [Csnd] Realtime changes delayed by one note when using i(kvar) and linenr
>
> Hey list,
>
> I am designing a simple realtime MIDI synth and I want the ability to
> change the envelope attack and release time in realtime. I don't need
> the changes to affect notes that are still in progress (though that
> would be cool), but when I change the attack and release times it should
> affect the next note I trigger. Most envelope opcodes however only take
> the attack and release times at i-rate. The only way around this that I
> know is to use a cast, i.e. i(katt). However, when I use this method,
> the next note I play on the keyboard does not use the new setting.
> Instead, the note AFTER the next will use it, so I'll have to play
> another note with the old setting before I get the new one.
>
> Is there any way I can get the change to affect the next note directly?
> I am not particularly attached to this casting method, if anyone has
> any other ideas on how to do this. CSD below.
>
> 
> 
> -odac -Ma
> 
> 
> sr = 44100
> ksmps = 20
> nchnls = 2
> 0dbfs = 1.0
>
> alwayson 99
>
> instr 1
> kpch = p4
> kvel = 127
> midinoteonpch kpch, kvel
> kcps = cpspch(kpch)
>
> katt ctrl7 01, 73, 0.0, 1.0
> kdec ctrl7 01, 72, 0.0, 1.0
>
> a0 oscil ampdbfs(-21), kcps, 1
> a1 linenr a0, i(katt), i(kdec), 0.01
>
> aout = a1
> outs aout, aout
> endin
> 
> 
> ; wave tables
> f 1 0 16384 10 1
> e 3600
> 
> 
>
> Cheers,
> David
>
>
>
> 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"
>
 		 	   		  

Date2012-03-01 22:50
FromDavid Banks
Subject[Csnd] Re: Realtime changes delayed by one note when using i(kvar)
On 01/03/12 13:54, Iain McCurdy wrote:
> Using i-rate versions of ctrl7 will solve this:
> 
>     iatt ctrl7 01, 1, 0.0, 1.0
>     idec ctrl7 01, 2, 0.0, 1.0
>  
>     a0 oscil ampdbfs(-21), kcps, 1
>     a1 linenr a0, iatt, idec, 0.01

Doh!  Thanks Iain.

David