Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rakannimer/music-instrument-js
Play any musical instrument from the browser
https://github.com/rakannimer/music-instrument-js
Last synced: 15 days ago
JSON representation
Play any musical instrument from the browser
- Host: GitHub
- URL: https://github.com/rakannimer/music-instrument-js
- Owner: rakannimer
- Created: 2019-04-09T11:20:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T01:42:46.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T08:31:01.628Z (about 1 month ago)
- Language: TypeScript
- Size: 3.34 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Music Instrument JS
Play any musical instrument from the browser
## Install
```sh
yarn add music-instrument-js
```## Usage
```typescript
import { getInstrument, startNote, stopNote, instrumentNames } from "music-instrument-js";const delay = ms => new Promise(resolve => setTimeout(resolve, ms))
async function main() {
await startNote('acoustic_grand_piano', 'A3', {})
await delay(500)
stopNote('acoustic_grand_piano', 'A3')
instrumentNames // list of supported instrumentsawait getInstrument('banjo') // Loads banjo instrument
startNote('banjo', 'A3', {})
await delay(500)
stopNote('banjo', 'A3')
}```