A vibrant and interactive drum machine built with React that brings rhythm to your fingertips! This project features a responsive button grid for playing drum sounds, digital controls to manage power and volume, and a display screen to showcase the current sound or setting.
-
Dynamic Drum Pads 🎹
Play a variety of drum sounds by clicking the on-screen buttons or using your keyboard. -
Power Toggle 🔌
Easily turn the drum machine on and off. -
Volume Control 🔊
Adjust the volume with an intuitive slider. -
Digital Display 🖥️
See real-time updates on the current sound, volume level, or power state. -
Smooth UI & Animations 🎨
Enjoy responsive design and engaging animations with each interaction.
- React: For building the interactive user interface.
- JavaScript (ES6): To create dynamic and responsive functionality.
- CSS: Custom styles in
drum_style.cssandApp.cssfor an engaging user experience.
-
Clone the Repository:
git clone https://github.com/your-username/react-drum-machine.git cd react-drum-machine -
Install Dependencies:
npm install
This command installs all required packages for the project.
-
Start the Development Server:
npm start
The application will open in your default browser at http://localhost:3000.
-
Play Sounds:
Click on the drum pads or press the corresponding keys (Q, W, E, A, S, D, Z, X, C) to play different drum sounds. -
Power Toggle:
Use the power switch to enable or disable the drum machine. -
Volume Control:
Adjust the volume using the slider. The current volume or sound name is displayed on the digital screen. -
Digital Display:
The screen updates to show the current sound being played, volume level changes, or power status.
react-drum-machine/
├── public/
│ └── index.html
├── src/
│ ├── drum/
│ │ ├── button_grid.js // Drum pad grid component
│ │ ├── controls.js // Power and volume control component
│ │ ├── digital-screen.js // Display screen component
│ │ └── drum_style.css // Drum-specific styles
│ ├── App.js // Main App component
│ ├── App.css // Global styles for the app
│ └── index.js // Entry point rendering App component
├── .gitignore
├── package.json
└── README.md
-
ButtonGrid:
Handles the display of drum pads and triggers audio playback when buttons are clicked or keys are pressed. -
Controls:
Manages power toggling and volume adjustments. Updates the display screen based on user interactions. -
Screen:
Displays the current state, including the active sound name or volume level. -
App:
Integrates all components and maintains the overall state for power, volume, and display text.
For detailed implementation, check out the source files in the src/drum/ directory.
Contributions are welcome! Feel free to open issues or submit pull requests for improvements or new features.
This project is licensed under the [MIT License].
- FreeCodeCamp Audio – For providing accessible drum sound samples.
