| oh yes, i tried it at first with a wrong performance time and thought
kTrig was needed. but as victor says, the code proves that black is
white. so this is simple, and a constant 1 works.
best -
j
Am 23.08.2013 13:13, schrieb vallste@libero.it:
> Is what I was saing before, in this line
> kMax max_k aSig, 1, 1
> ktrig is a constant 1
> By the way, I did try this (ktrig always 1) in other code and seems to work.
>
>> ----Messaggio originale----
>> Da: Victor.Lazzarini@nuim.ie
>> Data: 23/08/2013 13.09
>> A:
>> Ogg: Re: [Csnd] UDO to have the max a signal amplitude as k variable
>>
>> kTrig is not being consumed in the code. Is that right?
>> On 23 Aug 2013, at 11:41, joachim heintz wrote:
>>
>>> no, but it is easy to get a trigger which increments in each k-period:
>>>
>>>
>>>
>>> -n
>>>
>>>
>>> ksmps = 32
>>> instr 1
>>> kTrig init 1
>>> aSig rnd31 1, 0
>>> kMax max_k aSig, 1, 1
>>> printk 0, kMax
>>> kTrig = kTrig+1
>>> endin
>>>
>>>
>>> i 1 0 .01
>>>
>>>
>>>
>>>
>>> regards -
>>>
>>> joachim
>>>
>>>
>>> Am 23.08.2013 11:33, schrieb vallste@libero.it:
>>>> Hi Joachim,
>>>> this seems what I was looking for. Just one small doubt: if I set ktrig to
> a
>>>> constant 1 (no metro triggering or similar stuff) the output will be the
> max
>>>> reached in every kcycle, right?
>>>>
>>>>> ----Messaggio originale----
>>>>> Da: jh@joachimheintz.de
>>>>> Data: 23/08/2013 9.52
>>>>> A:
>>>>> Ogg: Re: [Csnd] UDO to have the max a signal amplitude as k variable
>>>>>
>>>>> hi stefano -
>>>>>
>>>>> i think no udo is needed here because max_k does what you wish?!
>>>>>
>>>>> best -
>>>>>
>>>>> joachim
>>>>>
>>>>>
>>>>> Am 22.08.2013 23:42, schrieb vallste@libero.it:
>>>>>> Hello,
>>>>>>
>>>>>> I'm developing this udo to have a krate variable indicating the maximum
>>>>>> value reached by a a-rate signal during a k-cycle.
>>>>>>
>>>>>> As far as I've understood downsamp opcode performs some averaging
>>>>>> (please correct me if I'm wrong) so not using it since I want the
>>>>>> absolute maximum reached.
>>>>>>
>>>>>>
>>>>>> opcode MaxAmpInKCycle, k, ak
>>>>>> setksmps 1
>>>>>> ain, kperiod xin ;ain - input signal, kperiod = kspms
>>>>>> kcounter init 0 ;count from 0 to ksmps
>>>>>> kout init 0 ;output value
>>>>>> aamp = abs(ain)
>>>>>> kamp downsamp aamp
>>>>>> ;if above previous value update
>>>>>> kout = (kamp > kout ? kamp : kout)
>>>>>> kcounter = kcounter + 1
>>>>>> if kcounter == kperiod then
>>>>>> ;reset value and counter
>>>>>> ;when reaching ksmps
>>>>>> kout = 0
>>>>>> kcounter = 0
>>>>>> endif
>>>>>> printk2 kcounter ; for testing
>>>>>> printk ksmps / sr, kout ; for testing
>>>>>> xout kout
>>>>>> endop
>>>>>>
>>>>>>
>>>>>> Not sure if it's working as expected, by printing values looks like
> that
>>>>>> the program using this opcode
>>>>>>
>>>>>>
>>>>>> instr 1
>>>>>>
>>>>>> ainLH, ainRH diskin2 $INPUTFILE, 1, 0, 1
>>>>>> printk ksmps / sr, 123
>>>>>> kvalue MaxAmpInKCycle ainLH, 8 ; equal to ksmps
>>>>>> printk ksmps / sr, 456
>>>>>> printk ksmps / sr, kvalue
>>>>>> printk ksmps / sr, 789
>>>>>>
>>>>>> endin
>>>>>>
>>>>>>
>>>>>> is somehow out of phase: after having printed 789 (from the main
>>>>>> program), kcounter variable value (printed from inside the opcode) is
>>>>>> not 0 (don't know if caused by some kind of "printing buffer") so if
>>>>>> someone want give it a try/report results/find errors/have an idea of
>>>>>> what's happening and want to share is more than welcome.
>>>>>>
>>>>>>
>>>>>> I'm using 5.17 double from Ubuntu repository
>>>>>>
>>>>>>
>>>>>> Bye
>>>>>>
>>>>>> Stefano
>>>>>>
>>>>>
>>>>>
>>>>> Send bugs reports to the Sourceforge bug trackers
>>>>> csound6:
>>>>> https://sourceforge.net/p/csound/tickets/
>>>>> csound5:
>>>>> https://sourceforge.net/p/csound/bugs/
>>>>> 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 trackers
>>>> csound6:
>>>> https://sourceforge.net/p/csound/tickets/
>>>> csound5:
>>>> https://sourceforge.net/p/csound/bugs/
>>>> 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 trackers
>>> csound6:
>>> https://sourceforge.net/p/csound/tickets/
>>> csound5:
>>> https://sourceforge.net/p/csound/bugs/
>>> Discussions of bugs and features can be posted here
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>>>
>>>
>>
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>>
>>
>> Send bugs reports to the Sourceforge bug trackers
>> csound6:
>> https://sourceforge.net/p/csound/tickets/
>> csound5:
>> https://sourceforge.net/p/csound/bugs/
>> 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 trackers
> csound6:
> https://sourceforge.net/p/csound/tickets/
> csound5:
> https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>
|