<< Chapter < Page | Chapter >> Page > |
A webcam will videotape the paper and stick movement; then, a computer will process the images to determine the drum stick positions. Once the microphone detects the audio signal created by the player hitting the drums on the paper, the visual information showing the current position of the drum stick is used to generate the correct sounds.
Whether the stick hits the paper or not, we processed the snapshots and saved the current stick location in an array. Only when the stick hits the paper, which is detected by the impulse from the microphone, we took out the position information to generate the correct sounds.
Below is how we divide our paper. Each part corresponds to a unique sound. In total there are four parts. The stick position determines which sound to play by the computer.
Playing different sounds
i=0;
playing=0;sample_rate_devider=3;
while(1==1)i = i+1;
if (sample_rate_devider==3)hitPosition = tracking(vidobj,edgePosition);
sample_rate_devider=0;endsample_rate_devider=sample_rate_devider+1;pastData = sampleAudio(pastData,ai,dataLengthConstant);
% if we got a audio triggerif(playing ~=0)
playing=playing-1;else
if(testImpulse(pastData,threshHold)==1)playing = 5;
soundType = getWhichSound(hitPosition,edgePosition);% makeSound(soundType);
if (soundType==1)%play sound1
sound(sound1,Fs1);elseif (soundType==2)
%play sound 2sound(sound2,Fs2);
elseif (soundType==3)%play sound 3
sound(sound3,Fs3);else (soundType==4)
%play sound 4sound(sound4,Fs4);
endend
endend
Notification Switch
Would you like to follow the 'Virtual drum kit' conversation and receive update notifications?