palmerabollo / bingspeech-api-client

Microsoft Bing Speech API client in node.js
Other
32 stars 17 forks source link

How to play received audio stream? #19

Open mitulgolakiya opened 7 years ago

mitulgolakiya commented 7 years ago

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?

dataoracle commented 6 years ago

I'm also very interested on this. So far I was only able to play the audio on the speakers using the .synthesize method and passing the audioResponse.wave to a wav reader following the example here

While it does work, it uses the .synthesize method and not the synthesizeStream which looks it's the way to go. I use the later and try to pass the audioStream directly to the wav reader but I get white noise audio on the speaker.

@palmerabollo any idea about this? The bottom line is how to use synthesizeStream and pipe the stream audio to the speaker. Thanks!

palmerabollo commented 6 years ago

@dataoracle @mitulgolakiya I have no experience with that, sorry. Did you finally manage to solve it?