Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Function New-PivotKlaxon
Add-Type -AssemblyName PresentationCore
$song = [uri](Join-Path (Split-Path -parent $PSCommandPath) "klaxon.mp3")
$MediaPlayer = New-Object System.Windows.Media.MediaPlayer
$voice = new-object -com SAPI.SpVoice
while( $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds -eq $null)
start-sleep -milliseconds 100
$songDuration = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
$MediaPlayer.Volume = 255
$voice.Speak("Sound the Pivot Klaxon")
Start-Sleep -Milliseconds $songDuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.