Socket
Book a DemoInstallSign in
Socket

node-red-contrib-speakerpi

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-speakerpi

Node Red Nodes for Speaker Output on Raspberry PI

0.0.43
latest
Source
npmnpm
Version published
Weekly downloads
12
1100%
Maintainers
1
Weekly downloads
 
Created
Source

node-red-contrib-speakerpi

A Node-RED node to give a provided sound (WAV,OGG) out on the defined output (hdmi or chinch or defined) on an Rasperry Pi with a speaker attached. Although this node is good in using with IBM Watson APIs like text-to-speach to demonstrate Cognitive APIs and IoT. See IBM Cloud for more information.

Install

Run the following command in the root directory of your Node-RED install or home directory (usually ~/.node-red).

        npm install node-red-contrib-speakerpi

Additionally you have to install on the Raspberry Pi

	sudo apt-get install libasound2-dev

sound set to Analog output

	amixer cset numid=3 1

sound set to HDMI

	amixer cset numid=3 2

sound set volume

	alsamixer

Usage of the speakerpi output node

Speakerpi provides a sound-node for sending out a sound object to the connected speaker. To use this node with the IBM Cloud Watson Services msg.speech as an input contains the WAV/OGG .

As an output you will get the complete message object as before after playing the sound object.

Filebased

Within the filebased mode the buffer is dumped to an file and the Raspberry Pi Player APLAY is called in background with this file. This brings out best quality with minimum resources needed from the play. The msg.speech should contain the WAV/OGG file (mybe directly from Text2Speach Service from IBM Cloud). This will be dumped into a file and after playing the temporary file it will be deleted.

Givenfile

You can also play own pregiven files by using msg.filename (like /path/filename.wav). The msg.choose has then set to "givenfile" and msg.filename to the name with path.

Streambased

The streambased mode is for streaming directly the buffer into a speaker framework (using node-speaker) which is from the quality perspective not very good.

The node also needs a defined sound configuration which contains channels (1 or 2), the bitdepth (8 or 16)and the samplerate (11025, 22050 or 44100) set in the node or in the msg.speakerConfig for the sound in msg.speech.

	speakerConfig = {
		channels: 1
		bitdepth: 16
		samplerate: 22050
		}

Additional Info

This node runs fine now with the NodeJS 12.x LTS, NPM v6 and NodeRed v1.1.

Keywords

node-red

FAQs

Package last updated on 08 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.