
Drum Machine
- Summary: A FreeCodeCamp challenge for a drum that can be played with either your keyboard or your mouse.
- Source URL: https://codepen.io/michellemtchai/pen/mdEyBRV
- Demo URL: https://codepen.io/michellemtchai/full/mdEyBRV
- Stacks:
Objective
Build a CodePen.io app that fulfills the user stories and passes all the tests provided by FreeCodeCamp
Original Challenge: https://www.freecodecamp.org/learn/front-end-libraries/front-end-libraries-projects/build-a-drum-machine
User Stories
- I should be able to see an outer container with a corresponding
id="drum-machine"that contains all other elements. - Within
#drum-machineI can see an element with a correspondingid="display". - Within
#drum-machineI can see 9 clickable drum pad elements, each with a class name ofdrum-pad, a unique id that describes the audio clip the drum pad will be set up to trigger, and an inner text that corresponds to one of the following keys on the keyboard:Q,W,E,A,S,D,Z,X,C. The drum pads MUST be in this order. - Within each
.drum-pad, there should be an HTML5 audio element which has asrcattribute pointing to an audio clip, a class name ofclip, and anidcorresponding to the inner text of its parent.drum-pad(e.g.id="Q",id="W",id="E"etc.). - When I click on a
.drum-padelement, the audio clip contained in its child audio element should be triggered. - When I press the trigger key associated with each .drum-pad, the audio clip contained in its child audio element should be triggered (e.g. pressing the
Qkey should trigger the drum pad which contains the stringQ, pressing theWkey should trigger the drum pad which contains the stringW, etc.). - When a
.drum-padis triggered, a string describing the associated audio clip is displayed as the inner text of the#displayelement (each string must be unique).

