bingspeech-api-client icon indicating copy to clipboard operation
bingspeech-api-client copied to clipboard

How to play received audio stream?

Open mitulgolakiya opened this issue 6 years ago • 2 comments

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?

mitulgolakiya avatar Nov 13 '17 14:11 mitulgolakiya

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!

dataoracle avatar Mar 23 '18 12:03 dataoracle

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

palmerabollo avatar Jun 09 '18 11:06 palmerabollo