Last active
October 18, 2023 14:08
-
-
Save AlexanderHolmeset/66ff5cc1036d73b0017f7d25a336c949 to your computer and use it in GitHub Desktop.
VoiceNoStyle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$AzureSpeechSubscriptionKey = 'enter your key here' | |
$AzureSpeechRegion = 'norwayeast' | |
$Language = 'en-IE' | |
$VoiceName = 'en-IE-EmilyNeural' | |
$FetchTokenHeader = @{ | |
'Content-type'='application/x-www-form-urlencoded'; | |
'Content-Length'= '0'; | |
'Ocp-Apim-Subscription-Key' = $AzureSpeechSubscriptionKey | |
} | |
$OAuthToken = Invoke-RestMethod -Method POST -Uri https://$AzureSpeechRegion.api.cognitive.microsoft.com/sts/v1.0/issueToken -Headers $FetchTokenHeader | |
# show the token received | |
$OAuthToken | |
$MyHeader = @{"Authorization" = "Bearer $OAuthToken"; | |
"X-Microsoft-OutputFormat" = "audio-16khz-128kbitrate-mono-mp3" } | |
$uri = "https://$AzureSpeechRegion.tts.speech.microsoft.com/cognitiveservices/v1" | |
$Body = @" | |
<speak version='1.0' xml:lang='$Language'> | |
<voice name="$VoiceName"> | |
Hi my name is Emily. I am a neural voice. This is what I sound like when im using an Irish voice with no voice style. | |
</voice> | |
</speak> | |
"@ | |
Invoke-RestMethod -Method Post -ContentType "application/ssml+xml" -Headers $MyHeader -Body $Body -Uri $uri -OutFile "audio1.wav" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment