Wednesday, November 26, 2008

Silverlight Drum Pad




This is a simple drum pad. I wanted to test out Silverlight's sound sample playback capability and this seemed like a great project for doing that.


The corresponding keyboard keys are listed on each pad:

  • Toms - A, S, D
  • Crash - C
  • Kick - Z
  • Snare - X
  • Hi-Hat - Open: K; Closed: M
The source code is available for download at CodePlex.

Feel free to comment. Enjoy!

-Ken

5 comments:

Aaron said...

fun. with a few graphics it would be cool. It sounds like you're restarting a media element every time the key is pressed rather than playing a new instance (as the audio clips and restarts if a key is pressed in succession quickly).

I used this technqiue:
Audio

Ken said...

Aaron,
Thanks for the comment. I agree that graphics would make this cooler, maybe I'll add something in the future. I didn't want to waste time on that since I'm pretty week in that area. Also, I created a separate channel for each drum. The open and closed hi-hat share a channel. I'll check out the technique that you're using, perhaps I can employ something similar here. Thanks again for the comment!
-Ken

Aaron said...

I posted a complete sample of what I was suggesting here.

Anonymous said...

you need to preload the audio files, nothing worked until I had tried each sample once.

Jeff Paries said...

Cool - reminds me of one I built last March, and then updated in July. 6 different drum kits, 5 backing tracks, and independent volume controls for the drums and backing track:

http://designwithsilverlight.com/csharp/drumpad_v2/default.html