drumkit-keys
v1.0.2
Published
A JavaScript library that simulates drum kit parts and returns the part corresponding to a number
Maintainers
Readme
DrumKit Keys
DrumKit Keys is a JavaScript library that simulates the components of a drum kit.
It allows you to retrieve the corresponding drum piece for a given number and “play” it in the console.
Installation
npm install drumkit-keys
Usage
const drum = require("drumkit-keys");
// Get a specific piece
console.log(drum.getPiece(1)); // Closed Hi-Hat
console.log(drum.getPiece(5)); // High Tom
// Simulate a drum hit
drum.play(2); // Sound: Snare
// Show the entire kit
console.log(drum.showKit());Technical Overview
The library represents a standard drum kit with 9 components:
| Number | Drum Piece | | ------ | ---------------- | | 1 | Closed Hi-Hat | | 2 | Snare | | 3 | Kick / Bass Drum | | 4 | Open Hi-Hat | | 5 | High Tom | | 6 | Mid Tom | | 7 | Low Tom | | 8 | Crash | | 9 | Ride |
Functionality:
getPiece(number) → returns the drum piece corresponding to the number (1–9).
play(number) → simulates a drum hit by printing the drum piece in the console.
showKit() → returns the full drum kit list with all pieces and their corresponding numbers.
Applications
DrumKit Keys can be applied in various contexts:
- Educational – Teaching the layout of a drum kit and helping beginners learn the parts.
- Musical programming – Simulating drum patterns or rhythms in JavaScript.
- Games and interactive apps – Creating drum-based memory games or mini drum machines.
- Audio or MIDI projects – Mapping numbers to drum components for virtual drum kits or MIDI interfaces.
Author
Sebastiano Ticli
This project was developed as an exercise for a JavaScript programming course.
