Skip to content

Commit

Permalink
tidy up README; lint JS; bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburnell committed Feb 1, 2023
1 parent 8335ade commit 8cafd52
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 23 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
}
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.github
.vscode
.editorconfig
.eslintrc.json
.prettier
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# .prettierrc
semi: false
printWidth: 9999
tabWidth: 4
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,34 @@ 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)
- **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:
_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(","));
});
pentatonic(target.dataset.values.split(","))
})
}
```

The function takes six parameters:

0. `notes` — an array of positive integers *(required)*
0. `duration` — the length of time to play the audio for, represented in milliseconds *(default = 4000)*
0. `volume` — controls the *gain* of the audio, represented by a 0–1 range *(default = 0.5)*
0. `keyStart` — the zero-index of the key on a standard keyboard from which the scale should start *(default = 29 / C♯3 / D♭3)*
0. `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)*
0. `keyLimit` — represents the highest index in the desired scale by which input is bound by *(default = 12)*
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.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"name": "@chrisburnell/pentatonic",
"version": "1.1.2",
"version": "1.1.3",
"description": "Turn any array of integers into a fun little melody.",
"author": "Chris Burnell",
"author": "Chris Burnell <me@chrisburnell.com>",
"license": "CC0",
"homepage": "https://chrisburnell.com/pentatonic/",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/chrisburnell/pentatonic.git"
},
"bugs": {
"url": "https://github.com/chrisburnell/pentatonic/issues"
},
"keywords": [
"audio",
"javascript",
"js"
],
"devDependencies": {
"eslint": "^8.7.0"
},
"main": "pentatonic.js",
"dependencies": {},
"scripts": {
"test": "eslint pentatonic.js"
},
"keywords": [
"js",
"audio"
]
}
}

0 comments on commit 8cafd52

Please sign in to comment.