All Projects → roccomuso → node-aplay

roccomuso / node-aplay

Licence: other
🎵 ALSA aplay wrapper for Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-aplay

viup
A V wrapper for the cross-platform UI library, IUP.
Stars: ✭ 36 (+20%)
Mutual labels:  wrapper
jodit-vue
Vue wrapper for Jodit Editor
Stars: ✭ 60 (+100%)
Mutual labels:  wrapper
careful rm
A safe wrapper for rm that adds useful warnings and an optional recycle/trash mode
Stars: ✭ 22 (-26.67%)
Mutual labels:  wrapper
adl
🍿 anime-downloader + trackma wrapper
Stars: ✭ 91 (+203.33%)
Mutual labels:  wrapper
klangsynthese
Waveform and Audio Synthesis library in Go
Stars: ✭ 57 (+90%)
Mutual labels:  alsa
dbots.js
A stats poster and API wrapper for all botlists.
Stars: ✭ 18 (-40%)
Mutual labels:  wrapper
node-atol-wrapper
Node.js обертка для ДТО версии 10 компании АТОЛ
Stars: ✭ 28 (-6.67%)
Mutual labels:  wrapper
dokan-delphi
Dokan Delphi Wrapper
Stars: ✭ 48 (+60%)
Mutual labels:  wrapper
confirm-before
✅ Are you sure? No? Confirm Before - Sanity check for your shell commands
Stars: ✭ 16 (-46.67%)
Mutual labels:  wrapper
haskell-libui
Haskell bindings to the libui C library.
Stars: ✭ 45 (+50%)
Mutual labels:  wrapper
nanoleaf-aurora
A java wrapper for the Nanoleaf Aurora API
Stars: ✭ 19 (-36.67%)
Mutual labels:  wrapper
node-freshdesk-api
Node wrapper for Freshdesk v2 API
Stars: ✭ 24 (-20%)
Mutual labels:  wrapper
libssh2.nim
Nim wrapper for libssh2
Stars: ✭ 25 (-16.67%)
Mutual labels:  wrapper
Xamarin-iOS
PSPDFKit for iOS wrapper for the Xamarin platform.
Stars: ✭ 14 (-53.33%)
Mutual labels:  wrapper
python-qnapstats
Python API for obtaining QNAP NAS system stats
Stars: ✭ 45 (+50%)
Mutual labels:  wrapper
py-SMART
Wrapper for smartctl (smartmontools)
Stars: ✭ 42 (+40%)
Mutual labels:  wrapper
google-pubsub-emulator
Google PubSub Emulator wrapper to nodejs
Stars: ✭ 28 (-6.67%)
Mutual labels:  wrapper
angsd-wrapper
Utilities for analyzing next generation sequencing data.
Stars: ✭ 13 (-56.67%)
Mutual labels:  wrapper
ALSA-RAVENNA-AES67-Driver
RAVENNA AES-67 ALSA driver (a clone of the original provided by Merging Technologies)
Stars: ✭ 20 (-33.33%)
Mutual labels:  alsa
dokuwiki-plugin-bootswrapper
Bootstrap Wrapper for DokuWiki
Stars: ✭ 33 (+10%)
Mutual labels:  wrapper

aplay

NPM Version JavaScript Style Guide

ALSA aplay wrapper for Node.js. It provides basic audio capabilities.

aplay works on:

  1. any Debian/Ubuntu system providing ALSA support has been installed.
  2. MAC OSX (comes with afplay by default)

ALSA stands for Advanced Linux Sound Architecture. It is a suite of hardware drivers, libraries and utilities which provide audio and MIDI functionality for the Linux operating system.

aplay is a simple native ALSA wav player (to reproduce .mp3 see mpg321).

Installation

Debian/Ubuntu/Raspbian

Get ready. Before we start the real work, please update the system.

sudo apt-get update
sudo apt-get upgrade

If you are running on Raspberry Pi, please update Raspbian

sudo rpi-update

Install ALSA for audio playback

sudo apt-get install alsa-base alsa-utils

USB Audio on Raspberry Pi

If you are planning on using a USB audio on Raspberry Pi you will need to set your USB audio device as the default device.

Edit /etc/modprobe.d/alsa-base.conf and replaced the line:

options snd-usb-audio index=-2

With the following lines:

options snd-usb-audio index=0 nrpacks=1
options snd-bcm2835 index=-2

After a reboot of your Raspberry Pi

aplay -l

Should output the following:

**** List of PLAYBACK Hardware Devices ****
card 0: XXXX [XXXX], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

Your device volume will be set to 0 by default. Use the ALSA mixer to adjust the volume using your arrow keys:

alsamixer

Example Usage

Get it through npm:

$ npm install aplay --save

and then:

var Sound = require('aplay');

// fire and forget:
new Sound().play('/path/to/the/file/filename.wav');

// with ability to pause/resume:
var music = new Sound();
music.play('/path/to/the/file/filename.wav');

setTimeout(function () {
	music.pause(); // pause the music after five seconds
}, 5000);

setTimeout(function () {
  music.resume(); // and resume it two seconds after pausing
}, 7000);

// you can also listen for various callbacks:
music.on('complete', function () {
  console.log('Done with playback!');
});

Options

The constructor accepts a config object where you can provide:

  • channel: specify a channel.

CLI Usage

$ node node_modules/aplay my-song.wav

It's simple as that.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].