https://github.com/sqmk/afplay
Apple Audio File Play wrapper for Node.js
https://github.com/sqmk/afplay
Last synced: 6 months ago
JSON representation
Apple Audio File Play wrapper for Node.js
- Host: GitHub
- URL: https://github.com/sqmk/afplay
- Owner: sqmk
- License: mit
- Created: 2015-10-17T17:56:38.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T20:13:42.000Z (about 3 years ago)
- Last Synced: 2025-11-23T19:11:14.324Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 33.2 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Afplay - Apple Audio File Play wrapper for Node.js
[](https://www.npmjs.com/package/afplay)
[](https://travis-ci.org/sqmk/afplay)
[](https://david-dm.org/sqmk/afplay)
Afplay is a wrapper for Apple Audio File Play (afplay).
Use Afplay to play audio files on OS X via afplay. Afplay afplay!
## Installation
Afplay was written for **Node.js 4+**.
`npm install --save afplay`
## Usage
Afplay is super simple to use!
### Play a Local File
```js
let Afplay = require('afplay');
// Instantiate a new player
let player = new Afplay;
// Play a sound, handle result within a Promise
player.play('/tmp/my-file.mp3')
.then(() => {
console.log('Audio done playing');
})
.catch(error => {
console.log('Error playing file');
});
```
### Configure Volume & Play Time
It is possible to configure volume and play time (in seconds).
```js
player.play('/tmp/my-file.mp3', {volume: 100, time: 15})
.then(() => {
console.log('Loud, short duration audio done playing');
})
.catch(error => {
console.log('Error playing file');
});
```
## Examples
View the [examples](examples) directory.
## Logo
Afplay's initial logo was designed by scorpion6 on Fiverr. Font used is Lato Black.
## License
This software is licensed under the MIT License. [View the license](LICENSE).
Copyright © 2015 [Michael K. Squires](http://sqmk.com)