Skip to content
/ BeatR Public

**BeatR** is a modern, browser-based drum machine that uses the Web Audio API to synthesize drum sounds in real-time. With an intuitive grid interface and precise timing, you can create professional-sounding beats without any external audio files.

License

Notifications You must be signed in to change notification settings

SamSeenX/BeatR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Beatr V2 - Web Audio Drum Machine

License Platform Status

A powerful drum sequencer built with Web Audio API. Create beats in your browser with synthesized drum sounds - no samples required.

BeatR is a modern, browser-based drum machine that uses the Web Audio API to synthesize drum sounds in real-time. With an intuitive grid interface and precise timing, you can create professional-sounding beats without any external audio files.

๐ŸŽ‰ What's New in V2

We've completely overhauled the audio engine and UI to bring you a professional-grade beat-making experience:

  • ๐ŸŽ›๏ธ Full Mixer Console - Control volume, pan, 3-band EQ, and reverb for every single channel.
  • ๐Ÿ’ƒ Groove Control - Break away from the rigid grid with adjustable swing parameters.
  • ๐Ÿ“ฅ WAV Export - Record and export your beats directly to high-quality WAV files.
  • ๐ŸŽจ Visual Polish - Enhanced UI with smoother animations, new V2 branding, and refined controls.

โœจ Features

  • ๐ŸŽต 6 Synthesized Instruments - Kick, Snare, Hi-Hat, Tom, Clap, and Rim Shot
  • ๐ŸŽน 16-Step Sequencer - Classic drum machine grid interface
  • ๐ŸŽจ Modern Design - Clean, responsive UI with dark/light theme support
  • ๐ŸŽ›๏ธ Full Mixer - Volume, Pan, EQ, and Reverb per channel
  • ๐Ÿ’ƒ Swing/Groove - Add human feel to your beats
  • ๐Ÿ“Š Audio Visualizer - Real-time waveform visualization
  • โšก Precise Timing - Web Audio API scheduler for tight, accurate playback
  • ๐Ÿ’พ Pattern Storage - Save and load your beats with localStorage
  • ๐ŸŽฒ Pattern Generator - Create random patterns for inspiration
  • ๐Ÿ“ฅ Audio Export - Export your beats as WAV files
  • ๐ŸŒ Zero Dependencies - Pure vanilla JavaScript, no frameworks required
  • ๐Ÿ“ฑ Fully Responsive - Works on desktop, tablet, and mobile

๐Ÿš€ Quick Start

Online Demo

Visit beatr.samseen.dev

Local Development

# Clone the repository
git clone https://github.com/SamSeenX/beatr.git
cd beatr

# Open in browser
open index.html

# OR run a local server (recommended)
python3 -m http.server 8000
# Then visit http://localhost:8000

๐ŸŽฎ How to Use

Basic Controls

  1. Play/Stop - Click the play button to start/stop playback
  2. Tempo - Adjust BPM (60-200) with the slider
  3. Grid - Click cells to toggle drum hits on/off
  4. Theme - Toggle between dark and light modes

Buttons

Button Action
๐Ÿ”„ Clear Remove all beats from the grid
๐ŸŽฒ Random Generate a random pattern
๐Ÿ’พ Save Save current pattern to browser storage
๐Ÿ“ฅ Load Load previously saved pattern

Instruments

  • KICK - Deep bass drum
  • SNARE - Crisp snare with noise
  • HI-HAT - Bright metallic cymbal
  • TOM - Mid-range drum
  • CLAP - Hand clap sound
  • RIM - Rim shot

Tips

  • Start with a simple kick pattern (every 4 steps)
  • Add snare on steps 5 and 13 for a classic beat
  • Use hi-hats for rhythm (every 2-4 steps)
  • Experiment with the random generator for inspiration
  • Save your favorite patterns before closing the browser

๐Ÿ—๏ธ Project Structure

beatr/
โ”œโ”€โ”€ index.html          # Main application page
โ”œโ”€โ”€ css/
โ”‚   โ””โ”€โ”€ style.css       # Styles with theme support
โ”œโ”€โ”€ js/
โ”‚   โ”œโ”€โ”€ audio-engine.js # Web Audio API synthesis
โ”‚   โ””โ”€โ”€ app.js          # Application logic
โ”œโ”€โ”€ assets/             # Images and icons
โ”œโ”€โ”€ LICENSE             # MIT License
โ””โ”€โ”€ README.md           # This file

๐ŸŽต How It Works

Web Audio API Synthesis

Unlike traditional drum machines that use audio samples, this sequencer synthesizes all sounds using the Web Audio API:

  • Kick - Oscillator with exponential frequency decay
  • Snare - White noise + triangle wave oscillator
  • Hi-Hat - Filtered white noise burst
  • Tom - Oscillator with frequency sweep
  • Clap - Bandpass-filtered noise with envelope
  • Rim - Square wave with bandpass filter

Precise Timing

The sequencer uses a look-ahead scheduler to ensure tight, accurate timing:

  1. Schedules notes slightly ahead of playback time
  2. Uses Web Audio API's precise timing (not setTimeout)
  3. Updates UI independently of audio scheduling
  4. Maintains consistent tempo even under heavy load

๐Ÿ› ๏ธ Technical Details

Browser Compatibility

  • Chrome/Edge 89+
  • Firefox 88+
  • Safari 14.1+
  • Opera 75+

Requires Web Audio API support.

Performance

  • Zero latency - Direct audio synthesis
  • Low CPU usage - Efficient Web Audio API implementation
  • No network requests - All sounds generated in-browser
  • Small footprint - ~15KB total (uncompressed)

๐ŸŽจ Customization

Modifying Sounds

Edit js/audio-engine.js to customize drum sounds:

playKick(time) {
    // Adjust frequency, gain, or envelope
    osc.frequency.setValueAtTime(150, time); // Change pitch
    gain.gain.setValueAtTime(1, time);       // Change volume
}

Adding Instruments

  1. Add synthesis method to AudioEngine class
  2. Add instrument name to INSTRUMENTS array in app.js
  3. Update playSound() switch statement

Changing Grid Size

Modify the STEPS constant in app.js:

const STEPS = 32; // For a 32-step sequencer

๐Ÿ—บ๏ธ Roadmap

  • Export patterns as MIDI files
  • Additional drum sounds (cowbell, conga, etc.)
  • Swing/groove control
  • Individual instrument volume controls
  • Pattern chaining
  • Audio recording/export
  • Keyboard shortcuts
  • Multiple pattern banks

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Inspired by classic drum machines like the Roland TR-808
  • Built with the powerful Web Audio API
  • Design inspired by modern music production tools

โ˜• Support

If you find this project useful:

  • โญ Star the repository
  • ๐Ÿ› Report issues
  • ๐Ÿ’ก Suggest improvements
  • โ˜• Buy me a coffee

Created with โค๏ธ by SamSeen

beatr

About

**BeatR** is a modern, browser-based drum machine that uses the Web Audio API to synthesize drum sounds in real-time. With an intuitive grid interface and precise timing, you can create professional-sounding beats without any external audio files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published