
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
simple-beatmaker
Advanced tools
Generate drum sounds from scratch and create beats programmatically with pure JavaScript - no external WAV files needed!
A Node.js package that generates drum sounds from scratch and creates beats programmatically. No external WAV files needed - all drum sounds are synthesized using mathematical formulas!
npm install -g simple-beatmaker
Create a template file with all options:
beatmaker generate init
Or generate a simple kick-clap beat:
beatmaker generate kick-clap
Then edit the generated .js file and play it:
beatmaker play beatmaker-template.js
Create a file called my-beat.js:
const SimpleBeatmaker = require('simple-beatmaker');
const beatmaker = new SimpleBeatmaker();
// Create and play a beat
beatmaker
.setBPM(120)
.setDrumSet('classic')
.usePreset('basic-rock')
.play(2); // Play 2 loops
Then play it:
beatmaker play my-beat.js
That's it! The command will execute your JavaScript file and generate a WAV file that plays automatically.
# Generate template files
beatmaker generate init # Creates beatmaker-template.js with all options
beatmaker generate kick-clap # Creates kick-clap-beat.js with simple beat
# Play JavaScript beat files
beatmaker play my-beat.js # Execute and play your beat file
# Get help
beatmaker help # Show all available commands
const SimpleBeatmaker = require('simple-beatmaker');
const beatmaker = new SimpleBeatmaker();
// Set tempo
beatmaker.setBPM(120); // Default: 120 BPM
// Choose drum set
beatmaker.setDrumSet('classic'); // Options: 'classic', 'electronic', 'vintage'
// Set output directory (optional)
beatmaker.setOutputDir('beats'); // Save to 'beats' folder (creates if needed)
// Use a preset pattern
beatmaker.usePreset('basic-rock'); // See available presets below
// Or create custom pattern
beatmaker.createPattern(bars, pattern);
// Generate and play
beatmaker.play(loops, filename);
Create 16-step patterns (16th notes per bar):
const customPattern = [
// Bar 1
[
['kick'], null, ['hihat'], null, // Steps 1-4
['snare'], null, ['hihat'], null, // Steps 5-8
['kick'], null, ['hihat'], null, // Steps 9-12
['snare'], null, ['hihat'], null // Steps 13-16
],
// Bar 2
[
['kick'], ['hihat'], null, ['hihat'],
['snare'], ['snare'], ['hihat'], null,
['kick'], ['kick'], ['hihat'], ['snare'],
['snare'], ['kick'], ['hihat'], ['kick']
]
];
beatmaker.createPattern(2, customPattern);
null = silence on that step['kick'] = kick drum on that step['snare'] = snare drum on that step['hihat'] = hihat on that step['kick', 'snare'] = multiple drums on same stepkick or k: Kick drumsnare or s: Snare drumhihat or h: Hi-hatclap or c: Hand clapcrash or x: Crash cymbaltom or t: Tom drumBy default, WAV files are saved to the current directory. You can specify a custom output directory:
// Save to a specific folder
beatmaker.setOutputDir('my-beats'); // Creates 'my-beats' folder if needed
// Relative paths
beatmaker.setOutputDir('./output/drums'); // Save to output/drums
// Absolute paths
beatmaker.setOutputDir('/home/user/music'); // Linux/macOS
beatmaker.setOutputDir('C:\\Music\\Beats'); // Windows
// Reset to default (current directory)
beatmaker.setOutputDir(null);
The directory will be created automatically if it doesn't exist.
const SimpleBeatmaker = require('simple-beatmaker');
const beatmaker = new SimpleBeatmaker();
beatmaker
.setBPM(130)
.setDrumSet('electronic')
.usePreset('electronic-dance')
.play(4, 'dance-track.wav');
const SimpleBeatmaker = require('simple-beatmaker');
const beatmaker = new SimpleBeatmaker();
const funkyPattern = [
[
['kick'], null, null, ['hihat'],
null, ['clap'], ['kick'], null, // Using clap instead of snare
null, ['hihat'], ['kick'], null,
['tom'], null, ['hihat'], ['crash'] // Tom and crash at the end
]
];
beatmaker
.setBPM(95)
.setDrumSet('vintage')
.createPattern(1, funkyPattern)
.play(8, 'funk-groove.wav');
const SimpleBeatmaker = require('simple-beatmaker');
const beatmaker = new SimpleBeatmaker();
// Classic version
beatmaker.setBPM(120).setDrumSet('classic').usePreset('basic-rock').play(1, 'classic.wav');
// Electronic version
beatmaker.setBPM(120).setDrumSet('electronic').usePreset('basic-rock').play(1, 'electronic.wav');
// Vintage version
beatmaker.setBPM(120).setDrumSet('vintage').usePreset('basic-rock').play(1, 'vintage.wav');
const SimpleBeatmaker = require('simple-beatmaker');
const beatmaker = new SimpleBeatmaker();
// Organize beats by genre
beatmaker
.setBPM(128)
.setDrumSet('electronic')
.setOutputDir('beats/electronic') // Save to beats/electronic/ folder
.usePreset('electronic-dance')
.play(2, 'dance-beat.wav');
// Different folder for rock beats
beatmaker
.setBPM(120)
.setDrumSet('classic')
.setOutputDir('beats/rock') // Save to beats/rock/ folder
.usePreset('basic-rock')
.play(2, 'rock-beat.wav');
beatmaker generate init to create a template, then customize itbeatmaker generate kick-clap for a quick startbeatmaker play filename.js to execute and generate audioSimple Beatmaker generates all drum sounds mathematically:
Different drum sets use different parameters and processing to create distinct sonic characters.
MIT
Issues and pull requests welcome on GitHub!
FAQs
Generate drum sounds from scratch and create beats programmatically with pure JavaScript - no external WAV files needed!
We found that simple-beatmaker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.