🎶 Drum Machine project, where you can click or press a key and it will highlight this button and play a unique sound. Visit the project by clicking here.
This project is part of the FreeCodeCamp Frontend Libraries Projects, and follows a series of requested user stories. You can visit the project's website and click 'Run Tests' on the FreeCodeCamp Test Suite on the top left corner to see the below tests pass.
- User Story #1: I should be able to see an outer container with a corresponding
id="drum-machine"
that contains all other elements. - User Story #2: Within
#drum-machine
I can see an element with a correspondingid="display"
. - User Story #3: Within
#drum-machine
I 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. - User Story #4: Within each
.drum-pad
, there should be an HTML5audio
element which has asrc
attribute pointing to an audio clip, a class name ofclip
, and an id corresponding to the inner text of its parent.drum-pad
(e.g.id="Q"
,id="W"
,id="E"
etc.). - User Story #5: When I click on a
.drum-pad
element, the audio clip contained in its childaudio
element should be triggered. - User Story #6: When I press the trigger key associated with each
.drum-pad
, the audio clip contained in its childaudio
element should be triggered (e.g. pressing the Q key should trigger the drum pad which contains the string "Q", pressing the W key should trigger the drum pad which contains the string "W", etc.). - User Story #7: When a
.drum-pad
is triggered, a string describing the associated audio clip is displayed as the inner text of the#display
element (each string must be unique).
🎶 To run the project locally, use your favorite command-line interface to type the following commands:
- Clone it with
git clone git@github.com:carolinaknoll/drum-machine.git
- Go to the project's directory with
cd drum-machine
- Install the required dependencies with
npm install
- Finally, start the project with
npm start