edge tts client
1.0.2
Microsoft Edge의 TTS (Text-To-Steepee) API와 상호 작용하기위한 TypeScript 기반 클라이언트. 이 패키지는 Node.js 및 브라우저 환경 과 호환되므로 다양한 사용 사례에 따라 다재다능합니다.
https://www.npmjs.com/package/edge-tts-client
패키지를 설치하려면 실행하십시오.
npm install edge-tts-client import { EdgeTTSClient , ProsodyOptions , OUTPUT_FORMAT } from 'edge-tts-client' ;
// Initialize the client
const ttsClient = new EdgeTTSClient ( ) ;
// Set metadata for synthesis
await ttsClient . setMetadata ( 'en-US-GuyNeural' , OUTPUT_FORMAT . AUDIO_24KHZ_48KBITRATE_MONO_MP3 ) ;
// Define SSML options
const options = new ProsodyOptions ( ) ;
options . pitch = 'medium' ;
options . rate = 1.2 ;
options . volume = 90 ;
// Synthesize text to a stream
const stream = ttsClient . toStream ( 'Hello, world!' , options ) ;
// Handle the audio stream
stream . on ( 'data' , ( audioChunk ) => {
console . log ( 'Received audio chunk:' , audioChunk ) ;
} ) ;
stream . on ( 'end' , ( ) => {
console . log ( 'Synthesis complete.' ) ;
} ) ; EdgeTTSClientEdge TTS와 상호 작용하는 메인 클래스.
setMetadata(voiceName: string, outputFormat: OUTPUT_FORMAT, voiceLocale?: string): Promise<void>
toStream(input: string, options?: ProsodyOptions): EventEmitter
close(): void
ProsodyOptionsSSML 합성에 대한 프로디 옵션을 정의합니다.
pitch : 음성의 피치 (예 : 'medium' , 'high' ).rate : 연설 속도 (예 : 1.0 , 1.2 ).volume : 오디오의 볼륨 (예 : 90 , 'loud' ).OUTPUT_FORMAT사용 가능한 출력 형식을 정의하는 열거 : :
AUDIO_24KHZ_48KBITRATE_MONO_MP3WEBM_24KHZ_16BIT_MONO_OPUS 프로젝트를 구축하려면 실행하십시오.
npm run buildVitest로 테스트를 실행하려면 :
npm run test 기부금을 환영합니다! 변경 또는 개선 사항에 대한 문제를 열거 나 풀 요청을 제출하십시오.