<< Chapter < Page Chapter >> Page >
This module discusses our approach to play the hit drum's sound and display it's image on the animated interface.

Producing drum sounds and displaying the drum

Once we have determined which drum has been hit, we play the appropriate sound and display the corresponding image. The drum sounds and images are preloaded in separate .mat files at the beginning of the program using the load command to expedite execution.

load drumsounds

load drumpics

Drum sounds:

drumpics.mat was created by importing drum samples in the wav format using wavread() and wavadd() . wavread(‘wavfile’) is a Matlab function that stores wav files as an Nx2 matrix. wavadd(sound1,sound2) is a function that we created to allow the simultaneous play of two different sounds. For example, if both the snare and the crash cymbal were hit at the same time, we zero pad the shorter matrix and combine them as one sound matrix. In the main program, the Matlab function soundsc(sound, fs) plays the corresponding sound file, where‘fs’is the sampling rate. Our wav files were sampled at 22 kHz to allow for smaller sound variables without affecting the sound quality too much. All of our drum samples were obtained free online from a Yamaha 9000 drum kit.

Drum pictures:

drumsounds.mat was created by importing jpeg files using the imread() Matlab command to store the images as variables. The images were created from Google SketchUp, a free 3D modeling program available online. Different views were created to simulate the feel of animation.

Main view
Crash cymbal and snare were hit

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Tap that: a virtual drum kit. OpenStax CNX. Dec 19, 2007 Download for free at http://cnx.org/content/col10502/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Tap that: a virtual drum kit' conversation and receive update notifications?

Ask