[Csnd] reinit in UDO
| Date | 2018-03-18 17:47 |
| From | Richard |
| Subject | [Csnd] reinit in UDO |
In my UDO I am trying to create a AHD envelope.
I have code like this:
; Ktrig could come from a LFO.
iTotal = iAtt + iHold + iDec
if kTrig > 0 then
kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
endif
But since linseg ues i-rate arguments I think I have to use reinit, but
don't know how in this case..
Richard
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 |
| Date | 2018-03-18 18:37 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
can you send the code which is not working for you?
j
On 18/03/18 18:47, Richard wrote:
> In my UDO I am trying to create a AHD envelope.
> I have code like this:
>
> ; Ktrig could come from a LFO.
> iTotal = iAtt + iHold + iDec
>
> if kTrig > 0 then
> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
> endif
>
>
> But since linseg ues i-rate arguments I think I have to use reinit, but
> don't know how in this case..
>
> Richard
>
> 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
>
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 |
| Date | 2018-03-18 19:30 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
well, it's a bit complicated. This is part of the clavia to csd project
(pch2csd).
it is a patch with a LFO triggering the envelope that works on an oscillator
Here is the UDO:
opcode EnvAHD, 0, kiikikkkkkkk
; parameters inputs outputs
kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut xin
; NOT FORGET ABOUT KEYBOARD KB
; NO SHAPE IMPLEMENTED
kIn zkr kInI
kAM zkr kAMI
kTrig zkr kTrigI
; 0 1 2 3 4 5
k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
k3[] fillarray 1, -1, 1, -1, 1, -1
kEnv init 0
kTimer init 0
kSet init 0
kStage init 0
iTotal = iAtt+iHold+iDec
if kTrig > 0 then
kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
endif
kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
zkw kEnvH, kEnvO
zkw kIn*kEnvH, kOut
endop
It is used in instr 1 (continues running) like so:
instr 1
; Module Parameters Modes Inlets Outlets
A2K 7, 7
LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
K2A 9, 9
OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
Out2 0,1,0, 8,9
EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
K2A 9, 8
endin
Important is that instr1 (and therefore the EnvAHD UDO) is running
continues.
What I think is wrong with this code:
if kTrig > 0 then
kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
endif
is that linseg might be triggered at every k value > 0, so also on a
rising sine.
Or is it triggered only once, since it uses i-rate params?
Richard
On 18/03/18 19:37, joachim heintz wrote:
> can you send the code which is not working for you?
> j
>
>
>
> On 18/03/18 18:47, Richard wrote:
>> In my UDO I am trying to create a AHD envelope.
>> I have code like this:
>>
>> ; Ktrig could come from a LFO.
>> iTotal = iAtt + iHold + iDec
>>
>> if kTrig > 0 then
>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>> endif
>>
>>
>> But since linseg ues i-rate arguments I think I have to use reinit, but
>> don't know how in this case..
>>
>> Richard
>>
>> 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
>>
>
> 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
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 |
| Date | 2018-03-18 19:59 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
hm - not sure what i miss but i don't see any ktrig in your code. i
only see fixed numbers you give to your UDO as input. if you like,
perhaps you can describe as simple as possible what you want to do.
j
On 18/03/18 20:30, Richard wrote:
> well, it's a bit complicated. This is part of the clavia to csd project
> (pch2csd).
> it is a patch with a LFO triggering the envelope that works on an
> oscillator
>
> Here is the UDO:
>
> opcode EnvAHD, 0, kiikikkkkkkk
> ; parameters inputs outputs
> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut xin
> ; NOT FORGET ABOUT KEYBOARD KB
> ; NO SHAPE IMPLEMENTED
> kIn zkr kInI
> kAM zkr kAMI
> kTrig zkr kTrigI
>
> ; 0 1 2 3 4 5
> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
> k3[] fillarray 1, -1, 1, -1, 1, -1
>
> kEnv init 0
> kTimer init 0
> kSet init 0
> kStage init 0
> iTotal = iAtt+iHold+iDec
>
> if kTrig > 0 then
> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
> endif
>
> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
> zkw kEnvH, kEnvO
> zkw kIn*kEnvH, kOut
> endop
>
> It is used in instr 1 (continues running) like so:
> instr 1
> ; Module Parameters Modes Inlets Outlets
> A2K 7, 7
> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
> K2A 9, 9
> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
> Out2 0,1,0, 8,9
> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
> K2A 9, 8
> endin
>
> Important is that instr1 (and therefore the EnvAHD UDO) is running
> continues.
> What I think is wrong with this code:
> if kTrig > 0 then
> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
> endif
>
> is that linseg might be triggered at every k value > 0, so also on a
> rising sine.
> Or is it triggered only once, since it uses i-rate params?
>
> Richard
> On 18/03/18 19:37, joachim heintz wrote:
>> can you send the code which is not working for you?
>> j
>>
>>
>>
>> On 18/03/18 18:47, Richard wrote:
>>> In my UDO I am trying to create a AHD envelope.
>>> I have code like this:
>>>
>>> ; Ktrig could come from a LFO.
>>> iTotal = iAtt + iHold + iDec
>>>
>>> if kTrig > 0 then
>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>> endif
>>>
>>>
>>> But since linseg ues i-rate arguments I think I have to use reinit, but
>>> don't know how in this case..
>>>
>>> Richard
>>>
>>> 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
>>>
>>
>> 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
>
> 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
>
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 |
| Date | 2018-03-18 20:33 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
All communication between UDO's in this project go via zak busses. so
the numbers are zak bus numbers.
You can read more about it here:
https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
input).
That works. When I do printk2 on kTrig I see the values coming in.
My question is: how do I trigger the linseg line when KTrig > 0 (or any
other value)?
I guess I have to do something with reninit, since instr 1 (and thus all
UDO's) are run continues..
Richard
On 18/03/18 20:59, joachim heintz wrote:
> hm - not sure what i miss but i don't see any ktrig in your code. i
> only see fixed numbers you give to your UDO as input. if you like,
> perhaps you can describe as simple as possible what you want to do.
> j
>
>
>
> On 18/03/18 20:30, Richard wrote:
>> well, it's a bit complicated. This is part of the clavia to csd project
>> (pch2csd).
>> it is a patch with a LFO triggering the envelope that works on an
>> oscillator
>>
>> Here is the UDO:
>>
>> opcode EnvAHD, 0, kiikikkkkkkk
>> ; parameters inputs outputs
>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut xin
>> ; NOT FORGET ABOUT KEYBOARD KB
>> ; NO SHAPE IMPLEMENTED
>> kIn zkr kInI
>> kAM zkr kAMI
>> kTrig zkr kTrigI
>>
>> ; 0 1 2 3 4 5
>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>
>> kEnv init 0
>> kTimer init 0
>> kSet init 0
>> kStage init 0
>> iTotal = iAtt+iHold+iDec
>>
>> if kTrig > 0 then
>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>> endif
>>
>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>> zkw kEnvH, kEnvO
>> zkw kIn*kEnvH, kOut
>> endop
>>
>> It is used in instr 1 (continues running) like so:
>> instr 1
>> ; Module Parameters Modes Inlets Outlets
>> A2K 7, 7
>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>> K2A 9, 9
>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>> Out2 0,1,0, 8,9
>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>> K2A 9, 8
>> endin
>>
>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>> continues.
>> What I think is wrong with this code:
>> if kTrig > 0 then
>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>> endif
>>
>> is that linseg might be triggered at every k value > 0, so also on a
>> rising sine.
>> Or is it triggered only once, since it uses i-rate params?
>>
>> Richard
>> On 18/03/18 19:37, joachim heintz wrote:
>>> can you send the code which is not working for you?
>>> j
>>>
>>>
>>>
>>> On 18/03/18 18:47, Richard wrote:
>>>> In my UDO I am trying to create a AHD envelope.
>>>> I have code like this:
>>>>
>>>> ; Ktrig could come from a LFO.
>>>> iTotal = iAtt + iHold + iDec
>>>>
>>>> if kTrig > 0 then
>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>>> endif
>>>>
>>>>
>>>> But since linseg ues i-rate arguments I think I have to use reinit,
>>>> but
>>>> don't know how in this case..
>>>>
>>>> Richard
>>>>
>>>> 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
>>>>
>>>
>>> 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
>>
>> 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
>>
>
> 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
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 |
| Date | 2018-03-18 20:50 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
perhaps you could do something like this:
kOn init 0
if kTrig > 0 && changed(kTrig) == 1 then
kOne = 1
endif
if kOn == 1 then
kEnv linseg ...
endif
in the first if-clause, you ask for the change, to set a "toggle2 to on.
you must seperate this, because the first clause has to be asked for
ONE moment (k-cycle), but has to switch on a state which is at least as
long as your envelope is. this is the reason why two if clauses are
needed (perhaps there are other solutions). but i don't think any
reinit is necessary.
On 18/03/18 21:33, Richard wrote:
> All communication between UDO's in this project go via zak busses. so
> the numbers are zak bus numbers.
> You can read more about it here:
> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>
> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
> input).
> That works. When I do printk2 on kTrig I see the values coming in.
> My question is: how do I trigger the linseg line when KTrig > 0 (or any
> other value)?
> I guess I have to do something with reninit, since instr 1 (and thus all
> UDO's) are run continues..
>
> Richard
>
>
> On 18/03/18 20:59, joachim heintz wrote:
>> hm - not sure what i miss but i don't see any ktrig in your code. i
>> only see fixed numbers you give to your UDO as input. if you like,
>> perhaps you can describe as simple as possible what you want to do.
>> j
>>
>>
>>
>> On 18/03/18 20:30, Richard wrote:
>>> well, it's a bit complicated. This is part of the clavia to csd project
>>> (pch2csd).
>>> it is a patch with a LFO triggering the envelope that works on an
>>> oscillator
>>>
>>> Here is the UDO:
>>>
>>> opcode EnvAHD, 0, kiikikkkkkkk
>>> ; parameters inputs outputs
>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut xin
>>> ; NOT FORGET ABOUT KEYBOARD KB
>>> ; NO SHAPE IMPLEMENTED
>>> kIn zkr kInI
>>> kAM zkr kAMI
>>> kTrig zkr kTrigI
>>>
>>> ; 0 1 2 3 4 5
>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>
>>> kEnv init 0
>>> kTimer init 0
>>> kSet init 0
>>> kStage init 0
>>> iTotal = iAtt+iHold+iDec
>>>
>>> if kTrig > 0 then
>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>> endif
>>>
>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>> zkw kEnvH, kEnvO
>>> zkw kIn*kEnvH, kOut
>>> endop
>>>
>>> It is used in instr 1 (continues running) like so:
>>> instr 1
>>> ; Module Parameters Modes Inlets Outlets
>>> A2K 7, 7
>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>> K2A 9, 9
>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>> Out2 0,1,0, 8,9
>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>> K2A 9, 8
>>> endin
>>>
>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>> continues.
>>> What I think is wrong with this code:
>>> if kTrig > 0 then
>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>> endif
>>>
>>> is that linseg might be triggered at every k value > 0, so also on a
>>> rising sine.
>>> Or is it triggered only once, since it uses i-rate params?
>>>
>>> Richard
>>> On 18/03/18 19:37, joachim heintz wrote:
>>>> can you send the code which is not working for you?
>>>> j
>>>>
>>>>
>>>>
>>>> On 18/03/18 18:47, Richard wrote:
>>>>> In my UDO I am trying to create a AHD envelope.
>>>>> I have code like this:
>>>>>
>>>>> ; Ktrig could come from a LFO.
>>>>> iTotal = iAtt + iHold + iDec
>>>>>
>>>>> if kTrig > 0 then
>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>>>> endif
>>>>>
>>>>>
>>>>> But since linseg ues i-rate arguments I think I have to use reinit,
>>>>> but
>>>>> don't know how in this case..
>>>>>
>>>>> Richard
>>>>>
>>>>> 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
>>>>>
>>>>
>>>> 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
>>>
>>> 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
>>>
>>
>> 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
>
> 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
>
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 |
| Date | 2018-03-18 21:24 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
sorry, the first if-clause is nonsense. you must ask whether kTrig is
now greater than 0, but the first time. so should be something like:
kOn init 0
kPreviousTrig init -1
if kTrig > 0 && kPreviousTrig <= 0 then
kOn = 1
endif
if kOn == 1 then
kEnv linseg ...
endif
kPreviousTrig = kTrig ;set for next k-cycle
On 18/03/18 21:50, joachim heintz wrote:
> perhaps you could do something like this:
>
> kOn init 0
>
> if kTrig > 0 && changed(kTrig) == 1 then
> kOne = 1
> endif
>
> if kOn == 1 then
> kEnv linseg ...
> endif
>
> in the first if-clause, you ask for the change, to set a "toggle2 to on.
> you must seperate this, because the first clause has to be asked for
> ONE moment (k-cycle), but has to switch on a state which is at least as
> long as your envelope is. this is the reason why two if clauses are
> needed (perhaps there are other solutions). but i don't think any
> reinit is necessary.
>
>
>
> On 18/03/18 21:33, Richard wrote:
>> All communication between UDO's in this project go via zak busses. so
>> the numbers are zak bus numbers.
>> You can read more about it here:
>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>
>> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
>> input).
>> That works. When I do printk2 on kTrig I see the values coming in.
>> My question is: how do I trigger the linseg line when KTrig > 0 (or any
>> other value)?
>> I guess I have to do something with reninit, since instr 1 (and thus all
>> UDO's) are run continues..
>>
>> Richard
>>
>>
>> On 18/03/18 20:59, joachim heintz wrote:
>>> hm - not sure what i miss but i don't see any ktrig in your code. i
>>> only see fixed numbers you give to your UDO as input. if you like,
>>> perhaps you can describe as simple as possible what you want to do.
>>> j
>>>
>>>
>>>
>>> On 18/03/18 20:30, Richard wrote:
>>>> well, it's a bit complicated. This is part of the clavia to csd project
>>>> (pch2csd).
>>>> it is a patch with a LFO triggering the envelope that works on an
>>>> oscillator
>>>>
>>>> Here is the UDO:
>>>>
>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>> ; parameters inputs outputs
>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut
>>>> xin
>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>> ; NO SHAPE IMPLEMENTED
>>>> kIn zkr kInI
>>>> kAM zkr kAMI
>>>> kTrig zkr kTrigI
>>>>
>>>> ; 0 1 2 3 4 5
>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>
>>>> kEnv init 0
>>>> kTimer init 0
>>>> kSet init 0
>>>> kStage init 0
>>>> iTotal = iAtt+iHold+iDec
>>>>
>>>> if kTrig > 0 then
>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>>> endif
>>>>
>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>> zkw kEnvH, kEnvO
>>>> zkw kIn*kEnvH, kOut
>>>> endop
>>>>
>>>> It is used in instr 1 (continues running) like so:
>>>> instr 1
>>>> ; Module Parameters Modes Inlets Outlets
>>>> A2K 7, 7
>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>> K2A 9, 9
>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>> Out2 0,1,0, 8,9
>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>> K2A 9, 8
>>>> endin
>>>>
>>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>>> continues.
>>>> What I think is wrong with this code:
>>>> if kTrig > 0 then
>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>>>> endif
>>>>
>>>> is that linseg might be triggered at every k value > 0, so also on a
>>>> rising sine.
>>>> Or is it triggered only once, since it uses i-rate params?
>>>>
>>>> Richard
>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>> can you send the code which is not working for you?
>>>>> j
>>>>>
>>>>>
>>>>>
>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>> I have code like this:
>>>>>>
>>>>>> ; Ktrig could come from a LFO.
>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>
>>>>>> if kTrig > 0 then
>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>> iTotal/iDec, 0
>>>>>> endif
>>>>>>
>>>>>>
>>>>>> But since linseg ues i-rate arguments I think I have to use reinit,
>>>>>> but
>>>>>> don't know how in this case..
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>> 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
>>>>>>
>>>>>
>>>>> 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
>>>>
>>>> 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
>>>>
>>>
>>> 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
>>
>> 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
>>
>
> 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
>
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 |
| Date | 2018-03-18 22:12 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
| Attachments | envAHD.pch2.csd |
It almost works, except I get a continuous tone.For some reason kOn
never becomes 1.
I have attached the full csd now...
On 18/03/18 22:24, joachim heintz wrote:
> sorry, the first if-clause is nonsense. you must ask whether kTrig is
> now greater than 0, but the first time. so should be something like:
>
> kOn init 0
> kPreviousTrig init -1
>
> if kTrig > 0 && kPreviousTrig <= 0 then
> kOn = 1
> endif
>
> if kOn == 1 then
> kEnv linseg ...
> endif
>
> kPreviousTrig = kTrig ;set for next k-cycle
>
>
>
> On 18/03/18 21:50, joachim heintz wrote:
>> perhaps you could do something like this:
>>
>> kOn init 0
>>
>> if kTrig > 0 && changed(kTrig) == 1 then
>> kOne = 1
>> endif
>>
>> if kOn == 1 then
>> kEnv linseg ...
>> endif
>>
>> in the first if-clause, you ask for the change, to set a "toggle2 to on.
>> you must seperate this, because the first clause has to be asked for
>> ONE moment (k-cycle), but has to switch on a state which is at least as
>> long as your envelope is. this is the reason why two if clauses are
>> needed (perhaps there are other solutions). but i don't think any
>> reinit is necessary.
>>
>>
>>
>> On 18/03/18 21:33, Richard wrote:
>>> All communication between UDO's in this project go via zak busses. so
>>> the numbers are zak bus numbers.
>>> You can read more about it here:
>>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>>
>>> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
>>> input).
>>> That works. When I do printk2 on kTrig I see the values coming in.
>>> My question is: how do I trigger the linseg line when KTrig > 0 (or any
>>> other value)?
>>> I guess I have to do something with reninit, since instr 1 (and thus
>>> all
>>> UDO's) are run continues..
>>>
>>> Richard
>>>
>>>
>>> On 18/03/18 20:59, joachim heintz wrote:
>>>> hm - not sure what i miss but i don't see any ktrig in your code. i
>>>> only see fixed numbers you give to your UDO as input. if you like,
>>>> perhaps you can describe as simple as possible what you want to do.
>>>> j
>>>>
>>>>
>>>>
>>>> On 18/03/18 20:30, Richard wrote:
>>>>> well, it's a bit complicated. This is part of the clavia to csd
>>>>> project
>>>>> (pch2csd).
>>>>> it is a patch with a LFO triggering the envelope that works on an
>>>>> oscillator
>>>>>
>>>>> Here is the UDO:
>>>>>
>>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>>> ; parameters inputs outputs
>>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut
>>>>> xin
>>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>>> ; NO SHAPE IMPLEMENTED
>>>>> kIn zkr kInI
>>>>> kAM zkr kAMI
>>>>> kTrig zkr kTrigI
>>>>>
>>>>> ; 0 1 2 3 4 5
>>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>>
>>>>> kEnv init 0
>>>>> kTimer init 0
>>>>> kSet init 0
>>>>> kStage init 0
>>>>> iTotal = iAtt+iHold+iDec
>>>>>
>>>>> if kTrig > 0 then
>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>> iTotal/iDec, 0
>>>>> endif
>>>>>
>>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>>> zkw kEnvH, kEnvO
>>>>> zkw kIn*kEnvH, kOut
>>>>> endop
>>>>>
>>>>> It is used in instr 1 (continues running) like so:
>>>>> instr 1
>>>>> ; Module Parameters Modes Inlets Outlets
>>>>> A2K 7, 7
>>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>>> K2A 9, 9
>>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>>> Out2 0,1,0, 8,9
>>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>>> K2A 9, 8
>>>>> endin
>>>>>
>>>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>>>> continues.
>>>>> What I think is wrong with this code:
>>>>> if kTrig > 0 then
>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>> iTotal/iDec, 0
>>>>> endif
>>>>>
>>>>> is that linseg might be triggered at every k value > 0, so also on a
>>>>> rising sine.
>>>>> Or is it triggered only once, since it uses i-rate params?
>>>>>
>>>>> Richard
>>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>>> can you send the code which is not working for you?
>>>>>> j
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>>> I have code like this:
>>>>>>>
>>>>>>> ; Ktrig could come from a LFO.
>>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>>
>>>>>>> if kTrig > 0 then
>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>> iTotal/iDec, 0
>>>>>>> endif
>>>>>>>
>>>>>>>
>>>>>>> But since linseg ues i-rate arguments I think I have to use reinit,
>>>>>>> but
>>>>>>> don't know how in this case..
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>> 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
>>>>>
>>>>> 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
>>>>>
>>>>
>>>> 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
>>>
>>> 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
>>>
>>
>> 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
>>
>
> 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
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
|
| Date | 2018-03-19 06:20 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
i think this line is wrong:
if kTrig > 60.0 && kPreviousTrig <= 0 then
try:
if kTrig > 60.0 && kPreviousTrig <= 60 then
joachim
On 18/03/18 23:12, Richard wrote:
> It almost works, except I get a continuous tone.For some reason kOn
> never becomes 1.
> I have attached the full csd now...
>
> On 18/03/18 22:24, joachim heintz wrote:
>> sorry, the first if-clause is nonsense. you must ask whether kTrig is
>> now greater than 0, but the first time. so should be something like:
>>
>> kOn init 0
>> kPreviousTrig init -1
>>
>> if kTrig > 0 && kPreviousTrig <= 0 then
>> kOn = 1
>> endif
>>
>> if kOn == 1 then
>> kEnv linseg ...
>> endif
>>
>> kPreviousTrig = kTrig ;set for next k-cycle
>>
>>
>>
>> On 18/03/18 21:50, joachim heintz wrote:
>>> perhaps you could do something like this:
>>>
>>> kOn init 0
>>>
>>> if kTrig > 0 && changed(kTrig) == 1 then
>>> kOne = 1
>>> endif
>>>
>>> if kOn == 1 then
>>> kEnv linseg ...
>>> endif
>>>
>>> in the first if-clause, you ask for the change, to set a "toggle2 to on.
>>> you must seperate this, because the first clause has to be asked for
>>> ONE moment (k-cycle), but has to switch on a state which is at least as
>>> long as your envelope is. this is the reason why two if clauses are
>>> needed (perhaps there are other solutions). but i don't think any
>>> reinit is necessary.
>>>
>>>
>>>
>>> On 18/03/18 21:33, Richard wrote:
>>>> All communication between UDO's in this project go via zak busses. so
>>>> the numbers are zak bus numbers.
>>>> You can read more about it here:
>>>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>>>
>>>> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
>>>> input).
>>>> That works. When I do printk2 on kTrig I see the values coming in.
>>>> My question is: how do I trigger the linseg line when KTrig > 0 (or any
>>>> other value)?
>>>> I guess I have to do something with reninit, since instr 1 (and thus
>>>> all
>>>> UDO's) are run continues..
>>>>
>>>> Richard
>>>>
>>>>
>>>> On 18/03/18 20:59, joachim heintz wrote:
>>>>> hm - not sure what i miss but i don't see any ktrig in your code. i
>>>>> only see fixed numbers you give to your UDO as input. if you like,
>>>>> perhaps you can describe as simple as possible what you want to do.
>>>>> j
>>>>>
>>>>>
>>>>>
>>>>> On 18/03/18 20:30, Richard wrote:
>>>>>> well, it's a bit complicated. This is part of the clavia to csd
>>>>>> project
>>>>>> (pch2csd).
>>>>>> it is a patch with a LFO triggering the envelope that works on an
>>>>>> oscillator
>>>>>>
>>>>>> Here is the UDO:
>>>>>>
>>>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>>>> ; parameters inputs outputs
>>>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI, kEnvO,kOut
>>>>>> xin
>>>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>>>> ; NO SHAPE IMPLEMENTED
>>>>>> kIn zkr kInI
>>>>>> kAM zkr kAMI
>>>>>> kTrig zkr kTrigI
>>>>>>
>>>>>> ; 0 1 2 3 4 5
>>>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>>>
>>>>>> kEnv init 0
>>>>>> kTimer init 0
>>>>>> kSet init 0
>>>>>> kStage init 0
>>>>>> iTotal = iAtt+iHold+iDec
>>>>>>
>>>>>> if kTrig > 0 then
>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>> iTotal/iDec, 0
>>>>>> endif
>>>>>>
>>>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>>>> zkw kEnvH, kEnvO
>>>>>> zkw kIn*kEnvH, kOut
>>>>>> endop
>>>>>>
>>>>>> It is used in instr 1 (continues running) like so:
>>>>>> instr 1
>>>>>> ; Module Parameters Modes Inlets Outlets
>>>>>> A2K 7, 7
>>>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>>>> K2A 9, 9
>>>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>>>> Out2 0,1,0, 8,9
>>>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>>>> K2A 9, 8
>>>>>> endin
>>>>>>
>>>>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>>>>> continues.
>>>>>> What I think is wrong with this code:
>>>>>> if kTrig > 0 then
>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>> iTotal/iDec, 0
>>>>>> endif
>>>>>>
>>>>>> is that linseg might be triggered at every k value > 0, so also on a
>>>>>> rising sine.
>>>>>> Or is it triggered only once, since it uses i-rate params?
>>>>>>
>>>>>> Richard
>>>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>>>> can you send the code which is not working for you?
>>>>>>> j
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>>>> I have code like this:
>>>>>>>>
>>>>>>>> ; Ktrig could come from a LFO.
>>>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>>>
>>>>>>>> if kTrig > 0 then
>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>> iTotal/iDec, 0
>>>>>>>> endif
>>>>>>>>
>>>>>>>>
>>>>>>>> But since linseg ues i-rate arguments I think I have to use reinit,
>>>>>>>> but
>>>>>>>> don't know how in this case..
>>>>>>>>
>>>>>>>> Richard
>>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>> 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
>>>>>>
>>>>>
>>>>> 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
>>>>
>>>> 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
>>>>
>>>
>>> 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
>>>
>>
>> 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
>
>
> 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
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 |
| Date | 2018-03-19 07:32 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
Still the same result. I'll look into it later today.
Richard
On 19/03/18 07:20, joachim heintz wrote:
> i think this line is wrong:
>
> if kTrig > 60.0 && kPreviousTrig <= 0 then
>
> try:
>
> if kTrig > 60.0 && kPreviousTrig <= 60 then
>
> joachim
>
>
> On 18/03/18 23:12, Richard wrote:
>> It almost works, except I get a continuous tone.For some reason kOn
>> never becomes 1.
>> I have attached the full csd now...
>>
>> On 18/03/18 22:24, joachim heintz wrote:
>>> sorry, the first if-clause is nonsense. you must ask whether kTrig is
>>> now greater than 0, but the first time. so should be something like:
>>>
>>> kOn init 0
>>> kPreviousTrig init -1
>>>
>>> if kTrig > 0 && kPreviousTrig <= 0 then
>>> kOn = 1
>>> endif
>>>
>>> if kOn == 1 then
>>> kEnv linseg ...
>>> endif
>>>
>>> kPreviousTrig = kTrig ;set for next k-cycle
>>>
>>>
>>>
>>> On 18/03/18 21:50, joachim heintz wrote:
>>>> perhaps you could do something like this:
>>>>
>>>> kOn init 0
>>>>
>>>> if kTrig > 0 && changed(kTrig) == 1 then
>>>> kOne = 1
>>>> endif
>>>>
>>>> if kOn == 1 then
>>>> kEnv linseg ...
>>>> endif
>>>>
>>>> in the first if-clause, you ask for the change, to set a "toggle2
>>>> to on.
>>>> you must seperate this, because the first clause has to be asked for
>>>> ONE moment (k-cycle), but has to switch on a state which is at
>>>> least as
>>>> long as your envelope is. this is the reason why two if clauses are
>>>> needed (perhaps there are other solutions). but i don't think any
>>>> reinit is necessary.
>>>>
>>>>
>>>>
>>>> On 18/03/18 21:33, Richard wrote:
>>>>> All communication between UDO's in this project go via zak busses. so
>>>>> the numbers are zak bus numbers.
>>>>> You can read more about it here:
>>>>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>>>>
>>>>> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
>>>>> input).
>>>>> That works. When I do printk2 on kTrig I see the values coming in.
>>>>> My question is: how do I trigger the linseg line when KTrig > 0
>>>>> (or any
>>>>> other value)?
>>>>> I guess I have to do something with reninit, since instr 1 (and thus
>>>>> all
>>>>> UDO's) are run continues..
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>> On 18/03/18 20:59, joachim heintz wrote:
>>>>>> hm - not sure what i miss but i don't see any ktrig in your code. i
>>>>>> only see fixed numbers you give to your UDO as input. if you like,
>>>>>> perhaps you can describe as simple as possible what you want to do.
>>>>>> j
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 18/03/18 20:30, Richard wrote:
>>>>>>> well, it's a bit complicated. This is part of the clavia to csd
>>>>>>> project
>>>>>>> (pch2csd).
>>>>>>> it is a patch with a LFO triggering the envelope that works on an
>>>>>>> oscillator
>>>>>>>
>>>>>>> Here is the UDO:
>>>>>>>
>>>>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>>>>> ; parameters inputs outputs
>>>>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI,
>>>>>>> kEnvO,kOut
>>>>>>> xin
>>>>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>>>>> ; NO SHAPE IMPLEMENTED
>>>>>>> kIn zkr kInI
>>>>>>> kAM zkr kAMI
>>>>>>> kTrig zkr kTrigI
>>>>>>>
>>>>>>> ; 0 1 2 3 4 5
>>>>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>>>>
>>>>>>> kEnv init 0
>>>>>>> kTimer init 0
>>>>>>> kSet init 0
>>>>>>> kStage init 0
>>>>>>> iTotal = iAtt+iHold+iDec
>>>>>>>
>>>>>>> if kTrig > 0 then
>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>> iTotal/iDec, 0
>>>>>>> endif
>>>>>>>
>>>>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>>>>> zkw kEnvH, kEnvO
>>>>>>> zkw kIn*kEnvH, kOut
>>>>>>> endop
>>>>>>>
>>>>>>> It is used in instr 1 (continues running) like so:
>>>>>>> instr 1
>>>>>>> ; Module Parameters Modes Inlets Outlets
>>>>>>> A2K 7, 7
>>>>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>>>>> K2A 9, 9
>>>>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>>>>> Out2 0,1,0, 8,9
>>>>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>>>>> K2A 9, 8
>>>>>>> endin
>>>>>>>
>>>>>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>>>>>> continues.
>>>>>>> What I think is wrong with this code:
>>>>>>> if kTrig > 0 then
>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>> iTotal/iDec, 0
>>>>>>> endif
>>>>>>>
>>>>>>> is that linseg might be triggered at every k value > 0, so also
>>>>>>> on a
>>>>>>> rising sine.
>>>>>>> Or is it triggered only once, since it uses i-rate params?
>>>>>>>
>>>>>>> Richard
>>>>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>>>>> can you send the code which is not working for you?
>>>>>>>> j
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>>>>> I have code like this:
>>>>>>>>>
>>>>>>>>> ; Ktrig could come from a LFO.
>>>>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>>>>
>>>>>>>>> if kTrig > 0 then
>>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>>> iTotal/iDec, 0
>>>>>>>>> endif
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> But since linseg ues i-rate arguments I think I have to use
>>>>>>>>> reinit,
>>>>>>>>> but
>>>>>>>>> don't know how in this case..
>>>>>>>>>
>>>>>>>>> Richard
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>
>>>>>>>> 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
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>> 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
>>>>>
>>>>> 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
>>>>>
>>>>
>>>> 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
>>>>
>>>
>>> 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
>>
>>
>> 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
>
> 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
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 |
| Date | 2018-03-19 21:33 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
I changed it a bit, but still not working.
I do not get it, kOn only changes once from 0 to 1, but not after that:
kOn init 0
kCount init 0
if kTrig > 60.0 && kOn==0 then
kOn = 1
endif
if kOn >= 1 then
printk2 kOn
;kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
kEnv linseg 0, 1, 0.9, .5, 0.9, 1, 0
kCount += 1
endif
if kCount>10 && kEnv==0 then ; kEnv becomes 0 again at the end of the
envelope
kOn = 0
kCount = 0
printk2 kOn
endif
Richard
On 19/03/18 07:20, joachim heintz wrote:
> i think this line is wrong:
>
> if kTrig > 60.0 && kPreviousTrig <= 0 then
>
> try:
>
> if kTrig > 60.0 && kPreviousTrig <= 60 then
>
> joachim
>
>
> On 18/03/18 23:12, Richard wrote:
>> It almost works, except I get a continuous tone.For some reason kOn
>> never becomes 1.
>> I have attached the full csd now...
>>
>> On 18/03/18 22:24, joachim heintz wrote:
>>> sorry, the first if-clause is nonsense. you must ask whether kTrig is
>>> now greater than 0, but the first time. so should be something like:
>>>
>>> kOn init 0
>>> kPreviousTrig init -1
>>>
>>> if kTrig > 0 && kPreviousTrig <= 0 then
>>> kOn = 1
>>> endif
>>>
>>> if kOn == 1 then
>>> kEnv linseg ...
>>> endif
>>>
>>> kPreviousTrig = kTrig ;set for next k-cycle
>>>
>>>
>>>
>>> On 18/03/18 21:50, joachim heintz wrote:
>>>> perhaps you could do something like this:
>>>>
>>>> kOn init 0
>>>>
>>>> if kTrig > 0 && changed(kTrig) == 1 then
>>>> kOne = 1
>>>> endif
>>>>
>>>> if kOn == 1 then
>>>> kEnv linseg ...
>>>> endif
>>>>
>>>> in the first if-clause, you ask for the change, to set a "toggle2
>>>> to on.
>>>> you must seperate this, because the first clause has to be asked for
>>>> ONE moment (k-cycle), but has to switch on a state which is at
>>>> least as
>>>> long as your envelope is. this is the reason why two if clauses are
>>>> needed (perhaps there are other solutions). but i don't think any
>>>> reinit is necessary.
>>>>
>>>>
>>>>
>>>> On 18/03/18 21:33, Richard wrote:
>>>>> All communication between UDO's in this project go via zak busses. so
>>>>> the numbers are zak bus numbers.
>>>>> You can read more about it here:
>>>>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>>>>
>>>>> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
>>>>> input).
>>>>> That works. When I do printk2 on kTrig I see the values coming in.
>>>>> My question is: how do I trigger the linseg line when KTrig > 0
>>>>> (or any
>>>>> other value)?
>>>>> I guess I have to do something with reninit, since instr 1 (and thus
>>>>> all
>>>>> UDO's) are run continues..
>>>>>
>>>>> Richard
>>>>>
>>>>>
>>>>> On 18/03/18 20:59, joachim heintz wrote:
>>>>>> hm - not sure what i miss but i don't see any ktrig in your code. i
>>>>>> only see fixed numbers you give to your UDO as input. if you like,
>>>>>> perhaps you can describe as simple as possible what you want to do.
>>>>>> j
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 18/03/18 20:30, Richard wrote:
>>>>>>> well, it's a bit complicated. This is part of the clavia to csd
>>>>>>> project
>>>>>>> (pch2csd).
>>>>>>> it is a patch with a LFO triggering the envelope that works on an
>>>>>>> oscillator
>>>>>>>
>>>>>>> Here is the UDO:
>>>>>>>
>>>>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>>>>> ; parameters inputs outputs
>>>>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI,
>>>>>>> kEnvO,kOut
>>>>>>> xin
>>>>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>>>>> ; NO SHAPE IMPLEMENTED
>>>>>>> kIn zkr kInI
>>>>>>> kAM zkr kAMI
>>>>>>> kTrig zkr kTrigI
>>>>>>>
>>>>>>> ; 0 1 2 3 4 5
>>>>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>>>>
>>>>>>> kEnv init 0
>>>>>>> kTimer init 0
>>>>>>> kSet init 0
>>>>>>> kStage init 0
>>>>>>> iTotal = iAtt+iHold+iDec
>>>>>>>
>>>>>>> if kTrig > 0 then
>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>> iTotal/iDec, 0
>>>>>>> endif
>>>>>>>
>>>>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>>>>> zkw kEnvH, kEnvO
>>>>>>> zkw kIn*kEnvH, kOut
>>>>>>> endop
>>>>>>>
>>>>>>> It is used in instr 1 (continues running) like so:
>>>>>>> instr 1
>>>>>>> ; Module Parameters Modes Inlets Outlets
>>>>>>> A2K 7, 7
>>>>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>>>>> K2A 9, 9
>>>>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>>>>> Out2 0,1,0, 8,9
>>>>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>>>>> K2A 9, 8
>>>>>>> endin
>>>>>>>
>>>>>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>>>>>> continues.
>>>>>>> What I think is wrong with this code:
>>>>>>> if kTrig > 0 then
>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>> iTotal/iDec, 0
>>>>>>> endif
>>>>>>>
>>>>>>> is that linseg might be triggered at every k value > 0, so also
>>>>>>> on a
>>>>>>> rising sine.
>>>>>>> Or is it triggered only once, since it uses i-rate params?
>>>>>>>
>>>>>>> Richard
>>>>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>>>>> can you send the code which is not working for you?
>>>>>>>> j
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>>>>> I have code like this:
>>>>>>>>>
>>>>>>>>> ; Ktrig could come from a LFO.
>>>>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>>>>
>>>>>>>>> if kTrig > 0 then
>>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>>> iTotal/iDec, 0
>>>>>>>>> endif
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> But since linseg ues i-rate arguments I think I have to use
>>>>>>>>> reinit,
>>>>>>>>> but
>>>>>>>>> don't know how in this case..
>>>>>>>>>
>>>>>>>>> Richard
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>
>>>>>>>> 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
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>> 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
>>>>>
>>>>> 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
>>>>>
>>>>
>>>> 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
>>>>
>>>
>>> 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
>>
>>
>> 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
>
> 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
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 |
| Date | 2018-03-20 06:57 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
i think you do not reset kOn to zero. you have a counter which probably
becomes 1, but not more. but you only reset kOn to zero if the counter
is greater than ten.
if you can construct a simple example with the kTrig signal, i am happy
to help if i can. but i have no idea about zak.
joachim
On 19/03/18 22:33, Richard wrote:
> I changed it a bit, but still not working.
> I do not get it, kOn only changes once from 0 to 1, but not after that:
>
> kOn init 0
> kCount init 0
>
> if kTrig > 60.0 && kOn==0 then
> kOn = 1
> endif
>
> if kOn >= 1 then
> printk2 kOn
> ;kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
> kEnv linseg 0, 1, 0.9, .5, 0.9, 1, 0
> kCount += 1
> endif
> if kCount>10 && kEnv==0 then ; kEnv becomes 0 again at the end of the
> envelope
> kOn = 0
> kCount = 0
> printk2 kOn
> endif
>
> Richard
>
> On 19/03/18 07:20, joachim heintz wrote:
>> i think this line is wrong:
>>
>> if kTrig > 60.0 && kPreviousTrig <= 0 then
>>
>> try:
>>
>> if kTrig > 60.0 && kPreviousTrig <= 60 then
>>
>> joachim
>>
>>
>> On 18/03/18 23:12, Richard wrote:
>>> It almost works, except I get a continuous tone.For some reason kOn
>>> never becomes 1.
>>> I have attached the full csd now...
>>>
>>> On 18/03/18 22:24, joachim heintz wrote:
>>>> sorry, the first if-clause is nonsense. you must ask whether kTrig is
>>>> now greater than 0, but the first time. so should be something like:
>>>>
>>>> kOn init 0
>>>> kPreviousTrig init -1
>>>>
>>>> if kTrig > 0 && kPreviousTrig <= 0 then
>>>> kOn = 1
>>>> endif
>>>>
>>>> if kOn == 1 then
>>>> kEnv linseg ...
>>>> endif
>>>>
>>>> kPreviousTrig = kTrig ;set for next k-cycle
>>>>
>>>>
>>>>
>>>> On 18/03/18 21:50, joachim heintz wrote:
>>>>> perhaps you could do something like this:
>>>>>
>>>>> kOn init 0
>>>>>
>>>>> if kTrig > 0 && changed(kTrig) == 1 then
>>>>> kOne = 1
>>>>> endif
>>>>>
>>>>> if kOn == 1 then
>>>>> kEnv linseg ...
>>>>> endif
>>>>>
>>>>> in the first if-clause, you ask for the change, to set a "toggle2
>>>>> to on.
>>>>> you must seperate this, because the first clause has to be asked for
>>>>> ONE moment (k-cycle), but has to switch on a state which is at
>>>>> least as
>>>>> long as your envelope is. this is the reason why two if clauses are
>>>>> needed (perhaps there are other solutions). but i don't think any
>>>>> reinit is necessary.
>>>>>
>>>>>
>>>>>
>>>>> On 18/03/18 21:33, Richard wrote:
>>>>>> All communication between UDO's in this project go via zak busses. so
>>>>>> the numbers are zak bus numbers.
>>>>>> You can read more about it here:
>>>>>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>>>>>
>>>>>> So LfoA outlet (8) is the first input for EnvAHD (that is the trigger
>>>>>> input).
>>>>>> That works. When I do printk2 on kTrig I see the values coming in.
>>>>>> My question is: how do I trigger the linseg line when KTrig > 0
>>>>>> (or any
>>>>>> other value)?
>>>>>> I guess I have to do something with reninit, since instr 1 (and thus
>>>>>> all
>>>>>> UDO's) are run continues..
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>> On 18/03/18 20:59, joachim heintz wrote:
>>>>>>> hm - not sure what i miss but i don't see any ktrig in your code. i
>>>>>>> only see fixed numbers you give to your UDO as input. if you like,
>>>>>>> perhaps you can describe as simple as possible what you want to do.
>>>>>>> j
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 18/03/18 20:30, Richard wrote:
>>>>>>>> well, it's a bit complicated. This is part of the clavia to csd
>>>>>>>> project
>>>>>>>> (pch2csd).
>>>>>>>> it is a patch with a LFO triggering the envelope that works on an
>>>>>>>> oscillator
>>>>>>>>
>>>>>>>> Here is the UDO:
>>>>>>>>
>>>>>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>>>>>> ; parameters inputs outputs
>>>>>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI,
>>>>>>>> kEnvO,kOut
>>>>>>>> xin
>>>>>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>>>>>> ; NO SHAPE IMPLEMENTED
>>>>>>>> kIn zkr kInI
>>>>>>>> kAM zkr kAMI
>>>>>>>> kTrig zkr kTrigI
>>>>>>>>
>>>>>>>> ; 0 1 2 3 4 5
>>>>>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>>>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>>>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>>>>>
>>>>>>>> kEnv init 0
>>>>>>>> kTimer init 0
>>>>>>>> kSet init 0
>>>>>>>> kStage init 0
>>>>>>>> iTotal = iAtt+iHold+iDec
>>>>>>>>
>>>>>>>> if kTrig > 0 then
>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>> iTotal/iDec, 0
>>>>>>>> endif
>>>>>>>>
>>>>>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>>>>>> zkw kEnvH, kEnvO
>>>>>>>> zkw kIn*kEnvH, kOut
>>>>>>>> endop
>>>>>>>>
>>>>>>>> It is used in instr 1 (continues running) like so:
>>>>>>>> instr 1
>>>>>>>> ; Module Parameters Modes Inlets Outlets
>>>>>>>> A2K 7, 7
>>>>>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>>>>>> K2A 9, 9
>>>>>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>>>>>> Out2 0,1,0, 8,9
>>>>>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>>>>>> K2A 9, 8
>>>>>>>> endin
>>>>>>>>
>>>>>>>> Important is that instr1 (and therefore the EnvAHD UDO) is running
>>>>>>>> continues.
>>>>>>>> What I think is wrong with this code:
>>>>>>>> if kTrig > 0 then
>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>> iTotal/iDec, 0
>>>>>>>> endif
>>>>>>>>
>>>>>>>> is that linseg might be triggered at every k value > 0, so also
>>>>>>>> on a
>>>>>>>> rising sine.
>>>>>>>> Or is it triggered only once, since it uses i-rate params?
>>>>>>>>
>>>>>>>> Richard
>>>>>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>>>>>> can you send the code which is not working for you?
>>>>>>>>> j
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>>>>>> I have code like this:
>>>>>>>>>>
>>>>>>>>>> ; Ktrig could come from a LFO.
>>>>>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>>>>>
>>>>>>>>>> if kTrig > 0 then
>>>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>>>> iTotal/iDec, 0
>>>>>>>>>> endif
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> But since linseg ues i-rate arguments I think I have to use
>>>>>>>>>> reinit,
>>>>>>>>>> but
>>>>>>>>>> don't know how in this case..
>>>>>>>>>>
>>>>>>>>>> Richard
>>>>>>>>>>
>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>
>>>>>>> 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
>>>>>>
>>>>>> 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
>>>>>>
>>>>>
>>>>> 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
>>>>>
>>>>
>>>> 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
>>>
>>>
>>> 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
>>
>> 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
>
> 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
>
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 |
| Date | 2018-03-20 21:21 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
| Attachments | envAHDtest.csd |
Here's a simple csd that shows the same problem.
This line:
if kCount>10 && kEnv==0 then
kOn = 0
should in fact wait till the end of the envelope, since then it becomes
0 again. The number 10 is just arbitrary. It should be > 1
since kEnv is also 0 at the start of the envelope
Richard
On 20/03/18 07:57, joachim heintz wrote:
> i think you do not reset kOn to zero. you have a counter which
> probably becomes 1, but not more. but you only reset kOn to zero if
> the counter is greater than ten.
>
> if you can construct a simple example with the kTrig signal, i am
> happy to help if i can. but i have no idea about zak.
>
> joachim
>
>
>
> On 19/03/18 22:33, Richard wrote:
>> I changed it a bit, but still not working.
>> I do not get it, kOn only changes once from 0 to 1, but not after that:
>>
>> kOn init 0
>> kCount init 0
>>
>> if kTrig > 60.0 && kOn==0 then
>> kOn = 1
>> endif
>>
>> if kOn >= 1 then
>> printk2 kOn
>> ;kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9, iTotal/iDec, 0
>> kEnv linseg 0, 1, 0.9, .5, 0.9, 1, 0
>> kCount += 1
>> endif
>> if kCount>10 && kEnv==0 then ; kEnv becomes 0 again at the end of the
>> envelope
>> kOn = 0
>> kCount = 0
>> printk2 kOn
>> endif
>>
>> Richard
>>
>> On 19/03/18 07:20, joachim heintz wrote:
>>> i think this line is wrong:
>>>
>>> if kTrig > 60.0 && kPreviousTrig <= 0 then
>>>
>>> try:
>>>
>>> if kTrig > 60.0 && kPreviousTrig <= 60 then
>>>
>>> joachim
>>>
>>>
>>> On 18/03/18 23:12, Richard wrote:
>>>> It almost works, except I get a continuous tone.For some reason kOn
>>>> never becomes 1.
>>>> I have attached the full csd now...
>>>>
>>>> On 18/03/18 22:24, joachim heintz wrote:
>>>>> sorry, the first if-clause is nonsense. you must ask whether kTrig is
>>>>> now greater than 0, but the first time. so should be something like:
>>>>>
>>>>> kOn init 0
>>>>> kPreviousTrig init -1
>>>>>
>>>>> if kTrig > 0 && kPreviousTrig <= 0 then
>>>>> kOn = 1
>>>>> endif
>>>>>
>>>>> if kOn == 1 then
>>>>> kEnv linseg ...
>>>>> endif
>>>>>
>>>>> kPreviousTrig = kTrig ;set for next k-cycle
>>>>>
>>>>>
>>>>>
>>>>> On 18/03/18 21:50, joachim heintz wrote:
>>>>>> perhaps you could do something like this:
>>>>>>
>>>>>> kOn init 0
>>>>>>
>>>>>> if kTrig > 0 && changed(kTrig) == 1 then
>>>>>> kOne = 1
>>>>>> endif
>>>>>>
>>>>>> if kOn == 1 then
>>>>>> kEnv linseg ...
>>>>>> endif
>>>>>>
>>>>>> in the first if-clause, you ask for the change, to set a "toggle2
>>>>>> to on.
>>>>>> you must seperate this, because the first clause has to be asked
>>>>>> for
>>>>>> ONE moment (k-cycle), but has to switch on a state which is at
>>>>>> least as
>>>>>> long as your envelope is. this is the reason why two if clauses are
>>>>>> needed (perhaps there are other solutions). but i don't think any
>>>>>> reinit is necessary.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 18/03/18 21:33, Richard wrote:
>>>>>>> All communication between UDO's in this project go via zak
>>>>>>> busses. so
>>>>>>> the numbers are zak bus numbers.
>>>>>>> You can read more about it here:
>>>>>>> https://github.com/gleb812/pch2csd/wiki/Making-a-new-module
>>>>>>>
>>>>>>> So LfoA outlet (8) is the first input for EnvAHD (that is the
>>>>>>> trigger
>>>>>>> input).
>>>>>>> That works. When I do printk2 on kTrig I see the values coming in.
>>>>>>> My question is: how do I trigger the linseg line when KTrig > 0
>>>>>>> (or any
>>>>>>> other value)?
>>>>>>> I guess I have to do something with reninit, since instr 1 (and
>>>>>>> thus
>>>>>>> all
>>>>>>> UDO's) are run continues..
>>>>>>>
>>>>>>> Richard
>>>>>>>
>>>>>>>
>>>>>>> On 18/03/18 20:59, joachim heintz wrote:
>>>>>>>> hm - not sure what i miss but i don't see any ktrig in your
>>>>>>>> code. i
>>>>>>>> only see fixed numbers you give to your UDO as input. if you like,
>>>>>>>> perhaps you can describe as simple as possible what you want to
>>>>>>>> do.
>>>>>>>> j
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 18/03/18 20:30, Richard wrote:
>>>>>>>>> well, it's a bit complicated. This is part of the clavia to csd
>>>>>>>>> project
>>>>>>>>> (pch2csd).
>>>>>>>>> it is a patch with a LFO triggering the envelope that works on an
>>>>>>>>> oscillator
>>>>>>>>>
>>>>>>>>> Here is the UDO:
>>>>>>>>>
>>>>>>>>> opcode EnvAHD, 0, kiikikkkkkkk
>>>>>>>>> ; parameters inputs outputs
>>>>>>>>> kShape,iAtt,iHold,kReset,iDec,kSW,kKBT, kTrigI,kAMI,kInI,
>>>>>>>>> kEnvO,kOut
>>>>>>>>> xin
>>>>>>>>> ; NOT FORGET ABOUT KEYBOARD KB
>>>>>>>>> ; NO SHAPE IMPLEMENTED
>>>>>>>>> kIn zkr kInI
>>>>>>>>> kAM zkr kAMI
>>>>>>>>> kTrig zkr kTrigI
>>>>>>>>>
>>>>>>>>> ; 0 1 2 3 4 5
>>>>>>>>> k1[] fillarray 0.5, 0.5, 0.5, 0.5, 1, 1
>>>>>>>>> k2[] fillarray 0.5, -0.5, -0.5, 0.5, 0, 0
>>>>>>>>> k3[] fillarray 1, -1, 1, -1, 1, -1
>>>>>>>>>
>>>>>>>>> kEnv init 0
>>>>>>>>> kTimer init 0
>>>>>>>>> kSet init 0
>>>>>>>>> kStage init 0
>>>>>>>>> iTotal = iAtt+iHold+iDec
>>>>>>>>>
>>>>>>>>> if kTrig > 0 then
>>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>>> iTotal/iDec, 0
>>>>>>>>> endif
>>>>>>>>>
>>>>>>>>> kEnvH = k1[kSW]*kEnv*(1-kAM)+k2[kSW]*k3[kSW]
>>>>>>>>> zkw kEnvH, kEnvO
>>>>>>>>> zkw kIn*kEnvH, kOut
>>>>>>>>> endop
>>>>>>>>>
>>>>>>>>> It is used in instr 1 (continues running) like so:
>>>>>>>>> instr 1
>>>>>>>>> ; Module Parameters Modes Inlets Outlets
>>>>>>>>> A2K 7, 7
>>>>>>>>> LfoA 0.64,0,0,0.0,0,1,4,1, 1, 8
>>>>>>>>> K2A 9, 9
>>>>>>>>> OscA 0.0,0.0,1,0.0,2,1,0, 1,1, 7
>>>>>>>>> Out2 0,1,0, 8,9
>>>>>>>>> EnvAHD 3,0.477,0.25,0,0.109,0,1, 8,1,7, 0,9
>>>>>>>>> K2A 9, 8
>>>>>>>>> endin
>>>>>>>>>
>>>>>>>>> Important is that instr1 (and therefore the EnvAHD UDO) is
>>>>>>>>> running
>>>>>>>>> continues.
>>>>>>>>> What I think is wrong with this code:
>>>>>>>>> if kTrig > 0 then
>>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>>> iTotal/iDec, 0
>>>>>>>>> endif
>>>>>>>>>
>>>>>>>>> is that linseg might be triggered at every k value > 0, so also
>>>>>>>>> on a
>>>>>>>>> rising sine.
>>>>>>>>> Or is it triggered only once, since it uses i-rate params?
>>>>>>>>>
>>>>>>>>> Richard
>>>>>>>>> On 18/03/18 19:37, joachim heintz wrote:
>>>>>>>>>> can you send the code which is not working for you?
>>>>>>>>>> j
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 18/03/18 18:47, Richard wrote:
>>>>>>>>>>> In my UDO I am trying to create a AHD envelope.
>>>>>>>>>>> I have code like this:
>>>>>>>>>>>
>>>>>>>>>>> ; Ktrig could come from a LFO.
>>>>>>>>>>> iTotal = iAtt + iHold + iDec
>>>>>>>>>>>
>>>>>>>>>>> if kTrig > 0 then
>>>>>>>>>>> kEnv linseg 0, iTotal/iAtt, 0.9, iTotal/iHold, 0.9,
>>>>>>>>>>> iTotal/iDec, 0
>>>>>>>>>>> endif
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> But since linseg ues i-rate arguments I think I have to use
>>>>>>>>>>> reinit,
>>>>>>>>>>> but
>>>>>>>>>>> don't know how in this case..
>>>>>>>>>>>
>>>>>>>>>>> Richard
>>>>>>>>>>>
>>>>>>>>>>> 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
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>
>>>>>>>> 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
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>> 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
>>>>>>
>>>>>
>>>>> 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
>>>>
>>>>
>>>> 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
>>>
>>> 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
>>
>> 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
>>
>
> 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
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
|
| Date | 2018-03-21 07:08 |
| From | joachim heintz |
| Subject | Re: [Csnd] reinit in UDO |
ok, now i understand better. in this case, you indeed need reinit,
because otherwise your envelope will only be performed once.
but i am wondering whether another approach is not better: you ask in a
main instrument for the condition. for instance: the trigger has
crossed 0.5 from below and only once per three times (or whatever you
like). if this condition is true, you call an instrument which performs
the envelope. for me, the code would be clearer then.
i append both solutions -
joachim
SOLUTION 1: UDO
opcode EnvAHD, a, ak
aIn, kTrig xin
kEnv, kCount, kOn init 0
if kTrig > .5 && kOn==0 then
kOn = 1
endif
env:
if kOn == 1 then
kEnv linseg 0, 1, 0.9, .5, 0.9, 1, 0
kCount += 1
endif
if kCount>=100 && kEnv==0 then ; basicially waits till the end of the env,
kOn = 0 ; when kEnv has become 0 again
kCount = 0
reinit env
endif
printk2 kOn
xout aIn*kEnv
endop
SOLUTION 2: TRIGGER ANOTHER INSTRUMENT FOR ENVELOPE
instr Main
ga1 vco2 .9, 440
kLFO lfo 1, 0.6
kLFO_past init 0
kCount init 2
;look whether kLFO has crossed 0.5 from below
if kLFO > .5 && kLFO_past <= .5 then
kCount += 1
;only once per three times
if kCount == 3 then
event "i","Env",0,2.5
kCount = 0
endif
endif
printk2 kCount
kLFO_past = kLFO
endin
instr Env
aEnv linseg 0, 1, 0.9, .5, 0.9, 1, 0
aOut = ga1 * aEnv
outs aOut,aOut
endin
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 |
| Date | 2018-03-21 10:18 |
| From | Richard van Bemmelen |
| Subject | Re: [Csnd] reinit in UDO |
Thanks very much Joachim, i'll try it out later today. The UDO solution suites me best since in this Clavia G2 project all modules are inside an UDO. Richard 2018-03-21 8:08 GMT+01:00 joachim heintz <jh@joachimheintz.de>: ok, now i understand better. in this case, you indeed need reinit, because otherwise your envelope will only be performed once. |
| Date | 2018-03-21 16:43 |
| From | Steven Yi |
| Subject | Re: [Csnd] reinit in UDO |
I think this might be simpler if you implemented your own UDO that calculated the envelope. You might look at: https://github.com/kunstmusik/libsyi/blob/master/adsr140.udo as an example where it is writing the asig value for the envelope. (Using linear ramping would result in simpler code.) On Wed, Mar 21, 2018 at 6:18 AM, Richard van Bemmelen |
| Date | 2018-03-21 20:30 |
| From | Richard |
| Subject | Re: [Csnd] reinit in UDO |
Thanks Steven, that looks interesting. OTOH, the Clavia AHD envelope needs to have linear, exponentional, etc sections, so i think I might be better off with existing Csound envelopes that have those options. On 21/03/18 17:43, Steven Yi wrote: > I think this might be simpler if you implemented your own UDO that > calculated the envelope. You might look at: > > https://github.com/kunstmusik/libsyi/blob/master/adsr140.udo > > as an example where it is writing the asig value for the envelope. > (Using linear ramping would result in simpler code.) > > On Wed, Mar 21, 2018 at 6:18 AM, Richard van Bemmelen > |