# @coleww/openmusic-sample-player

> Sample player based on BufferSourceNode

Latest version **1.0.2** (published 2015-11-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @coleww/openmusic-sample-player
pnpm add @coleww/openmusic-sample-player
yarn add @coleww/openmusic-sample-player
bun add @coleww/openmusic-sample-player
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2015-11-14 |
| First published | 2015-09-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | sole |
| Maintainers | coleww |
| Keywords | web, audio, samples, buffer, buffersource |

## Links

- npm: https://www.npmjs.com/package/@coleww/openmusic-sample-player
- Repository: https://github.com/openmusic/sample-player
- Issues: https://github.com/openmusic/sample-player/issues
- npm.io page: https://npm.io/package/@coleww/openmusic-sample-player

## Dependencies (2)

- [openmusic-dcbias](https://npm.io/package/openmusic-dcbias.md) ^1.1.0
- [setter-getterify](https://npm.io/package/setter-getterify.md) ^1.1.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2015-11-14
- 1.0.1 — 2015-11-07
- 1.0.0 — 2015-09-27

## README

# openmusic-sample-player

> Provides an abstraction on top of BufferSourceNodes so samples can be played without regenerating the node when ended

[![Install with NPM](https://nodei.co/npm/openmusic-sample-player.png?downloads=true&stars=true)](https://nodei.co/npm/openmusic-sample-player/)

## Usage

Install first: `npm install openmusic-sample-player`.

Then you can use it in your code:

```javascript
var SamplePlayer = require('openmusic-sample-player');

var audioContext = new AudioContext();
var player = SamplePlayer(audioContext);

// suppose you have a BufferSource in `buffer` already

player.buffer = buffer;

// if you want to make it loop
player.loop = true;

// and start playing!
player.start();

```

Multiple plays can be scheduled:

```javascript
var now = audioContext.currentTime;
player.start(now + 1); // play in 1 second
player.start(now + 2); // play in 2 seconds
player.start(now + 3); // play in 3 seconds
// ...
player.stop(); // stop all scheduled plays
```

## Attributes

Each instance of `SamplePlayer` has some attributes you can access:

### `loop` (Boolean)

### `loopStart` (Number)

### `loopEnd` (Number)

### `pitchBend` (AudioParam)

## Demo

Run `npm install` so it installs stuff for the demo. Then `gulp build`, and then you can open `build/index.html` for the demo.

If you do changes in the code, you'll need to rebuild the demo. Use `gulp build` or `gulp` only for running `build` and setting up a `watch` loop that automatically rebuilds the demo as you change its files.

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