[Stk] some bugs in 4.4.1?

Richard Dobson richarddobson at blueyonder.co.uk
Sun Jan 17 11:56:45 PST 2010


Hello all,

I just downloaded the latest version and found a few matters arising, 
running the "demo" example program (ppc, OS X 10.4).


(a) running out of voices

the demo code declares the instance of Voicer with a decay value of 0:

    data.voicer = (Voicer *) new Voicer( 0.0 );

This presents a problem, as the voice turnoff code in Voicer never gets 
executed. I suggest replacing the current tick code (Voicer.h):

if ( voices_[i].sounding < 0 ) {
     voices_[i].sounding++;
     if ( voices_[i].sounding == 0 )
         voices_[i].noteNumber = -1;
}

with:


if ( voices_[i].sounding < 0 )
     voices_[i].sounding++;
if ( voices_[i].sounding == 0 )
     voices_[i].noteNumber = -1;


(b) pitchbend breaks the demo program


In demo.cpp the pitchbend is processed as a 14bit value:

case __SK_PitchBend_:
     short temp;
     temp = data->message.intValues[1] << 7;
     temp += data->message.intValues[0];
     data->voicer->pitchBend( (StkFloat) temp );


but in Voicer it is assumed to be 7bit:

if ( value < 64.0 )
     pitchScaler = pow(0.5, (64.0-value)/ 64.0);
   else
     pitchScaler = pow(2.0, (value- 64.0)/64.0);

This breaks things so much that even Ctrl-C can't kill the program.

Assuming the 14bit value is intended, as seems reasonable, I suggest 
that 64 above be replaced with 8192.0.


(3)  not investigated yet

Running demo with a command such as:
./demo BeeThree -n 16  -or -im 1

It is consistently dropping the first MIDI event; e.g. if I play two 
notes in succession, the first is lost, subsequent ones play correctly. 
Alternatively (with the code corrected as above) if I move the pitchbend 
wheel first,  the first note played does get rendered.


Richard Dobson




More information about the Stk mailing list