Skip to content
OutSpeech is a PowerShell module that provides functions Out-Speech and Export-Speech, and SpeechConfiguration management.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
Private
Public
Tests
LICENSE
OutSpeech.psd1
OutSpeech.psm1
README.md
ScriptAnalyzerSettings.psd1

README.md

OutSpeech

OutSpeech is a PowerShell module inspired by inspired by https://learn-powershell.net/2013/12/04/give-powershell-a-voice-using-the-speechsynthesizer-class/ and https://gallery.technet.microsoft.com/scriptcenter/Out-Voice-1be16d5e OutSpeech provides the following features:

  • An Out-Speech function for sending PowerShell output to the default audio device
  • An Export-Speech function for sending PowerShell output to wav file
  • Functions to Enable and Set Speech Configuration objects to use/re-use with Out-Speech, enabling the use of different configurations for output Rate, Volume, and Voice
  • Get-SpeechVoice function to enumerate the available voices installed on a system
  • a Disable-SpeechConfiguration function for cleanup of the Speech Configuration Object(s) used or created by OutSpeech.

How it Works

  1. Import the OutSpeech module into your PowerShell session
  2. Simple usage: 'Out-Speech "Hello, Dave"'
    • Out-Speech will create a Default SpeechConfiguration object
    • Out-Speech will re-use the Default SpeechConfiguration object if it exists
    • the DefaultSpeech object will have default voice, rate, and volume settings for your system (these can be overridden by the Rate, Volume, or Voice parameters of Out-Speech)
    • Out-Speech should speak the specified text
  3. More Advanced Usage:
    • create a speech object profile with Enable-SpeechConfiguration, specifying a ConfigurationName, a rate, a voice, and a volume setting to use
    • use the SpeechConfiguration Out-Speech by specifying the ConfigurationName
    • modify a SpeechConfiguration using Set-SpeechConfiguration
  4. A note about the rate, volume, and voice parameters when used with Out-Speech -When you use the Rate, Volume, or Voice parameters with Out-Speech the settings will persist on the SpeechConfiguration object specified (or the Default SpeechConfiguration)

Development Plans

Basic Usage Example

    Import-Module OutSpeech
    Out-Speech "Hello, Dave"
    Out-Speech "This is Microsoft Zira Desktop" -Rate 3 -Volume 90 -Voice "Microsoft Zira Desktop"

This is one of the default voices on my Windows 10 system, yours may vary depending on language packs/editions of Windows.

Advanced Usage Example

Configuring multiple SpeechConfigurations to use on demand. Passthru parameter allows you to view the resulting object.

    Import-Module OutSpeech -force
    Enable-SpeechConfiguration -ConfigurationName "DavidFastLoud" -Rate 3 -Voice "Microsoft David Desktop" -Volume 100
    Enable-SpeechConfiguration -ConfigurationName "ZiraSlowSoft" -Rate -1 -Voice "Microsoft Zira Desktop" -Volume 20
    Out-Speech -ConfigurationName ZiraSlowSoft -inputobject "I am speaking to you slowly and not very loudly" -Synchronous
    "I am speaking to you loudly and at a fast rate" | Out-Speech -ConfigurationName DavidFastLoud -Synchronous
    Set-SpeechConfiguration -ConfigurationName DavidFastLoud -Rate 10
    Out-Speech -inputobject "Now I am speaking to you at my maximum rate." -ConfigurationName DavidFastLoud
    Disable-SpeechConfiguration -ConfigurationName 'DavidFastLoud','ZiraSlowSoft'

License

OutSpeech is released under the MIT License

You can’t perform that action at this time.