# @chrisburnell/pentatonic

> Turn any array of integers into a fun little melody.

Latest version **1.1.5** (published 2026-09-14) · CC0 license · 0 weekly downloads

## Install

```sh
npm install @chrisburnell/pentatonic
pnpm add @chrisburnell/pentatonic
yarn add @chrisburnell/pentatonic
bun add @chrisburnell/pentatonic
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2026-09-14 |
| First published | 2020-09-25 |
| Weekly downloads | 0 |
| License | CC0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 2 |
| Author | Chris Burnell |
| Maintainers | chrisburnell |
| Keywords | audio, javascript, js |

## Links

- npm: https://www.npmjs.com/package/@chrisburnell/pentatonic
- Repository: https://github.com/chrisburnell/pentatonic
- Homepage: https://github.com/chrisburnell/pentatonic#readme
- Issues: https://github.com/chrisburnell/pentatonic/issues
- npm.io page: https://npm.io/package/@chrisburnell/pentatonic

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.1.5 (latest) — 2026-09-14
- 2.0.0-alpha.1 (canary) — 2026-09-20
- 1.1.4 — 2023-02-02
- 1.1.3 — 2023-02-01
- 1.1.2 — 2022-10-16
- 1.1.1 — 2022-01-24
- 1.1.0 — 2021-12-09
- 1.0.1 — 2021-11-17
- 1.0.0 — 2021-11-01
- 0.1.2 — 2020-10-13
- 0.1.1 — 2020-09-27
- 0.1.0 — 2020-09-27
- 0.0.3 — 2020-09-27
- 0.0.2 — 2020-09-25
- 0.0.1 — 2020-09-25

## README

# Pentatonic

> Turn any array of integers into a fun little melody

## What?

**Pentatonic** is a small JavaScript file that will play music generated from an array of integers from anywhere in your DOM.

## Why?

Why not?

No, but really though, there’s no serious reason for this. It’s just fun.

## Installation

-   **With npm:** `npm install @chrisburnell/pentatonic`
-   **Direct download:** [https://github.com/chrisburnell/pentatonic/archive/master.zip](https://github.com/chrisburnell/pentatonic/archive/master.zip)

## Usage

_pentatonic.js_ gives you a function, `pentatonic()` to use, like so:

```js
for (let target of document.querySelectorAll(".pentatonic")) {
    target.addEventListener("click", () => {
        pentatonic(target.dataset.values.split(","))
    })
}
```

The function takes six parameters:

0. `notes` — an array of positive integers _(required)_
1. `duration` — the length of time to play the audio for, represented in milliseconds _(default = 4000)_
2. `volume` — controls the _gain_ of the audio, represented by a 0–1 range _(default = 0.5)_
3. `keyStart` — the zero-index of the key on a standard keyboard from which the scale should start _(default = 29 / C♯3 / D♭3)_
4. `keyIntervals` — an array of integers which represent half-steps in a loop which composes the desired scale _(default = [2, 3, 2, 2, 3] / a pentatonic scale)_
5. `keyLimit` — represents the highest index in the desired scale by which input is bound by _(default = 12)_

## Contributing

Contributions of all kinds are welcome! Please [submit an Issue on GitHub](https://github.com/chrisburnell/pentatonic/issues) or [get in touch with me](https://chrisburnell.com/about/#contact) if you’d like to do so.

## License

This project is licensed under a CC0 license.

---
_Source: https://npm.io/package/@chrisburnell/pentatonic · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
