[Stk] Drum noteOn?

Beinan Li li.beinan at gmail.com
Sun Apr 12 00:18:19 PDT 2009


Forgot to say,
so your problem was probably that some input instrument values got mapped to
the sparse-values, i.e. "0", of the sparse-array $genMIDIMap; hence the same
drum-sample "Dope~", as $waveNames[0] got called,
which used to be exactly my problem as well.

If you don't want to play with the non-linear mapping, you could change the
sparse-array so that other drum-sound will have greater "probability" to get
called.

Hope this helps.

Beinan

On Sat, Apr 11, 2009 at 6:46 PM, Ryan Compton <rcompton at math.ucla.edu>wrote:

> 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
>
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20090412/b708a700/attachment.html 


More information about the Stk mailing list