| Thanks, Steven. Very elegant solution.
In my opinion, the question remains:
Why doing something again, what csound obviously already has, and
prints out when displaying a function table?
Thanks again and best regards -
joachim
Am 07.07.2008 um 21:53 schrieb Steven Yi:
> Hi Joachim,
>
> Following what I mentioned earlier, here's code for a UDO that will do
> what are asking about:
>
> opcode ftmax,i,i
>
> itablenum xin
>
> ilen = ftlen(itablenum)
>
> imax table 0, itablenum
>
> icount = 1
>
> loopStart:
>
> itemp table icount, itablenum
>
> imax = (itemp > imax) ? itemp : imax
>
> icount = icount + 1
>
> if (icount < ilen) goto loopStart
>
> xout imax
>
> endop
>
> steven
>
> On Mon, Jul 7, 2008 at 12:22 PM, joachim heintz
> wrote:
>> Thanks to all for the suggestions. I'm just wondering the following:
>> Each time csound displays a function table, it gives a message like
>> "ftable 121: 16 points, max 2.670".
>> So csound knows the maximum value.
>> I think it would be useful to have an access to this value with an
>> opcode
>> like this
>>
>> imax ftmax ifn
>>
>> (Like ftlen, ftsr and so on.)
>>
>> What do you, Steven, and the other developers think about this?
>>
>> joachim
>>
>>
>>
>> Am 06.07.2008 um 21:49 schrieb Steven Yi:
>>
>>> I'd say try using a loop; there's code with this ftreverse UDO to
>>> start
>>> with:
>>>
>>> http://www.csounds.com/udo/displayOpcode.php?opcode_id=78
>>>
>>> Mixing the loop with David's code should yield something
>>> reusable. =)
>>>
>>> On Sun, Jul 6, 2008 at 12:27 PM, David Akbari
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> This is preallocated for speed, and you may think of something
>>>> better.
>>>> What you might try is setting it up the table indexing using the
>>>> looping opcodes inside of a UDO space. This implementation is
>>>> reading
>>>> each point individually, of course with 8 points in the table
>>>> it's not
>>>> such a problem but it will quickly prove inadequate with larger
>>>> sized
>>>> tables. I tried reading the table using the phasor to index it over
>>>> time, but the results are not fast and if your ultimate
>>>> implementation
>>>> requires you to get the values "now" for realtime performance, this
>>>> may not do. The extra bonus in here to answer your question is
>>>> the use
>>>> of Anthony Kozar's "max" opcode.
>>>>
>>>>
>>>>
>>>> -m0 -odac -iadc -d -b128 -B256 -Mhw:2,0 -+rtaudio=alsa -
>>>> +rtmidi=null
>>>>
>>>>
>>>>
>>>> sr = 44100
>>>> ksmps = 128
>>>> nchnls = 2
>>>>
>>>> giTab ftgen 1, 0, 8, -2, 1, 5, 2, -4, -9, 8, 0, 4
>>>>
>>>> /*--- ---*/
>>>>
>>>> instr 1
>>>> ;kndx1 phasor 1/(ftlen(1))
>>>> ;kndx1 = kndx1 * ftlen(1)
>>>>
>>>> ktab1 table 1, 1
>>>> ktab2 table 2, 1
>>>> ktab3 table 3, 1
>>>> ktab4 table 4, 1
>>>> ktab5 table 5, 1
>>>> ktab6 table 6, 1
>>>> ktab7 table 7, 1
>>>> ktab8 table 8, 1
>>>>
>>>> kmax max ktab1, ktab2, ktab3, ktab4, ktab5, ktab6, ktab7,
>>>> ktab8
>>>>
>>>> printk2 kmax
>>>>
>>>> endin
>>>>
>>>> /*--- ---*/
>>>>
>>>>
>>>> i1 0 100
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Jul 6, 2008 at 1:58 PM, joachim heintz
>>>>
>>>> wrote:
>>>>>
>>>>> Hello all -
>>>>>
>>>>> is there an opcode to get the maximum value of a function
>>>>> table? E.g.
>>>>> for
>>>>> the table
>>>>> giTab ftgen 0, 0, 8, -2, 1, 5, 2, -4, -9, 8, 0, 4
>>>>> it should return 8.
>>>>>
>>>>> Thanks -
>>>>>
>>>>> joachim
>>>>>
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>>> "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> "unsubscribe
>>> csound"
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe
>> csound"
>>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
|