Start-TextToSpeech.psm1
function Start-TextToSpeech { <# .SYNOPSIS Converts text to speech using the SpeechSynthesizer .NET class. .DESCRIPTION This function uses the .NET class SpeechSynthesizer to convert a given text into speech. .PARAMETER Text The text that you want to convert into speech. .NOTES Author: Eric Meinders Version: 1.0 #> [cmdletbinding()] param( [Parameter(Mandatory, Position = 0, ValueFromPipeline = $true)] [string]$Text ) # Load the System.Speech assembly Add-Type -AssemblyName System.Speech # Create a new instance of SpeechSynthesizer and speak the provided text (New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer).Speak($Text) } |