Guard point and ftlen()

View: New views
3 Messages — Rating Filter:   Alert me  

Guard point and ftlen()

by Jacob Joaquin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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__
<CsoundSynthesizer>
<CsInstruments>
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
</CsInstruments>
<CsScore>
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
</CsScore>
</CsoundSynthesizer>
__end__


Best,
Jake
--
The Csound Blog - http://csound.noisepages.com/


Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"

Re: Guard point and ftlen()

by francibal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

<CsoundSynthesizer>
<CsInstruments>
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
</CsInstruments>
<CsScore>
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 .
</CsScore>
</CsoundSynthesizer>

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__
<CsoundSynthesizer>
<CsInstruments>
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
</CsInstruments>
<CsScore>
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
</CsScore>
</CsoundSynthesizer>
__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"

Re: Guard point and ftlen()

by francibal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, i've understand that i have talk too early ...
Sorry..

ciao,
fran.


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.

<CsoundSynthesizer>
<CsInstruments>
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
</CsInstruments>
<CsScore>
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 .
</CsScore>
</CsoundSynthesizer>

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__
<CsoundSynthesizer>
<CsInstruments>
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
</CsInstruments>
<CsScore>
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
</CsScore>
</CsoundSynthesizer>
__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"