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

emic2

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emic2 - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.npmignore

85

lib/emic2.js

@@ -8,2 +8,3 @@ /*

var EventEmitter = require('events').EventEmitter;
var Queue = require('sync-queue');

@@ -20,2 +21,4 @@ function emic2(hardware, callback){

self.speaking = false;
self.baudrate = 9600;

@@ -25,2 +28,6 @@

self.queue = new Queue();
EventEmitter.call(this);
self.init(callback);

@@ -34,5 +41,5 @@

emic2.prototype.init = function(hardware, callback){
console.log('Initiating Emic 2 module TTS');
var self = this;
if(!hardware){ throw 'Missing hardware reference'; }
if(!self.hardware){ throw 'Missing hardware reference'; }

@@ -42,40 +49,90 @@ self.uart = new self.hardware.UART();

self.uart.write('\n');
self.uart.on('data', function(data){
console.log('Response: ',data.toString());
self.uart.once('data', function(data){
var res = data.toString();
if(res.match(/:/)){
if(callback) callback();
self.emit('ready');
self.setListener();
}
});
}, self.timer);
};
emic2.prototype.setListener = function(){
var self = this;
self.uart.on('data', function(data){
var res = data.toString();
if(res.match(/:/)){
self.emit('done');
self.queue.next();
}else if(res.match(/\?/)){
self.emit('error');
self.queue.next();
}
});
};
emic2.prototype.destroy = function(callback){
this.uart.removeListener('data');
if(callback) callback();
};
emic2.prototype.speak = function (text) {
var self = this;
self.queue.place(function s(){
self.uart.write('S' + text + '\n');
});
return this;
};
emic2.prototype.setLanguage = function(lan, op){
var self = this;
self.queue.place(function(){
var l = 0;
switch(lan){
case 'en':
l = 0;
break;
case 'es':
l = typeof op === 'undefined' ? 1 : (op === 'lan' ? 2 : 1 );
break;
}
self.uart.write('L' + l + '\n');
});
};
emic2.prototype.setVolume = function(vol){
var self = this;
self.queue.place(function(){
self.uart.write('V' + vol + '\n');
});
};
emic2.prototype.setVoice = function(voice){
var self = this;
self.queue.place(function(){
self.uart.write('N' + voice + '\n');
});
};
emic2.prototype.setRate = function(rate){
var self = this;
self.queue.place(function(){
self.uart.write('W' + rate + '\n');
});
};
emic2.prototype.pause = function(){
self.uart.write('Z\n');
};
emic2.prototype.resume = function(){
emic2.prototype.stop = function(){
this.uart.write('X\n');
};
emic2.prototype.stop = function(){
emic2.prototype.reset = function(){
var self = this;
self.queue.place(function(){
self.uart.write('R\n');
})
};

@@ -82,0 +139,0 @@

{
"name": "emic2",
"version": "0.0.1",
"version": "0.0.2",
"description": "Node API for Emic2 module TTS",

@@ -9,2 +9,5 @@ "main": "./lib/emic2.js",

},
"dependencies": {
"sync-queue": "0.0.1"
},
"repository": {

@@ -18,3 +21,5 @@ "type": "git",

],
"author": "Carlos Martin",
"author": {
"name": "Carlos Martin"
},
"license": "ISC",

@@ -24,3 +29,8 @@ "bugs": {

},
"homepage": "https://github.com/pirumpi/emic2"
"homepage": "https://github.com/pirumpi/emic2",
"gitHead": "a3b9706bd2aa123974930560ebd84b6298991ef1",
"readme": "ERROR: No README data found!",
"_id": "emic2@0.0.1",
"_shasum": "7b0f947075d008011047c3e2b3fe12706f80ff41",
"_from": "emic2@"
}
.idea/.name
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