[Stk] Drum noteOn?

Ryan Compton rcompton at math.ucla.edu
Sat Apr 11 15:46:41 PDT 2009


Hi,

I started using STK the other day and can't seem to figure out how to
use the noteOn for a Drummer.

The following code plays a guitar just fine:

Plucked *guitar = new Plucked(220.0); //build a guitar
StkFrames *sound(22050,1); //setup a half second of noise
guitar->noteOn(220.0 , .7); //play a note
guitar->noteOff(.01); //unplay a note
guitar->tick(*sound); //tick the frame into *sound
output.tick( *sound); //tick the *sound into output

This code makes a "d'oh!":

Drummer *whack = new Drummer(); //build a drum
StkFrames *sound(22050,1); //setup a half second of noise
whack->noteOn(42 , .7); //play a note
whack->noteOff(.01); //unplay a note
whack->tick(*sound); //tick the frame into *sound
output.tick( *sound); //tick the *sound into output

I know I'm supposed to use MIDI numbers to specify which drum, but
whatever MIDI number I use will just produce a "d'oh!".

Thanks and d'oh,
Ryan



More information about the Stk mailing list