MsEdgeTTS
1.0.0
Ein einfaches Azure -Sprachdienstmodul, das die Microsoft Edge -API -API verwendet.
Vollständige Unterstützung für SSML Unterstützt nur speak , voice und prosody -Elementtypen. Das Folgende ist das Standard -SSML -Objekt:
< speak version = " 1.0 " xmlns = " http://www.w3.org/2001/10/synthesis " xmlns : mstts = " https://www.w3.org/2001/mstts "
xml : lang = " ${this._voiceLang} " >
< voice name = " ${voiceName} " >
< prosody rate = " ${rate} " pitch = " ${pitch} " volume = " ${volume} " >
${input}
</ prosody >
</ voice >
</ speak >Dokumentation zum SSML -Format finden Sie hier. Alle unterstützten Audioformate finden Sie hier.
Stellen Sie sicher, dass Sie die Eingabe Ihres Benutzers entkommen/sanieren ! Verwenden Sie eine Bibliothek wie XML-Eskape.
import { MsEdgeTTS , OUTPUT_FORMAT } from "msedge-tts" ;
const tts = new MsEdgeTTS ( ) ;
await tts . setMetadata ( "en-IE-ConnorNeural" , OUTPUT_FORMAT . WEBM_24KHZ_16BIT_MONO_OPUS ) ;
const readable = tts . toStream ( "Hi, how are you?" ) ;
readable . on ( "data" , ( data ) => {
console . log ( "DATA RECEIVED" , data ) ;
// raw audio file data
} ) ;
readable . on ( "close" , ( ) => {
console . log ( "STREAM CLOSED" ) ;
} ) ; import { MsEdgeTTS , OUTPUT_FORMAT } from "msedge-tts" ;
( async ( ) => {
const tts = new MsEdgeTTS ( ) ;
await tts . setMetadata ( "en-US-AriaNeural" , OUTPUT_FORMAT . WEBM_24KHZ_16BIT_MONO_OPUS ) ;
const filePath = await tts . toFile ( "./example_audio.webm" , "Hi, how are you?" ) ;
} ) ( ) ; import { MsEdgeTTS , OUTPUT_FORMAT } from "msedge-tts" ;
( async ( ) => {
const tts = new MsEdgeTTS ( ) ;
await tts . setMetadata ( "en-US-AriaNeural" , OUTPUT_FORMAT . WEBM_24KHZ_16BIT_MONO_OPUS ) ;
const filePath = await tts . toFile ( "./example_audio.webm" , "Hi, how are you?" , { rate : 0.5 , pitch : "+200Hz" } ) ;
} ) ( ) ;Verwenden Sie eine benutzerdefinierte http.agent-Implementierung wie HTTPS-Proxy-Agent oder Socks-Proxy-Agent.
import { SocksProxyAgent } from 'socks-proxy-agent' ;
( async ( ) => {
const agent = new SocksProxyAgent ( "socks://your-name%40gmail.com:[email protected]" )
const tts = new MsEdgeTTS ( agent ) ;
await tts . setMetadata ( "en-US-AriaNeural" , OUTPUT_FORMAT . WEBM_24KHZ_16BIT_MONO_OPUS ) ;
const filePath = await tts . toFile ( "./example_audio.webm" , "Hi, how are you?" ) ;
} ) ( ) ; Weitere Informationen finden Sie in der API -Dokumentation.
Diese Bibliothek unterstützt nur Versprechen.