Un cliente de Microsoft Bing Speech API escrito en Node.js.
Documentación oficial para el Servicio de API de Bing Speech.
Para trabajar con Bing Speech API, debe tener una clave de suscripción. Si aún no tiene una clave de suscripción, obtenga una aquí: suscripciones.
Instale bingspeech-api-client en su proyecto de nodo con NPM.
npm install --save bingspeech-api-client
Vea el ejemplo a continuación sobre cómo requerir y usar para el habla a texto (STT) y el texto al habla (TTS).
El siguiente código de ejemplo supone que está utilizando TypeScript. Si es así, omita esta sección y vaya directamente a los ejemplos. Pero si está utilizando Node ES6 y desea usar el código de ejemplo, se lee.
En la actualidad, el nodo no admite import . Como se menciona en MDN
Nota: Esta característica [
import] apenas comienza a implementarse en los navegadores de forma nativa en este momento. Se implementa en muchos transpiladores, como Traceur Compiler, Babel, Rollup o Webpack.
Para obtener el código de ejemplo de trabajo, cambie la primera línea a:
const { BingSpeechClient , VoiceRecognitionResponse } = require ( 'bingspeech-api-client' ) ; import { BingSpeechClient , VoiceRecognitionResponse } from 'bingspeech-api-client' ;
let audioStream = fs . createReadStream ( myFileName ) ; // create audio stream from any source
// Bing Speech Key (https://www.microsoft.com/cognitive-services/en-us/subscriptions)
let subscriptionKey = 'your_private_subscription_key' ;
let client = new BingSpeechClient ( subscriptionKey ) ;
client . recognizeStream ( audioStream ) . then ( response => console . log ( response . results [ 0 ] . name ) ) ; 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 => /* ... */ ) ;