Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

audio-vs1053b-textspeech

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audio-vs1053b-textspeech - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

5

History.txt

@@ -0,3 +1,8 @@

=== 0.0.2 2014-10-22
* check wifi status before HTTP request
* fix npm deps
=== 0.0.1 2014-10-21
* first release

28

index.js

@@ -5,9 +5,10 @@ 'use strict';

var request = require('request');
var wifi = require('wifi-cc3000');
module.exports = {
use: function(audio) {
use: function(audio){
this.audio = audio;
return this;
},
getAudioStream: function(query) {
getAudioStream: function(query){
return request.get({

@@ -21,14 +22,19 @@ uri: 'http://translate.google.com/translate_tts',

},
speech: function(text, opts, callback) {
if (typeof opts === 'function'){
callback = opts;
opts = {tl: 'ja'};
speech: function(){
var text, opts, callback; // arguments
var args = Array.prototype.slice.call(arguments);
if(typeof args[args.length-1] === 'function') callback = args.pop();
text = args.shift();
opts = args.shift() || {tl: 'ja'};
opts.q = text;
if(!wifi.isConnected()){
if(typeof callback === 'function') callback('wifi is not connected');
return;
}
if (opts == null) opts = { tl: 'ja' };
opts.q = text;
var buf = new Buffer(10240);
var offset = 0;
var ws = stream.Writable({decodeStrings: false});
ws._write = function(chunk, enc, next) {
if (chunk.length > buf.length - offset) {
ws._write = function(chunk, enc, next){
if(chunk.length > buf.length - offset){
return next(new Error('buffer over'));

@@ -43,3 +49,3 @@ }

var self = this;
req.on('end', function() {
req.on('end', function(){
self.audio.play(buf, callback);

@@ -46,0 +52,0 @@ });

{
"private": false,
"name": "audio-vs1053b-textspeech",
"version": "0.0.1",
"version": "0.0.2",
"description": "Text-to-Speech module for tessel audio module (vs1053b), using mp3 from Google translate.",

@@ -20,5 +20,3 @@ "main": "index.js",

"dependencies": {
"request": "*"
},
"devDependencies": {
"request": "*",
"audio-vs1053b": "*",

@@ -25,0 +23,0 @@ "wifi-cc3000": "*"

var tessel = require('tessel');
var wifi = require('wifi-cc3000');
var audio = require('audio-vs1053b').use(tessel.port['A']);

@@ -23,14 +22,10 @@

console.log('audio ready:volume');
if(err){
console.error(err);
return;
}
textspeech.speech('speech start', {tl: 'en'});
setInterval(function(){
if(wifi.isConnected()){
textspeech.speech('hello world', {tl: 'en'}, function(err){
if(err) console.error(err);
else console.log('done');
});
}
textspeech.speech('hello world', {tl: 'en'}, function(err){
if(err) console.error(err);
else console.log('done');
});
}, 30*1000);
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc