Csound Csound-dev Csound-tekno Search About

ctrlinit w/ tablelookup

Date2005-12-27 01:26
FromAtte André Jensen
Subjectctrlinit w/ tablelookup
Attachmentscontrollers_in_tables.csd  
Hi

I'm trying to put the value of all realtime controllers in tables. I 
managed to generate the attached csd, that almost works. Problem is the 
controller always starts out with value 127, whereas I'd like to define 
(using GEN2) some starting position for each controller. For volume (as 
used in the attached exmple) it should be 64. I'm not sure where my code 
fails, but I have at least the following specific questions:

1) How do I fill a really, really, huge table with only values of 64 
from a GEN function?

2) I think the table stores only 64's. Is this correct? If so, why 
doesn't the line "printk 1, kc_7" print out 64 as the first thing?

3) If I enable the line containing the crtlinit, I can initialize the 
controller to any value (by changing i(kc_7) to a number), which I guess 
is what I'm supposed to do. The controller is initialized correctly, but 
playing polyphonicly will make the newly allocated voices init the 
controller again.

Part of the idea was to experiment with saving the tables to disk before 
closing csound and reading them in again on startup, to restore all 
controllers. This leads to:

4) Will I get into trouble if I need to change the table sizes 
(internally) later and trying to read different sizes from disk?

5) What would be a clever place to activate the "save all controllers" 
call? I'd like it to be as automatic as possible, but I guess saving 
them every minute or so would bad for performance, or?

I hope someone can help me sort it out, at least any help would be 
appreciated...

-- 
peace, love & harmony
Atte

http://www.atte.dk

Date2005-12-28 00:17
FromAtte André Jensen
SubjectRe: ctrlinit w/ tablelookup
Atte André Jensen wrote:

> 3) If I enable the line containing the crtlinit, I can initialize the 
> controller to any value (by changing i(kc_7) to a number), which I guess 
> is what I'm supposed to do. The controller is initialized correctly, but 
> playing polyphonicly will make the newly allocated voices init the 
> controller again.

I think I found the problem; i(kc_7) gives the value of kc_7 on 
instantiation time (0) and doesn't convert kc_7 to an irate variable 
with a value of what kc_7 is at this point in the code. I'm currently 
away from any realtime input, but the attached csd seems to support this 
idea: the "print i(kval)" prints 0, not 50.

If this is all true, my problem boils down to this: How do I "do some 
stuff at k-rate" and call ctrlinit (that needs irate arg3) with the result?

I have an idea that this alternate approach might work (replaces 
"controller stuff section of controllers_in_tables.csd), but will have 
to test in the morning with a controller:

; ----------------------------------------------------------
; controller stuff
iinstr_index	p1
ic_7		table		iinstr_index, 10000 + 7
		ctrlinit	imidich, 7, ic_7
kc_7		table		iinstr_index, 10000 + 7
		printk		1, kc_7
imidich		midichn	
kc_7		ctrl7		imidich, 7, 0, 127
		tablew		kc_7, iinstr_index, 10000 + 7
kc_volume	=		kc_7 / 127
		printk		1, kc_7
; ----------------------------------------------------------

-- 
peace, love & harmony
Atte

http://www.atte.dk

Date2005-12-28 06:12
From"Matt J. Ingalls"
SubjectRequests for MacCsound features & bugs
Hi

i'm hopefully getting together a new version of MacCsound soon -- it's 
been too long -- If any of yall have any feature requests or annoying bugs 
to report, i would be very interested in hearing them! :)

maybe offlist would be better:  matt@sonomatics.

Thanks!
matt

Date2005-12-28 23:16
FromIain Duncan
SubjectRe: ctrlinit w/ tablelookup
My solution is ( as usual ) to just use midiin and store control 
variables in tables; the instruments read from the tables, and the midi 
input instrument routes data into those tables. That way you can stick 
whatever start up value you want in the table, and they won't change 
until you receive a cc message. It's also handy for dealing with some 
annoying cc standards on old synths.

Iain

Atte André Jensen wrote:
> Atte André Jensen wrote:
> 
>> 3) If I enable the line containing the crtlinit, I can initialize the 
>> controller to any value (by changing i(kc_7) to a number), which I 
>> guess is what I'm supposed to do. The controller is initialized 
>> correctly, but playing polyphonicly will make the newly allocated 
>> voices init the controller again.
> 
> 
> I think I found the problem; i(kc_7) gives the value of kc_7 on 
> instantiation time (0) and doesn't convert kc_7 to an irate variable 
> with a value of what kc_7 is at this point in the code. I'm currently 
> away from any realtime input, but the attached csd seems to support this 
> idea: the "print i(kval)" prints 0, not 50.
> 
> If this is all true, my problem boils down to this: How do I "do some 
> stuff at k-rate" and call ctrlinit (that needs irate arg3) with the result?
> 
> I have an idea that this alternate approach might work (replaces 
> "controller stuff section of controllers_in_tables.csd), but will have 
> to test in the morning with a controller:
> 
> ; ----------------------------------------------------------
> ; controller stuff
> iinstr_index    p1
> ic_7        table        iinstr_index, 10000 + 7
>         ctrlinit    imidich, 7, ic_7
> kc_7        table        iinstr_index, 10000 + 7
>         printk        1, kc_7
> imidich        midichn   
> kc_7        ctrl7        imidich, 7, 0, 127
>         tablew        kc_7, iinstr_index, 10000 + 7
> kc_volume    =        kc_7 / 127
>         printk        1, kc_7
> ; ----------------------------------------------------------
>