Monday, 12 July 2010

Get-InstalledVoice.ps1


  1. <# 
  2. .SYNOPSIS 
  3.     This script displays the installed Speech Synthesiser voices 
  4. .DESCRIPTION 
  5.     This script first loads the System.Speech DLL, then 
  6.     creates a new SpeechSynthesizer object. It uses this 
  7.     object to enumerate the installed speech voices. 
  8. .NOTES 
  9.     File Name  : Get-InstalledVoice.ps1 
  10.     Author     : Thomas Lee - tfl@psp.co.uk 
  11.     Requires   : PowerShell Version 2.0 
  12. .LINK 
  13.     This script posted to: 
  14.         http://www.pshscripts.blogspot.com 
  15.     MSDN Sample posted at: 
  16.         http://msdn.microsoft.com/en-us/library/system.speech.synthesis.installedvoice%28VS.90%29.aspx 
  17. .EXAMPLE 
  18.     PSH [C:\foo]: .\Get-InstalledVoice.ps1 
  19.  
  20.     Gender                : Female 
  21.     Age                   : Adult 
  22.     Name                  : Microsoft Anna 
  23.     Culture               : en-US 
  24.     Id                    : MS-Anna-1033-20-DSK 
  25.     Description           : Microsoft Anna - English (United States) 
  26.     SupportedAudioFormats : {System.Speech.AudioFormat.SpeechAudioFormatInfo} 
  27.     AdditionalInfo        : {[Age, Adult], [AudioFormats, 18], [Gender, Female], [Language, 409]...} 
  28. #> 
  29. # 
  30. # First load the dll 
  31. $r = [system.Reflection.Assembly]::LoadWithPartialName("system.speech"
  32.  
  33. # Create a speech synthesizer object and enumerate voices 
  34. $spk = New-Object system.Speech.Synthesis.SpeechSynthesizer 
  35. $spk.GetInstalledVoices() | %{$_.voiceinfo} 

No comments: