yandex-speech
node.js module for Yandex speech systems (ASR & TTS)
Install
npm install yandex-speech --save
Automatic Speech Recognition (simple)
Get API key: https://developer.tech.yandex.ru/
docs: http://api.yandex.ru/speechkit/cloud-api/doc/index.xml
var yandex_speech = require('yandex-speech');
yandex_speech.ASR({
developer_key: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
file: 'data/1.mp3',
}, function(err, httpResponse, xml){
if(err){
console.log(err);
}else{
console.log(httpResponse.statusCode, xml)
}
}
);
Streaming is also supported
var yandex_speech = require('yandex-speech');
require('fs').createReadStream('data/1.mp3').pipe(yandex_speech.ASR({
developer_key: '3b7b9fba-cbcd-47d1-854a-b359ca0e5da7',
debug: true,
topic: 'queries'
}, function (err, httpResponse, xml) {
if (err) {
console.log(err);
} else {
console.log(httpResponse.statusCode, xml)
}
}
));
Automatic Speech Recognition (full)
var yandex_speech = require('yandex-speech');
yandex_speech.ASR({
developer_key: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
file: 'data/1.mp3',
uuid: '12345678123456781234567812345678',
topic: 'queuries',
lang: 'ru-RU',
filetype: 'audio/x-mpeg-3'
}, function(err, httpResponse, xml){
if(err){
console.log(err);
}else{
console.log(httpResponse.statusCode, xml)
}
}
);
Text-To-Speech
const yandex_speech = require('yandex-speech');
yandex_speech.TTS({
developer_key: '3b7b9fba-cbcd-47d1-854a-b359ca0e5da7',
text: 'Привет, мир!',
file: 'data/hello.mp3'
}, () => {
console.log('done');
}
);
Links