Discussion:
[Cs-dev] function tables power-of-2, etc
Matt Ingalls
2006-01-22 19:34:07 UTC
Permalink
is the power-of-2 function table size requirement gone for csound5?

if so, can you PLEASE remove it? the optimization it gives is far
less important than
the convenience of specifying your own size.

ideally, it would be better to have "deferred" size for most GEN
routines --
just give a '0' as the size for most GENS and let the routine
calculate the size.

multichannel tables expanded beyond loscil family would be nice as
well..

Thanks,
Matt;
________________________
matt ingalls
http://sonomatics.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-22 19:43:44 UTC
Permalink
Post by Matt Ingalls
is the power-of-2 function table size requirement gone for csound5?
No, it still exists for most opcodes.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-22 19:50:20 UTC
Permalink
Post by Matt Ingalls
ideally, it would be better to have "deferred" size for most GEN
routines --
just give a '0' as the size for most GENS and let the routine
calculate the size.
I do not entirely understand this. For example, what size would
a "deferred" GEN10 automatically use for a sine wave ? 100,
1000000, or what ?


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
matt
2006-01-23 19:22:53 UTC
Permalink
well i said "most" not "all" -- although a reasonable default size for
gen10 would not be that -- i see your other mail and looks like
that is already possible..
Post by Istvan Varga
Post by Matt Ingalls
ideally, it would be better to have "deferred" size for most GEN
routines --
just give a '0' as the size for most GENS and let the routine
calculate the size.
I do not entirely understand this. For example, what size would
a "deferred" GEN10 automatically use for a sine wave ? 100,
1000000, or what ?
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-m@
________________________
matt ingalls
http://sfsound.org/matt.html



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Victor NK-X-TODEL918ani
2006-01-22 20:05:41 UTC
Permalink
This would mean re-writing a load of opcodes. I think it's
OK
to have this kind of requirement. Even with so-called
'modern'
synthesis systems (such as supercollider), it exists
(AFAIK).

But of course, you can have opcodes that don't need such
thing. For these any size tables can be used.

What I think would be useful is to allow any size tables to
be created (I don't think this is possible for all GENS)
with
any GEN.

Victor
Post by Matt Ingalls
is the power-of-2 function table size requirement gone for
csound5?
if so, can you PLEASE remove it? the optimization it
gives is far less important than
the convenience of specifying your own size.
ideally, it would be better to have "deferred" size for
most GEN routines --
just give a '0' as the size for most GENS and let the
routine calculate the size.
multichannel tables expanded beyond loscil family would be
nice as well..
Thanks,
Matt;
________________________
matt ingalls
http://sonomatics.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep
through log files for problems? Stop! Download the new
AJAX search engine that makes searching your log files as
easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&
dat=121642
Post by Matt Ingalls
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-22 20:18:24 UTC
Permalink
Post by Victor NK-X-TODEL918ani
What I think would be useful is to allow any size tables to
be created (I don't think this is possible for all GENS)
with any GEN.
You can do that by using a negative table size; a length
specified this way always includes the guard point (i.e.
a table size parameter of -1025 is equivalent to using
1025, but -1024 is not the same table size as 1024).
Note that some GEN routines may not support this, for
example those that use FFT.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
David Akbari
2006-01-22 21:19:39 UTC
Permalink
I can see where Matt's coming from ...

Personally I would like to see only the table opcode able to accept
table size of deferred length, as I can see the potential problems in
allowing such behavior on the FFT GEN routines, etc.

For example

<CsoundSynthesizer>
<CsInstruments>

sr = 48000
ksmps = 64
nchnls = 2

#define FILE # "/loops/dl_break0.aif" #

itmp ftgen 1, 0, 0, 1, $FILE., 0, 4, 0
;itmp ftgen 1, 0, 131072, 1, $FILE., 0, 4, 0

instr 1

itabsz filelen $FILE.

andx phasor (1 / itabsz)
andx = andx * (itabsz * sr)
a1 table andx, 1
a1 = a1 * 32767

outs a1, a1

endin

</CsInstruments>
<CsScore>
i1 0 10

e
</CsScore>

</CsoundSynthesizer>
Post by Victor NK-X-TODEL918ani
This would mean re-writing a load of opcodes. I think it's
OK
to have this kind of requirement. Even with so-called
'modern'
synthesis systems (such as supercollider), it exists
(AFAIK).
But of course, you can have opcodes that don't need such
thing. For these any size tables can be used.
What I think would be useful is to allow any size tables to
be created (I don't think this is possible for all GENS)
with
any GEN.
Victor
Post by Matt Ingalls
is the power-of-2 function table size requirement gone for
csound5?
if so, can you PLEASE remove it? the optimization it
gives is far less important than
the convenience of specifying your own size.
ideally, it would be better to have "deferred" size for
most GEN routines --
just give a '0' as the size for most GENS and let the
routine calculate the size.
multichannel tables expanded beyond loscil family would be
nice as well..
Thanks,
Matt;
________________________
matt ingalls
http://sonomatics.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Matt Ingalls
2006-01-23 19:20:40 UTC
Permalink
Post by Victor NK-X-TODEL918ani
This would mean re-writing a load of opcodes. I think it's
OK
is that really true? when i looked into this [ about 5 years ago! ]
all i found was some bit-wise operations on index increments for
oscillators and stuff -- it would be no big deal to replace the bit-wise
stuff with a modulo or if statement?
Post by Victor NK-X-TODEL918ani
What I think would be useful is to allow any size tables to
be created (I don't think this is possible for all GENS)
isn't that what i just said?

Matt;
________________________
matt ingalls
http://sonomatics.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-23 20:42:04 UTC
Permalink
Post by Matt Ingalls
is that really true? when i looked into this [ about 5 years ago! ]
all i found was some bit-wise operations on index increments for
oscillators and stuff -- it would be no big deal to replace the bit-wise
stuff with a modulo or if statement?
Simply replacing a & with a % is not enough, as the latter cannot
deal with negative numbers correctly, so you need an additional
if statement to fix that. Also, a % is much slower than a &.
An if statement is again not enough, as you need at least two to
wrap negative numbers, and more to deal with the possibility of
a very large index.
In any case, using the & operator is the simplest and fastest
way to wrap any integer value to a 0..N-1 range, as long as
N is an integer power of two.
Additionally, more changes are needed to clean up any tricky code
that assumes in some (often non-obvious) way a power of two or at
least even table size. There are many possibilities for introducing
bugs, something that is best avoided when a release is just about
to be made.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Matt Ingalls
2006-01-23 20:56:20 UTC
Permalink
Post by Istvan Varga
Post by Matt Ingalls
is that really true? when i looked into this [ about 5 years ago! ]
all i found was some bit-wise operations on index increments for
oscillators and stuff -- it would be no big deal to replace the bit-wise
stuff with a modulo or if statement?
Simply replacing a & with a % is not enough, as the latter cannot
as we say in california, "duh!"
Post by Istvan Varga
deal with negative numbers correctly, so you need an additional
if statement to fix that. Also, a % is much slower than a &.
how much? i seriously doubt it's worth the speed gain..
Post by Istvan Varga
An if statement is again not enough, as you need at least two to
wrap negative numbers, and more to deal with the possibility of
a very large index.
In any case, using the & operator is the simplest and fastest
way to wrap any integer value to a 0..N-1 range, as long as
N is an integer power of two.
but from the user-end it is really inconvenient, and then you have
wasted memory when using large tables.
Post by Istvan Varga
Additionally, more changes are needed to clean up any tricky code
that assumes in some (often non-obvious) way a power of two or at
least even table size. There are many possibilities for introducing
bugs, something that is best avoided when a release is just about
to be made.
well mark it up for the next version then..

IMO, the GENERAL case
should be opcodes that do not expect power-of-2, you can always create
some special optimized opcodes that require power-of-2!

Matt;
________________________
matt ingalls
http://sonomatics.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-23 21:50:04 UTC
Permalink
Post by Matt Ingalls
Post by Istvan Varga
Post by Matt Ingalls
is that really true? when i looked into this [ about 5 years ago! ]
all i found was some bit-wise operations on index increments for
oscillators and stuff -- it would be no big deal to replace the bit-wise
stuff with a modulo or if statement?
Simply replacing a & with a % is not enough, as the latter cannot
as we say in california, "duh!"
Post by Istvan Varga
deal with negative numbers correctly, so you need an additional
if statement to fix that. Also, a % is much slower than a &.
how much? i seriously doubt it's worth the speed gain..
With two buils that are identical except one uses & in the
oscil.kk opcode, while another uses %, trapped.csd renders
about 20% slower on my machine. Note that this is the result
of changing a single opcode; the CSD uses many other opcodes
as well, so the slowdown of oscil itself is more significant.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-23 22:40:24 UTC
Permalink
Post by Matt Ingalls
well mark it up for the next version then..
That sounds more reasonable. While I still do not really like
the idea of changing all opcodes, there are cases (mostly when
wrapping is not needed) where the power of two limitation can
be removed easily without any slowdown or major changes.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Richard Dobson
2006-01-23 23:08:47 UTC
Permalink
Post by Istvan Varga
Post by Matt Ingalls
well mark it up for the next version then..
That sounds more reasonable. While I still do not really like
the idea of changing all opcodes, there are cases (mostly when
wrapping is not needed) where the power of two limitation can
be removed easily without any slowdown or major changes.
The issue that would have to be addressed (and whcih I have always seen as the
main obstacle to the proposed changes) is indeed the definition of the guard
point, on which many opcodes rely. In the current scheme, the contents of the
opcode are indicated by the table size being either a pow_of_2 or pow_of_2+1,
relying on the special significance of the pow_of_2 value.

How does a user indicate the guard point when using a non power-of two size? As
soon as this is allowed, 1024 and 1025 cease to have their "special" meanings
(i.e. both indicate a 1024 table, with different guardpoint contents); one might
expect 1025 to mean literally a table size of 1025, PLUS a guard point - the
fgen score statement would seem to need to be revised to include an explicit
field to define it. Eliminating all use of guard points is surely not the end
goal of all this? That would slow down a lot of opcodes! To say nothing of
breaking existing scores.


Richard Dobson




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Victor NK-X-TODEL918ani
2006-01-24 10:14:06 UTC
Permalink
I don't think we should change anything. We can make the oscillators
that use floating-point maths free of the power-of-two requirement, as
well as any other opcode that really does not need that. As far as
guard-points are concerned, a possibility is to implement them in the
opcode and have an extra optional parameter to define them, when the
table is not power-of-two.

Victor
Post by Richard Dobson
Post by Istvan Varga
Post by Matt Ingalls
well mark it up for the next version then..
That sounds more reasonable. While I still do not really like
the idea of changing all opcodes, there are cases (mostly when
wrapping is not needed) where the power of two limitation can
be removed easily without any slowdown or major changes.
The issue that would have to be addressed (and whcih I have always seen as
the main obstacle to the proposed changes) is indeed the definition of the
guard point, on which many opcodes rely. In the current scheme, the
contents of the opcode are indicated by the table size being either a
pow_of_2 or pow_of_2+1, relying on the special significance of the
pow_of_2 value.
How does a user indicate the guard point when using a non power-of two
size? As soon as this is allowed, 1024 and 1025 cease to have their
"special" meanings (i.e. both indicate a 1024 table, with different
guardpoint contents); one might expect 1025 to mean literally a table size
of 1025, PLUS a guard point - the fgen score statement would seem to need
to be revised to include an explicit field to define it. Eliminating all
use of guard points is surely not the end goal of all this? That would
slow down a lot of opcodes! To say nothing of breaking existing scores.
Richard Dobson
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-24 12:28:39 UTC
Permalink
Post by Victor NK-X-TODEL918ani
I don't think we should change anything. We can make the oscillators
that use floating-point maths free of the power-of-two requirement
In fact, the poscil opcode already allows non-power of two table sizes.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-24 10:37:45 UTC
Permalink
Post by Richard Dobson
The issue that would have to be addressed (and whcih I have always seen as the
main obstacle to the proposed changes) is indeed the definition of the guard
point, on which many opcodes rely. In the current scheme, the contents of the
opcode are indicated by the table size being either a pow_of_2 or pow_of_2+1,
relying on the special significance of the pow_of_2 value.
Probably that is why the non-power of two table sizes are specified
as negative numbers. In this mode, the size always includes the guard
point, like in the pow_of_2+1 case above. A p3 of -101 means 100 samples
and a guard point which is not copied from sample 0.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Richard Dobson
2006-01-24 14:22:00 UTC
Permalink
Post by Istvan Varga
Post by Richard Dobson
The issue that would have to be addressed (and whcih I have always seen as the
main obstacle to the proposed changes) is indeed the definition of the guard
point, on which many opcodes rely. In the current scheme, the contents of the
opcode are indicated by the table size being either a pow_of_2 or pow_of_2+1,
relying on the special significance of the pow_of_2 value.
Probably that is why the non-power of two table sizes are specified
as negative numbers. In this mode, the size always includes the guard
point, like in the pow_of_2+1 case above. A p3 of -101 means 100 samples
and a guard point which is not copied from sample 0.
This is OK if the reduced flexibility compared to the standard system is
accepted. That is to say, it only supports the extension" form of guard point.
It does not therefore form a complete substitute for the standard system. Of
course, for waveform lookup tables there is no obvious reason not to use a
power-of-two table, but the second (wraparound) guard-point form is still
important; I guess the trust is that it will never (?) be required for a non
power-of-two size. Given the ingenuity of Csound users, I find that difficult to
believe! I fully appreciate the problems the power-of-two requirement poses;
but a ~lot~ of efficiency was gained by that design, not least in the fact that
opcodes had to perform absolutely no special actions depending on the size of
the table. Put another way - gaining the use of arbitrary table sizes may yet
mean losing quite a lot. I would be very interested to see benchmark
comparisons, especially for the case ksmps = 1.

Richard Dobson









-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Matt Ingalls
2006-01-24 18:00:59 UTC
Permalink
OK thanks to all of you that replies and explanations on this
-- i am very surprised it has so much difference in performance!

One option of course would be to have opcodes [ especially ones whose
f-tables are given at i-rate ] look to see if the table size is a p-
o-2 in the i-pass.
Then it could set a function pointer to either an optimized p-o-2 or
non po2
routine for p-time accordingly.

But the main thing i am annoyed with as a USER
is that i do not want to THINK about power-of-2. And after
teaching this csound class
this past semester i can tell you i am not the only one!

i think at the very least we could add default table sizes so the
user could just
specify 0 for the table size - i think in most general cases you just
want to use gen10
with an oscili or something and not need to worry about tablesize - a
reasonable
default size [ 1024? ] would be a nice feature.

the other frequently annoying case is large gen01 functions --
getting more opcodes to
support "deferred" sizes would be really nice.

i don't know, maybe all this should just be done in some kind of
front-end pre-process..

and did i mention more multichannel gen01 support as well?
Post by Richard Dobson
Post by Istvan Varga
Post by Richard Dobson
The issue that would have to be addressed (and whcih I have
always seen as the main obstacle to the proposed changes) is
indeed the definition of the guard point, on which many opcodes
rely. In the current scheme, the contents of the opcode are
indicated by the table size being either a pow_of_2 or pow_of_2
+1, relying on the special significance of the pow_of_2 value.
Probably that is why the non-power of two table sizes are specified
as negative numbers. In this mode, the size always includes the guard
point, like in the pow_of_2+1 case above. A p3 of -101 means 100 samples
and a guard point which is not copied from sample 0.
This is OK if the reduced flexibility compared to the standard
system is accepted. That is to say, it only supports the extension"
form of guard point. It does not therefore form a complete
substitute for the standard system. Of course, for waveform lookup
tables there is no obvious reason not to use a power-of-two table,
but the second (wraparound) guard-point form is still important; I
guess the trust is that it will never (?) be required for a non
power-of-two size. Given the ingenuity of Csound users, I find that
difficult to believe! I fully appreciate the problems the power-of-
two requirement poses; but a ~lot~ of efficiency was gained by that
design, not least in the fact that opcodes had to perform
absolutely no special actions depending on the size of the table.
Put another way - gaining the use of arbitrary table sizes may yet
mean losing quite a lot. I would be very interested to see
benchmark comparisons, especially for the case ksmps = 1.
Richard Dobson
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
Matt;
________________________
matt ingalls
http://sonomatics.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Anthony Kozar
2006-01-24 18:55:17 UTC
Permalink
I can understand this point. It is easy to remember a few simple values
like 256 or 1024, but most people seem to be using larger tables these days
and may not want to expend the effort to memorize or recalculate sizes like
65536 or 262144 on a regular basis.

My suggestion to those people is to use a feature that already exists in
Csound: the @ and @@ score expression operators.

Try f1 0 [@ 1000] 10 1
or f2 0 [@@ 50000] 9 1 1.0 0.0 2.5 0.5 0.32

@ rounds up to the nearest power of 2 (1024 above) and @@ rounds up to the
nearest power-of-2-plus-1 (65537 above).

Anthony Kozar
anthonykozar AT sbcglobal DOT net
Post by Matt Ingalls
But the main thing i am annoyed with as a USER
is that i do not want to THINK about power-of-2. And after
teaching this csound class
this past semester i can tell you i am not the only one!
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
David Akbari
2006-01-24 19:52:38 UTC
Permalink
Wow! Thanks for the great tip of the @ operator! Is there a manual entry for
this??

Another solution that I have found to be particularlly effective in this
case is using one of Steven Yi's UDO's

http://www.csounds.com/udo/displayOpcode.php?opcode_id=19

to generate the table with ftgen in the orchestra. If you set it up in a
separate instrument it also allows you to write it's length to a global
variable so that for example even though i-time happens once in an "always
on" instrument, you can say, change table sizes at some arbitrary second
instrument's i-rate.


-David
Post by Anthony Kozar
I can understand this point. It is easy to remember a few simple values
like 256 or 1024, but most people seem to be using larger tables these days
and may not want to expend the effort to memorize or recalculate sizes like
65536 or 262144 on a regular basis.
My suggestion to those people is to use a feature that already exists in
@ rounds up to the nearest power of 2 (1024 above) and @@ rounds up to the
nearest power-of-2-plus-1 (65537 above).
Anthony Kozar
anthonykozar AT sbcglobal DOT net
Post by Matt Ingalls
But the main thing i am annoyed with as a USER
is that i do not want to THINK about power-of-2. And after
teaching this csound class
this past semester i can tell you i am not the only one!
Richard Dobson
2006-01-24 19:44:06 UTC
Permalink
Post by Matt Ingalls
One option of course would be to have opcodes [ especially ones whose
f-tables are given at i-rate ] look to see if the table size is a p- o-2
in the i-pass.
Then it could set a function pointer to either an optimized p-o-2 or
non po2
routine for p-time accordingly.
Sure; but lots of opcodes to change! And you need to check for p-o-2 ~and~
p-o-2+1. And if the notes are very rapid, it could start to matter CPU-wise.
Maybe something for Csound 7?
Post by Matt Ingalls
But the main thing i am annoyed with as a USER
is that i do not want to THINK about power-of-2. And after teaching
this csound class
this past semester i can tell you i am not the only one!
One one level I sympathize; but there is no escaping the fact that Csound is a
"scientific" and numerate system; removing concern for table sizes will not
really make much difference to the amount of stuff a person has to understand to
use Csound fluently. At least, power-of-two sizes have a reason behind them!
The problem with arbitrary sizes is just that - there seems to be no reason to
choose one number over another. Indeed, Csound is one of the few tools I know
that make it so easy to demonstrate pedagogically the difference between a small
and large table, with oscil v oscili. I would have thought that teaching the
difference between those would be at least as involved as explaining the special
significance of power-of-two!

Richard Dobson











-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Victor NK-X-TODEL918ani
2006-01-22 21:50:51 UTC
Permalink
Oh yes I forgot that... thanks for the reminder.
Post by Istvan Varga
Post by Victor NK-X-TODEL918ani
What I think would be useful is to allow any size tables
to be created (I don't think this is possible for all
GENS) with any GEN.
You can do that by using a negative table size; a length
specified this way always includes the guard point (i.e.
a table size parameter of -1025 is equivalent to using
1025, but -1024 is not the same table size as 1024).
Note that some GEN routines may not support this, for
example those that use FFT.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep
through log files for problems? Stop! Download the new
AJAX search engine that makes searching your log files as
easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&
dat=121642
Post by Istvan Varga
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Victor NK-X-TODEL918ani
2006-01-22 21:53:24 UTC
Permalink
There are a couple of table opcodes by Gabriel Maldonado
that accept any size tables I think...
Post by David Akbari
I can see where Matt's coming from ...
Personally I would like to see only the table opcode able
to accept table size of deferred length, as I can see the
potential problems in allowing such behavior on the FFT
GEN routines, etc.
For example
<CsoundSynthesizer>
<CsInstruments>
sr = 48000
ksmps = 64
nchnls = 2
#define FILE # "/loops/dl_break0.aif" #
itmp ftgen 1, 0, 0, 1, $FILE., 0, 4, 0
;itmp ftgen 1, 0, 131072, 1, $FILE., 0, 4, 0
instr 1
itabsz filelen $FILE.
andx phasor (1 / itabsz)
andx = andx * (itabsz * sr)
a1 table andx, 1
a1 = a1 * 32767
outs a1, a1
endin
</CsInstruments>
<CsScore>
i1 0 10
e
</CsScore>
</CsoundSynthesizer>
Post by Victor NK-X-TODEL918ani
This would mean re-writing a load of opcodes. I think
it's OK
to have this kind of requirement. Even with so-called
'modern'
synthesis systems (such as supercollider), it exists
(AFAIK).
But of course, you can have opcodes that don't need such
thing. For these any size tables can be used.
What I think would be useful is to allow any size tables
to be created (I don't think this is possible for all
GENS) with
any GEN.
Victor
Post by Matt Ingalls
is the power-of-2 function table size requirement gone
for >> csound5?
Post by Victor NK-X-TODEL918ani
Post by Matt Ingalls
if so, can you PLEASE remove it? the optimization it
gives is far less important than
the convenience of specifying your own size.
ideally, it would be better to have "deferred" size for
most GEN routines --
just give a '0' as the size for most GENS and let the
routine calculate the size.
multichannel tables expanded beyond loscil family would
be >> nice as well..
Post by Victor NK-X-TODEL918ani
Post by Matt Ingalls
Thanks,
Matt;
________________________
matt ingalls
http://sonomatics.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep
through log files for problems? Stop! Download the new
AJAX search engine that makes searching your log files as
easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&
dat=121642
Post by David Akbari
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-22 22:17:22 UTC
Permalink
Post by Victor NK-X-TODEL918ani
There are a couple of table opcodes by Gabriel Maldonado
that accept any size tables I think...
Yes, for example the tab opcode which does allow for any
table size, although it has no "wrap" mode and does not
check the range of the table index.


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
David Akbari
2006-01-23 01:38:50 UTC
Permalink
Gentlemen, thanks for your help,

It seems like this could be exactly what I am looking for !

tab s xio
tab_i i iio
tabw (null) xxio
tabw_i (null) iiio

Although I cannot seem to find a canonical reference manual entry for
any of these :<

Also I cannot seem to find them in the CsoundAV Manual(?) is it
possible to assimilate discrepancies between the CsoundAV Manual and
The Canonical Reference Manual into the Canonical Manual as the changes
are made to Csound5 ?

Also what do these opcodes do ? I can't seem to find any manual entry
for them

tb0 i i
tb0 k k
tb0_init (null) i
tb1 i i
tb1 k k
tb10 i i
tb10 k k
tb10_init (null) i
tb11 i i
tb11 k k
tb11_init (null) i
tb12 i i
tb12 k k
tb12_init (null) i
tb13 i i
tb13 k k
tb13_init (null) i
tb14 i i
tb14 k k
tb14_init (null) i
tb15 i i
tb15 k k
tb15_init (null) i
tb1_init (null) i
tb2 i i
tb2 k k
tb2_init (null) i
tb3 i i
tb3 k k
tb3_init (null) i
tb4 i i
tb4 k k
tb4_init (null) i
tb5 i i
tb5 k k
tb5_init (null) i
tb6 i i
tb6 k k
tb6_init (null) i
tb7 i i
tb7 k k
tb7_init (null) i
tb8 i i
tb8 k k
tb8_init (null) i
tb9 i i
tb9 k k
tb9_init (null) i


-David
Post by Victor NK-X-TODEL918ani
There are a couple of table opcodes by Gabriel Maldonado
that accept any size tables I think...
Post by David Akbari
I can see where Matt's coming from ...
Personally I would like to see only the table opcode able
to accept table size of deferred length, as I can see the
potential problems in allowing such behavior on the FFT
GEN routines, etc.
For example
<CsoundSynthesizer>
<CsInstruments>
sr = 48000
ksmps = 64
nchnls = 2
#define FILE # "/loops/dl_break0.aif" #
itmp ftgen 1, 0, 0, 1, $FILE., 0, 4, 0
;itmp ftgen 1, 0, 131072, 1, $FILE., 0, 4, 0
instr 1
itabsz filelen $FILE.
andx phasor (1 / itabsz)
andx = andx * (itabsz * sr)
a1 table andx, 1
a1 = a1 * 32767
outs a1, a1
endin
</CsInstruments>
<CsScore>
i1 0 10
e
</CsScore>
</CsoundSynthesizer>
Post by Victor NK-X-TODEL918ani
This would mean re-writing a load of opcodes. I think
it's OK
to have this kind of requirement. Even with so-called
'modern'
synthesis systems (such as supercollider), it exists
(AFAIK).
But of course, you can have opcodes that don't need such
thing. For these any size tables can be used.
What I think would be useful is to allow any size tables
to be created (I don't think this is possible for all
GENS) with
any GEN.
Victor
Post by Matt Ingalls
is the power-of-2 function table size requirement gone
for >> csound5?
Post by Victor NK-X-TODEL918ani
Post by Matt Ingalls
if so, can you PLEASE remove it? the optimization it
gives is far less important than
the convenience of specifying your own size.
ideally, it would be better to have "deferred" size for
most GEN routines --
just give a '0' as the size for most GENS and let the
routine calculate the size.
multichannel tables expanded beyond loscil family would
be >> nice as well..
Post by Victor NK-X-TODEL918ani
Post by Matt Ingalls
Thanks,
Matt;
________________________
matt ingalls
http://sonomatics.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep
through log files for problems? Stop! Download the new
AJAX search engine that makes searching your log files as
easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&
dat=121642
Post by David Akbari
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
j***@codemist.co.uk
2006-01-23 06:58:57 UTC
Permalink
The tb opcodes are in the manual; look at html/tb.html or under tb in
the index
tab and tabw are in the manual in html/tab.html

I have been trying to identify which opcodes are not in the manual;
unfinished work in Loadable_Opcodes.txt
==John ffitch


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Istvan Varga
2006-01-23 09:46:54 UTC
Permalink
Post by David Akbari
Gentlemen, thanks for your help,
It seems like this could be exactly what I am looking for !
tab s xio
tab_i i iio
tabw (null) xxio
tabw_i (null) iiio
Although I cannot seem to find a canonical reference manual entry for
any of these :<
They are definitely in the manual. Look for tab.html (in the HTML manual)
or opcodes/tab.xml (XML manual in CVS).
Post by David Akbari
Also what do these opcodes do ? I can't seem to find any manual entry
for them
tb0 i i
tb0 k k
tb0_init (null) i
...
Again, these are documented: tb.html (HTML) and opcodes/tb.xml (XML).


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
David Akbari
2006-01-23 13:28:47 UTC
Permalink
After further inspection I have found these to be quite useful.

I retract my initial request for any change to the sources.

Making music on Linux is fun :D


-David

ps. Thanks again, guys !
Post by Istvan Varga
Post by David Akbari
Gentlemen, thanks for your help,
It seems like this could be exactly what I am looking for !
tab s xio
tab_i i iio
tabw (null) xxio
tabw_i (null) iiio
Although I cannot seem to find a canonical reference manual entry for
any of these :<
They are definitely in the manual. Look for tab.html (in the HTML manual)
or opcodes/tab.xml (XML manual in CVS).
Post by David Akbari
Also what do these opcodes do ? I can't seem to find any manual entry
for them
tb0 i i
tb0 k k
tb0_init (null) i
...
Again, these are documented: tb.html (HTML) and opcodes/tb.xml (XML).
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Victor NK-X-TODEL918ani
2006-01-23 13:45:35 UTC
Permalink
Surely is.
Post by David Akbari
Making music on Linux is fun :D
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Michael Gogins
2006-01-23 21:48:08 UTC
Permalink
I think the bitwise stuff is there because it was found to be faster.

Regards,
Mike

-----Original Message-----
Sent: Jan 23, 2006 2:20 PM
Subject: Re: [Cs-dev] function tables power-of-2, etc
Post by Victor NK-X-TODEL918ani
This would mean re-writing a load of opcodes. I think it's
OK
is that really true? when i looked into this [ about 5 years ago! ]
all i found was some bit-wise operations on index increments for
oscillators and stuff -- it would be no big deal to replace the bit-wise
stuff with a modulo or if statement?
Post by Victor NK-X-TODEL918ani
What I think would be useful is to allow any size tables to
be created (I don't think this is possible for all GENS)
isn't that what i just said?
Matt;
________________________
matt ingalls
http://sonomatics.com
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Michael Gogins
2006-01-23 21:51:45 UTC
Permalink
I agree with Istvan about this.

Regards,
Mike

-----Original Message-----
Sent: Jan 23, 2006 3:42 PM
Subject: Re: [Cs-dev] function tables power-of-2, etc
Post by Matt Ingalls
is that really true? when i looked into this [ about 5 years ago! ]
all i found was some bit-wise operations on index increments for
oscillators and stuff -- it would be no big deal to replace the bit-wise
stuff with a modulo or if statement?
Simply replacing a & with a % is not enough, as the latter cannot
deal with negative numbers correctly, so you need an additional
if statement to fix that. Also, a % is much slower than a &.
An if statement is again not enough, as you need at least two to
wrap negative numbers, and more to deal with the possibility of
a very large index.
In any case, using the & operator is the simplest and fastest
way to wrap any integer value to a 0..N-1 range, as long as
N is an integer power of two.
Additionally, more changes are needed to clean up any tricky code
that assumes in some (often non-obvious) way a power of two or at
least even table size. There are many possibilities for introducing
bugs, something that is best avoided when a release is just about
to be made.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
Loading...