Package Exports
- drumkit-keys
- drumkit-keys/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (drumkit-keys) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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.