PowerShell/Scripts/txt2wav.ps1

23 lines
713 B
PowerShell
Raw Normal View History

2020-05-25 21:21:40 +02:00
#!/snap/bin/powershell
#
2020-05-22 09:54:16 +02:00
# PowerShell Script to Convert Text to Audio WAV files
# ----------------------------------------------------
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
# Configuration:
$Text = "Hello, my name ist Bond, James Bond"
$Speed = -1 # -10 is slowest, 10 is fastest
$TargetWavFile = "spoken.wav"
# Run:
Add-Type -AssemblyName System.Speech
$SpeechSynthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
# $SpeechSynthesizer.SelectVoice("Microsoft Eva Mobile")
$SpeechSynthesizer.Rate = $Speed
$SpeechSynthesizer.SetOutputToWaveFile($TargetWavFile)
$SpeechSynthesizer.Speak($Text)
$SpeechSynthesizer.Dispose()
exit 0