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.2 to 0.0.3

emic2.iml

67

lib/emic2.js

@@ -13,21 +13,9 @@ /*

var self = this;
self.pause = false;
self.uart = null;
self.timer = 200; //Wait for device to power up
self.speaking = false;
self.timer = 200;
self.currentAction = 'idle';
self.baudrate = 9600;
self.hardware = hardware;
self.queue = new Queue();
EventEmitter.call(this);
self.init(callback);
return self;

@@ -44,12 +32,15 @@ }

self.uart = new self.hardware.UART();
var statusResponse = function(data){
var res = data.toString();
console.log(res);
if(res.indexOf(':') !== -1){
self.uart.removeListener('data', statusResponse);
if(callback) callback();
self.emit('ready');
self.setListener();
}
};
setTimeout(function(){
self.uart.write('\n');
self.uart.once('data', function(data){
var res = data.toString();
if(res.match(/:/)){
if(callback) callback();
self.emit('ready');
self.setListener();
}
});
self.uart.on('data', statusResponse);
}, self.timer);

@@ -62,6 +53,8 @@ };

var res = data.toString();
if(res.match(/:/)){
self.emit('done');
if(res.indexOf(':') !== -1){
self.emit('done', self.currentAction);
self.speaking = false;
self.queue.next();
}else if(res.match(/\?/)){
}else if(res.indexOf('?') !== -1){
self.speaking = false;
self.emit('error');

@@ -73,10 +66,6 @@ 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.currentAction = 'speaking';
self.uart.write('S' + text + '\n');

@@ -90,2 +79,3 @@ });

self.queue.place(function(){
self.currentAction = 'setting language';
var l = 0;

@@ -100,4 +90,5 @@ switch(lan){

}
self.uart.write('L' + l + '\n');
self.uart.write('l' + l + '\n');
});
return this;
};

@@ -108,4 +99,6 @@

self.queue.place(function(){
self.currentAction = 'setting volume';
self.uart.write('V' + vol + '\n');
});
return this;
};

@@ -116,4 +109,6 @@

self.queue.place(function(){
self.currentAction = 'setting voice';
self.uart.write('N' + voice + '\n');
});
return this;
};

@@ -124,8 +119,11 @@

self.queue.place(function(){
self.currentAction = 'setting rate';
self.uart.write('W' + rate + '\n');
});
return this;
};
emic2.prototype.pause = function(){
self.uart.write('Z\n');
this.uart.write('Z\n');
return this;
};

@@ -135,2 +133,3 @@

this.uart.write('X\n');
return this;
};

@@ -141,4 +140,6 @@

self.queue.place(function(){
self.currentAction = 'resetting';
self.uart.write('R\n');
})
});
return this;
};

@@ -145,0 +146,0 @@

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

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

Sorry, the diff of this file is not supported yet

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