This project is a Drum Machine web application built as part of the FreeCodeCamp Front End Development Libraries certification. It allows users to play drum sounds by clicking on drum pads or using keyboard keys.
- Interactive drum pads that can be triggered by mouse clicks or keyboard presses
- Visual feedback when drum pads are activated
- Display showing the name of the currently played sound
- HTML5
- CSS3
- JavaScript (ES6+)
- React.js
- Create React App
- The app has an outer container with id="drum-machine" that contains all other elements.
- Within #drum-machine, there is an element with id="display".
- Within #drum-machine, there are 9 clickable drum pad elements, each with:
- A class name of "drum-pad"
- A unique id describing the audio clip
- Inner text corresponding to keyboard keys Q, W, E, A, S, D, Z, X, C
- Each .drum-pad contains an HTML5 audio element with:
- A src attribute pointing to an audio clip
- A class name of "clip"
- An id corresponding to the inner text of its parent .drum-pad
- Clicking on a .drum-pad element triggers its audio clip.
- Pressing the trigger key associated with each .drum-pad triggers its audio clip.
- When a .drum-pad is triggered, a string describing the associated audio clip is displayed in the #display element.
- Clone the repository:
git clone [https://github.com/JohnDev19/Drum-Machine]
- Navigate to the project directory:
cd drum-machine
- Install dependencies:
npm install
- Start the development server:
npm start
- Open http://localhost:3000 to view it in the browser.
- Click on the drum pads or press the corresponding keyboard keys to play sounds.
- The name of the played sound will be displayed in the display area.
Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.
This project is MIT licensed.
- FreeCodeCamp for the project idea and requirements