Csound Csound-dev Csound-tekno Search About

[Csnd] Guard point and ftlen()

Date2009-10-22 16:35
FromJacob Joaquin
Subject[Csnd] Guard point and ftlen()
I'm trying to finish an article I'm writing for the Csound Journal and
came across this issue. I'm hoping someone on the list can help clear
this up.

Is there a way to detect whether or not an f-table was declared with a
size of a power of two, a power of 2 + 1 or a negative number inside
of an instrument?  I discovered that ftlen ignores the guard point,
whether or not the guard point is implicitly or explicitly stated.
The following two f-tables have sizes of 4 and 5, though ftlen()
returns the value 4 for both:

f 1 0 4 -2 1 2 3 4
f 2 0 5 -2 1 2 3 4 5

I wrote a test csd that prints the size of the tables, along with the
values at each index.  Here is the output (F-table Index: Value):

__excerpt from output__
new alloc for instr 1:
Size of table 1: 4
0: 1.000000
1: 2.000000
2: 3.000000
3: 4.000000
4: 1.000000
new alloc for instr 1:
Size of table 2: 4
0: 1.000000
1: 2.000000
2: 3.000000
3: 4.000000
4: 5.000000
__end__

Other tests I ran show that negatively sized f-tables do not produce a
guard point.  Is this correct?

Here's the test csd I used:

__csd__


sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

instr 1
    ifn = p4
    ilast_index = p5
    isize = ftlen(ifn)
    ii = 0
    printf_i "Size of table %d: %d\n", 1, ifn, isize

    begin_loop:
    if (ii >= ilast_index) igoto end_loop
        ivalue tab_i ii, ifn
        printf_i "%d: %2f\n", 1, ii, ivalue
        ii = ii + 1
        igoto begin_loop

    end_loop:
    turnoff
endin


f 1 0 4 -2 1 2 3 4
f 2 0 5 -2 1 2 3 4 5
i 1 0 1 1 5
i 1 0 1 2 5


__end__


Best,
Jake

Date2009-10-22 18:05
Fromfrancibal
Subject[Csnd] Re: Guard point and ftlen()
Hi Mr. Jacob,
i don't know if it is right about Your study, but i have try Your csd with
negative p3
in function statement and it works right.

Hope helpful.



sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

instr 1
    ifn = p4
    ilast_index = p5
    isize = ftlen(ifn)
    ii = 0
    printf_i "Size of table %d: %d\n", 1, ifn, isize

    begin_loop:
    if (ii >= ilast_index) igoto end_loop
        ivalue tab_i ii, ifn
        printf_i "%d: %2f\n", 1, ii, ivalue
        ii = ii + 1
        igoto begin_loop

    end_loop:
    turnoff
endin


f 1 0 4 -2 1 2 3 4
f 2 0 -5 -2 1 2 3 4 5
f 3 0 -6 -2 1 2 3 4 5 6
f 4 0 -7 -2 1 2 3 4 5 6 7
f 5 0 8 -2 1 2 3 4 5 6 7 8
f 6 0 -9 -2 1 2 3 4 5 6 7 8 9

i 1 0 1 1 10
i 1 0 1 2 .
i 1 0 1 3 .
i 1 0 1 4 .
i 1 0 1 5 .
i 1 0 1 6 .



Ciao,
fran.


Jacob Joaquin wrote:
> 
> I'm trying to finish an article I'm writing for the Csound Journal and
> came across this issue. I'm hoping someone on the list can help clear
> this up.
> 
> Is there a way to detect whether or not an f-table was declared with a
> size of a power of two, a power of 2 + 1 or a negative number inside
> of an instrument?  I discovered that ftlen ignores the guard point,
> whether or not the guard point is implicitly or explicitly stated.
> The following two f-tables have sizes of 4 and 5, though ftlen()
> returns the value 4 for both:
> 
> f 1 0 4 -2 1 2 3 4
> f 2 0 5 -2 1 2 3 4 5
> 
> I wrote a test csd that prints the size of the tables, along with the
> values at each index.  Here is the output (F-table Index: Value):
> 
> __excerpt from output__
> new alloc for instr 1:
> Size of table 1: 4
> 0: 1.000000
> 1: 2.000000
> 2: 3.000000
> 3: 4.000000
> 4: 1.000000
> new alloc for instr 1:
> Size of table 2: 4
> 0: 1.000000
> 1: 2.000000
> 2: 3.000000
> 3: 4.000000
> 4: 5.000000
> __end__
> 
> Other tests I ran show that negatively sized f-tables do not produce a
> guard point.  Is this correct?
> 
> Here's the test csd I used:
> 
> __csd__
> 
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 1
> 
> instr 1
>     ifn = p4
>     ilast_index = p5
>     isize = ftlen(ifn)
>     ii = 0
>     printf_i "Size of table %d: %d\n", 1, ifn, isize
> 
>     begin_loop:
>     if (ii >= ilast_index) igoto end_loop
>         ivalue tab_i ii, ifn
>         printf_i "%d: %2f\n", 1, ii, ivalue
>         ii = ii + 1
>         igoto begin_loop
> 
>     end_loop:
>     turnoff
> endin
> 
> 
> f 1 0 4 -2 1 2 3 4
> f 2 0 5 -2 1 2 3 4 5
> i 1 0 1 1 5
> i 1 0 1 2 5
> 
> 
> __end__
> 
> 
> Best,
> Jake
> -- 
> The Csound Blog - http://csound.noisepages.com/
> 
> 
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
> 
> 

Date2009-10-22 18:07
Fromfrancibal
Subject[Csnd] Re: Guard point and ftlen()
Ok, i've understand that i have talk too early ...
Sorry..

ciao,
fran.


francibal wrote:
> 
> Hi Mr. Jacob,
> i don't know if it is right about Your study, but i have try Your csd with
> negative p3
> in function statement and it works right.
> 
> Hope helpful.
> 
> 
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 1
> 
> instr 1
>     ifn = p4
>     ilast_index = p5
>     isize = ftlen(ifn)
>     ii = 0
>     printf_i "Size of table %d: %d\n", 1, ifn, isize
> 
>     begin_loop:
>     if (ii >= ilast_index) igoto end_loop
>         ivalue tab_i ii, ifn
>         printf_i "%d: %2f\n", 1, ii, ivalue
>         ii = ii + 1
>         igoto begin_loop
> 
>     end_loop:
>     turnoff
> endin
> 
> 
> f 1 0 4 -2 1 2 3 4
> f 2 0 -5 -2 1 2 3 4 5
> f 3 0 -6 -2 1 2 3 4 5 6
> f 4 0 -7 -2 1 2 3 4 5 6 7
> f 5 0 8 -2 1 2 3 4 5 6 7 8
> f 6 0 -9 -2 1 2 3 4 5 6 7 8 9
> 
> i 1 0 1 1 10
> i 1 0 1 2 .
> i 1 0 1 3 .
> i 1 0 1 4 .
> i 1 0 1 5 .
> i 1 0 1 6 .
> 
> 
> 
> Ciao,
> fran.
> 
> 
> Jacob Joaquin wrote:
>> 
>> I'm trying to finish an article I'm writing for the Csound Journal and
>> came across this issue. I'm hoping someone on the list can help clear
>> this up.
>> 
>> Is there a way to detect whether or not an f-table was declared with a
>> size of a power of two, a power of 2 + 1 or a negative number inside
>> of an instrument?  I discovered that ftlen ignores the guard point,
>> whether or not the guard point is implicitly or explicitly stated.
>> The following two f-tables have sizes of 4 and 5, though ftlen()
>> returns the value 4 for both:
>> 
>> f 1 0 4 -2 1 2 3 4
>> f 2 0 5 -2 1 2 3 4 5
>> 
>> I wrote a test csd that prints the size of the tables, along with the
>> values at each index.  Here is the output (F-table Index: Value):
>> 
>> __excerpt from output__
>> new alloc for instr 1:
>> Size of table 1: 4
>> 0: 1.000000
>> 1: 2.000000
>> 2: 3.000000
>> 3: 4.000000
>> 4: 1.000000
>> new alloc for instr 1:
>> Size of table 2: 4
>> 0: 1.000000
>> 1: 2.000000
>> 2: 3.000000
>> 3: 4.000000
>> 4: 5.000000
>> __end__
>> 
>> Other tests I ran show that negatively sized f-tables do not produce a
>> guard point.  Is this correct?
>> 
>> Here's the test csd I used:
>> 
>> __csd__
>> 
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 1
>> 
>> instr 1
>>     ifn = p4
>>     ilast_index = p5
>>     isize = ftlen(ifn)
>>     ii = 0
>>     printf_i "Size of table %d: %d\n", 1, ifn, isize
>> 
>>     begin_loop:
>>     if (ii >= ilast_index) igoto end_loop
>>         ivalue tab_i ii, ifn
>>         printf_i "%d: %2f\n", 1, ii, ivalue
>>         ii = ii + 1
>>         igoto begin_loop
>> 
>>     end_loop:
>>     turnoff
>> endin
>> 
>> 
>> f 1 0 4 -2 1 2 3 4
>> f 2 0 5 -2 1 2 3 4 5
>> i 1 0 1 1 5
>> i 1 0 1 2 5
>> 
>> 
>> __end__
>> 
>> 
>> Best,
>> Jake
>> -- 
>> The Csound Blog - http://csound.noisepages.com/
>> 
>> 
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>> 
>> 
> 
>