Csound Csound-dev Csound-tekno Search About

[Csnd] Ctrl7 initialization anomaly

Date2008-04-21 00:14
From"Art Hunkins"
Subject[Csnd] Ctrl7 initialization anomaly
I'd like to report some unexpected results when initilizing ctrl7.

I've always used the full MIDI range (0-127) with ctrl7, and have always 
initialized with ctrlinit to a value of zero. What I've just discovered, 
though, is that intialization only works as you'd expect when ctrl7's range 
is 0-127. (Even then, if you omit ctrlinit, ctrl7 initializes to *127* 
instead of zero. Indeed, lacking ctrlinit, it always initializes to the 
highest allowable value.)

Where things get weird is when the range for ctrl7 is other than 0-127, and 
you need to use ctrlinit in order to specify an initial value other than the 
highest listed. (Now I know why I've always needed to *move* controllers 
physically to zero after starting csound and before turning on the first 
note - if controllers were being used as volume faders. It really would be 
nice to be able to preset controllers to zero *before* starting csound. If 
you forget to move the faders at the proper time, you'll be in for a rude 
awakening - as in notes entering full force when they're started.)

Basically, as shown in the .csd below, if you want the init value to be the 
*lowest* specified by ctrl7 (as I'd think would be normal), you need to set 
ctrlinit to *zero* instead of the lowest number of the range. Ctrlinit seems 
to be assuming that ctrl7's range is 0-127, and if it isn't, is 
adjusting/converting its calculations (in some way) accordingly.

One other observation: substituting an init statement for ctrlinit - either 
before or after ctrl7, has no effect whatever. It looks like the running 
program reads a value from ctrl7 whether the control's been moved or not - 
and overriding any simple init specification. (This would seem fine to me if 
it defaulted to the *lowest value* of its specified range. Unfortunately it 
doesn't.)

I'd appreciate knowing whether all this works the same on other platforms. 
You don't need a MIDI device for this, unless you want to see what moving 
the controller (CC 7, the mod wheel) does to ctrl7's subsequent values.

As long as you know what you're doing, you can work around this anomalous 
behavior. It's just darned confusing. Probably would be a good thing to 
document in the manual at least.

Art Hunkins




-odac0 -M0




 instr 1

        ctrlinit 1, 7, 0
k1      ctrl7 1, 7, 1, 10
printk  1, k1

 endin





i1 0 10

e