# sound-play

> An sound player for NodeJS.

Latest version **1.1.0** (published 2021-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install sound-play
pnpm add sound-play
yarn add sound-play
bun add sound-play
```

## Health

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

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-01-03 |
| First published | 2019-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/sound-play) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 106 |
| Author | nomadhoc |
| Maintainers | nomadhoc |
| Keywords | sound, audio, play, player, music, electron, desktop, node, react native, window, mac, sound play, audio play, music play, sound player, audio player, music player, node audio, audio node |

## Links

- npm: https://www.npmjs.com/package/sound-play
- Repository: https://github.com/nomadhoc/sound-play
- Issues: https://github.com/nomadhoc/sound-play/issues
- npm.io page: https://npm.io/package/sound-play

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-01-03
- 1.0.5 — 2019-10-23
- 1.0.4 — 2019-10-23
- 1.0.3 — 2019-10-23
- 1.0.2 — 2019-10-23
- 1.0.1 — 2019-10-23

## README

# sound-play

_Dead simple sound player for Node -- because it should be simple._

```javascript
const sound = require("sound-play");
sound.play("file.mp3");
```

- Support `.wav`, `.mp3` and other extensions.

- Work on `Windows` and `MacOS`

# Install

```
npm install sound-play
```

```
yarn add sound-play
```

# Examples

### Relative path

```javascript
sound.play("file.mp3");
```

or

```javascript
const path = require("path");
const filePath = path.join(__dirname, "file.mp3");
sound.play(filePath);
```

### Adjusting Volume

```javascript
/**
 * 0   = silent
 * 0.5 = default
 * 1   = max volume
 */
volume = 0.1;
sound.play("file.mp3", volume);
```

### Absolute path

```javascript
sound.play("C:\\file.mp3");
```

### Promise

```javascript
sound.play("file.mp3").then((response) => console.log("done"));
```

### Async/await

```javascript
try {
  await sound.play("file.mp3");
  console.log("done");
} catch (error) {
  console.error(error);
}
```

# License

MIT

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