azuretexttospeech
1.0.0
이 패키지는 Azure의인지 서비스 (Speech Services) 텍스트에 대한 클라이언트에게 음성 API를 제공합니다. 클라이언트 사용자는 말하기를 원하는 텍스트를 포함하는 문자열과 Audiofile을 렌더링 해야하는 성별 ( Gender 유형) 인 Lanaguage ( Region 유형)를 지정할 수 있습니다. 라이브러리는 선택한 형식으로 렌더링 된 오디오를 가져옵니다 (지원되는 형식의 AudioOutput 유형 참조).
관심있는 API 문서
URL에 액세스하려면인지 서비스 (Kind = Speech Services) API 키가 필요합니다. 이 서비스는 Azure Portal에서 활성화 될 수 있습니다.
다음은 문자열 64 BASIC BYTES FREE. READY. , EN-US 로케일을 사용하여 여성의 목소리로 렌트. 출력 파일 형식은 16kHz 32kbit 단일 채널 MP3 오디오 파일입니다.
import tts "github.com/jesseward/azuretexttospeech"
func main () {
# See TextToSpeechAPI and TokenRefreshAPI types for list of endpoints and regions .
azureSpeech , _ := tts . New ( "YOUR-API-KEY" , tts . RegionEastUS )
ctx := context . Background ()
payload , _ := az . SynthesizeWithContext (
ctx ,
"64 BASIC BYTES FREE. READY." ,
tts . LocaleEnUS , // Region type
tts . GenderFemale , // Gender type
tts . Audio16khz32kbitrateMonoMp3 ) // AudioOutput type
// the response `payload` is your byte array containing audio data.
}