Csound Csound-dev Csound-tekno Search About

[Csnd] Maximum Value in ftables

Date2008-07-06 19:58
Fromjoachim heintz
Subject[Csnd] Maximum Value in ftables
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

Date2008-07-06 20:27
From"David Akbari"
Subject[Csnd] Re: Maximum Value in ftables
AttachmentsNone  

Date2008-07-06 20:49
From"Steven Yi"
Subject[Csnd] Re: Re: Maximum Value in ftables
AttachmentsNone  

Date2008-07-06 21:11
FromMark Van Peteghem
Subject[Csnd] Re: Maximum Value in ftables
I would like to add that in your example it should return a little less 
than one, because the table is normalized. The maximum absolute value is 
9, so everything would be divided by 9.

joachim heintz schreef:
> 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"
>
>

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.


Date2008-07-06 21:18
FromMike Moser-Booth
Subject[Csnd] Re: Re: Maximum Value in ftables
Actually, it would not be normalized because the Gen number is negative.

Mark Van Peteghem wrote:
> I would like to add that in your example it should return a little 
> less than one, because the table is normalized. The maximum absolute 
> value is 9, so everything would be divided by 9.
>
> joachim heintz schreef:
>> 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"
>>
>>
>


Date2008-07-07 05:26
FromMark Van Peteghem
Subject[Csnd] Re: Re: Re: Maximum Value in ftables
Ah, I mislooked, I thought 8 was the GEN number.

Mike Moser-Booth schreef:
> Actually, it would not be normalized because the Gen number is negative.
>
> Mark Van Peteghem wrote:
>> I would like to add that in your example it should return a little 
>> less than one, because the table is normalized. The maximum absolute 
>> value is 9, so everything would be divided by 9.
>>
>> joachim heintz schreef:
>>> 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"
>
>

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.


Date2008-07-07 20:22
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: Maximum Value in ftables
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"


Date2008-07-07 20:53
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Re: Maximum Value in ftables
AttachmentsNone  

Date2008-07-07 21:30
Fromjoachim heintz
Subject[Csnd] Re: Re: Re: Re: Re: Maximum Value in ftables
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"


Date2008-07-08 14:05
From"Andres Cabrera"
Subject[Csnd] Re: Re: Re: Re: Re: Re: Maximum Value in ftables
AttachmentsNone  None  

Date2008-07-09 19:30
From"Oeyvind Brandtsegg"
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Maximum Value in ftables
AttachmentsNone  

Date2008-07-09 20:03
From"Steven Yi"
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Maximum Value in ftables
AttachmentsNone  

Date2008-07-10 08:17
From"Oeyvind Brandtsegg"
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Maximum Value in ftables
AttachmentsNone  

Date2008-07-18 09:49
Fromjpff
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Maximum Value in ftables
Pardon?  I am seeing an outbreak of blank or truncated messages