Ping me if you need help building something that makes the world a better place.
palmerabollo / bingspeech-api-client Goto Github PK
View Code? Open in Web Editor NEWMicrosoft Bing Speech API client in node.js
License: Other
Microsoft Bing Speech API client in node.js
License: Other
See src/client.js
: you haven't declared it as a dependency in package.json
though. Worked around by requiring in my own package for now.
Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'
Any ideas on how to fix this?
Needed this for a project recently, and ended up making a fork from this repo and adding it myself, but would be great if support for the Saudi Arabian dialect was added back into this project.
To get the example code working I had to change the first line to:
const { BingSpeechClient, VoiceRecognitionResponse } = require('bingspeech-api-client');
I think at present node does not support import. As mentioned on MDN
Note: This feature[
import
] is only beginning to be implemented in browsers natively at this time. It is implemented in many transpilers, such as the Traceur Compiler, Babel, Rollup or Webpack.
As per the README,
I created a new ReadStream by
let audioStream = fs.createReadStream(myFileName);
then in
let client = new BingSpeechClient(subscriptionKey);
client.recognizeStream(audioStream).then(response => console.log(response.results[0].name));
recognizeStream method, the type expected is NodeJS.ReadWriteStream but audioStream is fs.ReadStream, though I found that NodeJS.ReadWriteStream extends both ReadableStream and WriteableStream, but still I am getting error in Typescript transpiler.
TS2345: Argument of type 'ReadStream' is not assignable to parameter of type 'ReadWriteStream'.
Types of property 'setEncoding' are incompatible.
Type '(encoding: string) => ReadStream' is not assignable to type '(encoding: string) => ReadWriteStream'.
Type 'ReadStream' is not assignable to type 'ReadWriteStream'.
Can you suggest what can I do?
After much debugging I found out this is because of missing 'Ocp-Apim-Subscription-Key'.
Response in node.js ๐
(node:80377) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Voice recognition failed miserably: Wrong status code 404 in Bing Speech API / token
For some reason this is not getting set even after an object was creating by passing the 'MICROSOFT_BING_SPEECH_KEY'
The synthesized audio has a lot of static in the playback. It is reported by other users of the bing speech api so it seems to be an issue with the Microsoft service itself.
The synthesize function should return a stream. This way a client could pipe the result without waiting to receive and store the audio in memory.
I am using following function,
import { BingSpeechClient, VoiceVoiceSynthesisResponse } from 'bingspeech-api-client';
// Bing Speech Key (https://www.microsoft.com/cognitive-services/en-us/subscriptions)
let subscriptionKey = 'your_private_subscription_key';
let client = new BingSpeechClient(subscriptionKey);
client.synthesizeStream('I have a dream').then(audioStream => /* ... */);
I am receiving data on the readable event and getting buffer data. Can anyone let me know, how can I play that audio?
down vote
favorite
When I'm trying to execute this code its giving error like
(node:3784) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec tion id: 1): Error: Voice recognition failed miserably: socket hang up
var fs = require('fs');
var bing = require('C:\Program Files\nodejs\node_modules\bingspeech-api-client\lib\client.js');
var audioStream = fs.createReadStream('d:\node.wav');
var subscriptionKey = 'xxxxxxxxxxxxxxxxx';
var client = new bing.BingSpeechClient(subscriptionKey);
client.recognizeStream(audioStream)
.then(response => console.log(response.results[0].name));
http://stackoverflow.com/questions/42570738/speech-to-text-bing-speech-api-azure
The synthesis function only supports an "en-us" voice. More locales and voices should be added. See speech api docs for more info.
i am having problems making the streaming work ...
buffer examples seem to work ok
Being able to select the audio output format would be nice. or at least default it to .wav (riff-16khz-16bit-mono-pcm)
Hey @palmerabollo,
Have you thought about adding support for socket connection in the underlying implantation?
Not sure where to start but I'd be happy to help with that!
Advantages are that it raises the audio duration limit from 15 seconds for REST API to 10 minutes for socket, for the Bing STT service, according Microsoft documentation.
Let me know if this is on your roadmap.
Bing Speech now supports female pt-BR voices. I'll open this issue and submit a PR to associate, that implements this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.