Csound Csound-dev Csound-tekno Search About

[Cs-dev] Making table opcodes

Date2005-07-19 20:31
FromIain Duncan
Subject[Cs-dev] Making table opcodes
The opcode I want to do is meant to streamline some table based patch 
morphing, so it will do a bunch of table i/o. Am I to understand that I 
should no longer use the methods in the table functions in ugens2.c but 
should just use API table calls within my opcode loop? Is this 
acceptable as far as performance is concerned or will it be noticeably 
faster if I do the table code myself in C as with table, etc.

Thanks
Iain


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-07-19 20:56
FromIstvan Varga
SubjectRe: [Cs-dev] Making table opcodes
Iain Duncan wrote:

> The opcode I want to do is meant to streamline some table based patch 
> morphing, so it will do a bunch of table i/o. Am I to understand that I 
> should no longer use the methods in the table functions in ugens2.c but 
> should just use API table calls within my opcode loop? Is this 
> acceptable as far as performance is concerned or will it be noticeably 
> faster if I do the table code myself in C as with table, etc.

I am not sure how your table opcode is intended to work, but with
the following function you can get the table length and a pointer to
the table data:

MYFLT *csoundGetTable(void *csound, int tableNum, int *tableLength);

You should call it as csound->GetTable() if you have an ENVIRON *csound
pointer. tableNum is the table number, and tableLength is a pointer
to a variable of type 'int' in which the table length (not including the
guard point) will be stored. Return value is a pointer to the first
element (index zero) of the table, or NULL if the table is not found.

example (clears table 1 to zero at init time):

MYFLT *fp;
int i, flen;

fp = csound->GetTable(csound, 1, &flen);
if (fp == NULL) {
   return csound->InitError(csound, Str("table not found"));
}
for (i = 0; i <= flen; i++)
   fp[i] = FL(0.0);

csoundGetTable() works with non-power of two length and deferred tables
as well, and can be called both at init and perf time.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-07-19 22:53
FromAnthony Kozar
SubjectRe: [Cs-dev] Making table opcodes
You might want to check out all of the table reading/writing opcodes and the
vectorial opcodes from Gab that are now in Csound 5 to make sure that what
you want to do is not already there.

Anthony Kozar
anthonykozar@sbcglobal.net
http://akozar.spymac.net/

On 7/19/05 3:31 PM, Iain Duncan  etched in stone:

> The opcode I want to do is meant to streamline some table based patch
> morphing, so it will do a bunch of table i/o.



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-07-20 00:42
FromIain Duncan
SubjectRe: [Cs-dev] Making table opcodes
Thanks. I did do so, and for some reason the way I was doing it before 
was behaving very strangely, perhaps there are bugs in some of the 
opcodes I was using. With all the layers required though, I couldn't 
pinpoint the problem. I'm hoping that by doing it with a new opcode I 
can use the api message functions and get to the root of it.

Iain

Anthony Kozar wrote:
> You might want to check out all of the table reading/writing opcodes and the
> vectorial opcodes from Gab that are now in Csound 5 to make sure that what
> you want to do is not already there.
> 
> Anthony Kozar
> anthonykozar@sbcglobal.net
> http://akozar.spymac.net/
> 
> On 7/19/05 3:31 PM, Iain Duncan  etched in stone:
> 
> 
>>The opcode I want to do is meant to streamline some table based patch
>>morphing, so it will do a bunch of table i/o.
> 
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-07-20 19:49
FromIain Duncan
SubjectRe: [Cs-dev] Making table opcodes
How is the performance trade off in cpu speed between using higher level 
API table functions and the original C code in the table functions?

Thanks
Iain

Istvan Varga wrote:
> Iain Duncan wrote:
> 
>> The opcode I want to do is meant to streamline some table based patch 
>> morphing, so it will do a bunch of table i/o. Am I to understand that 
>> I should no longer use the methods in the table functions in ugens2.c 
>> but should just use API table calls within my opcode loop? Is this 
>> acceptable as far as performance is concerned or will it be noticeably 
>> faster if I do the table code myself in C as with table, etc.
> 
> 
> I am not sure how your table opcode is intended to work, but with
> the following function you can get the table length and a pointer to
> the table data:
> 
> MYFLT *csoundGetTable(void *csound, int tableNum, int *tableLength);
> 
> You should call it as csound->GetTable() if you have an ENVIRON *csound
> pointer. tableNum is the table number, and tableLength is a pointer
> to a variable of type 'int' in which the table length (not including the
> guard point) will be stored. Return value is a pointer to the first
> element (index zero) of the table, or NULL if the table is not found.
> 
> example (clears table 1 to zero at init time):
> 
> MYFLT *fp;
> int i, flen;
> 
> fp = csound->GetTable(csound, 1, &flen);
> if (fp == NULL) {
>   return csound->InitError(csound, Str("table not found"));
> }
> for (i = 0; i <= flen; i++)
>   fp[i] = FL(0.0);
> 
> csoundGetTable() works with non-power of two length and deferred tables
> as well, and can be called both at init and perf time.
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2005-07-20 21:04
FromIstvan Varga
SubjectRe: [Cs-dev] Making table opcodes
Iain Duncan wrote:

> How is the performance trade off in cpu speed between using higher level 
> API table functions and the original C code in the table functions?

The original table opcodes also use API functions to query function
tables. However, it would be easier to find out what is the best way
to implement your new opcodes with some information on what they are
intended to do.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net