Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
audio-vs1053b
Advanced tools
#Audio Driver for the audio-vs1053b Tessel audio module. The hardware documentation for this module can be found here.
If you run into any issues you can ask for support on the Audio Module Forums.
###Installation
npm install audio-vs1053b
###Limitations The current version of the Tessel runtime is too slow to play audio files smoothly. That means we wrote a custom C shim that handles most of the playback and recording of data. There are several consequences of the C shim:
It sucks but we're expecting major runtime speed improvements to render the C shim unnecessary within the next couple of months.
###Development Status Playback and recording to/from the local file system works well. Streams work less well. Interacting with the SDCard, Ambient, and IR doesn't work yet (issues with the SPI bus). This module is currently undergoing heavy development to fix those issues. Please file any bugs you find with this module.
###Example
/*********************************************
This Audio Module demo sets volume, then plays
an audio file out over Headphones/Line out
*********************************************/
var tessel = require('tessel');
var fs = require('fs');
var audio = require('audio-vs1053b').use(tessel.port['A']);
var audioFile = 'sample.mp3';
// Wait for the module to connect
audio.on('ready', function() {
console.log("Audio module connected! Setting volume...");
// Set the volume in decibels. Around .8 is good; 80% max volume or -25db
audio.setVolume(.8, function(err) {
if (err) {
return console.log(err);
}
// Get the song
console.log('Retrieving file...');
var song = fs.readFileSync(audioFile);
// Play the song
console.log('Playing ' + audioFile + '...');
audio.play(song, function(err) {
if (err) {
console.log(err);
} else {
console.log('Done playing', audioFile);
}
});
});
});
// If there is an error, report it
audio.on('error', function(err) {
console.log(err);
});
###Methods
# audio.setVolume( leftChannelDb, [rightChannelDb,] callback(err) )
Set the output volume. Level is a Number from 0.0 to 1.0 (-127dB to 0dB)
# audio.setInput( input, callback(err) )
Set the input to either 'lineIn' or 'mic'. Defaults to 'lineIn'.
# audio.setOutput( output, callback(err) )
Set the output to either 'lineOut' or 'headphones'. Defaults to 'lineOut'.
# audio.startRecording( [profile] callback(err) )
Start recording sound from the input. (Receive data in the 'data' event) Callback called after recording initialized (not stopped ) .quality is an optional argument that can be 'voice', 'wideband-voice', 'wideband-stereo', 'hifi-voice', or 'stereo-music'. Default is 'hifi-voice'.
# audio.stopRecording( callback(err) )
Stop recording sound (note that may receive one more 'data' event before this completes when the buffer is flushed. )
# audio.play( [audioBuff], callback(err) )
Play a buffer. If no buffer is passed in, the module will attempt to resume a buffer that was paused.
# audio.pause( callback(err) )
Pause the buffer.
# audio.stop( callback(err) )
Stop playing and flush the buffer.
# audio.createPlayStream()
Returns a stream that a buffer can be piped into to play audio.
# audio.createRecordStream()
Returns a readable stream of mic data.
# audio.availableRecordingProfiles()
Returns an array of available profiles.
###Events
# audio.on( 'ready', callback() )
The audio module is ready to use.
# audio.on( 'error', callback(err) )
The audio module had an error on connection.
# audio.on( 'volume', callback(volume) )
Volume was set.
# audio.on( 'input', callback(input) )
The input mode was set.
# audio.on( 'output', callback(output) )
The output mode was set.
# audio.on( 'startRecording', callback() )
Started recording from the input.
# audio.on( 'data', callback(audioBuff) )
Received recorded data.
# audio.on( 'stopRecording', callback() )
Stopped recording on the input.
# audio.on( play', callback() )
A buffer is beginning to be played.
# audio.on( 'pause', callback() )
Playback was paused.
# audio.on( 'stop', callback() )
Playback was stopped.
# audio.on( 'end', callback(err) )
The buffer finished playing.
###Further Examples
###License MIT or Apache 2.0, at your option
FAQs
Library to run the Tessel Audio Module. Plays and records sound.
The npm package audio-vs1053b receives a total of 0 weekly downloads. As such, audio-vs1053b popularity was classified as not popular.
We found that audio-vs1053b demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.