bingspeech api client
3.1.0
Node.js에 작성된 Microsoft Bing Speech API 클라이언트
Bing Speech API 서비스에 대한 공식 문서.
Bing Speech API에서 작업하려면 구독 키가 있어야합니다. 구독 키가 아직 없으면 구독 키를 가져 오십시오. 구독.
NPM으로 노드 프로젝트에 bingspeech-api-client 설치하십시오.
npm install --save bingspeech-api-client
STT (Speech to Text to Text) 및 TTS (Text to Speech)를 요구하는 방법 및 사용 방법에 대한 예제를 참조하십시오.
다음 예제 코드는 TypeScript를 사용하고 있다고 가정합니다. 당신이 있다면,이 섹션을 건너 뛰고 예제로 바로 가십시오. 그러나 Node ES6을 사용하고 있고 예제 코드를 사용하려는 경우
현재 노드는 import 지원하지 않습니다. MDN에 언급했듯이
참고 :이 기능 [
import]은 현재 브라우저에서만 구현되기 시작했습니다. Traceur 컴파일러, 바벨, 롤업 또는 웹 팩과 같은 많은 트랜스 필러에서 구현됩니다.
예제 코드 작동을 얻으려면 첫 번째 줄을 변경합니다.
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 => /* ... */ ) ;