audio-vs1053b-textspeech
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -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); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3965
0
3
80
4
+ Addedaudio-vs1053b@*
+ Addedwifi-cc3000@*
+ Addedaudio-vs1053b@0.5.1(transitive)
+ Addedwifi-cc3000@0.0.1(transitive)