Playing a sound in PS is as simple as doing this...
# this
"`a"
# or this basic tone
[console]::beep(1000, 500)
Change the value of the first number to alter the pitch (anything lower than 190 or higher than 8500 can’t be heard), and change the value of the second number to alter the duration:
# Or this
[System.Media.SystemSounds]::Beep.Play()
Then tie that to you output code. For external exe in PS you have to code to retrieve output from that, using PS redirection.
Use whatever tool you choose to create the sound you'd want to play. Of course that has to be on all the systems you plan to run your code.
1..3 | %{
'Play a sound'
[console]::beep(1000, 500)
}
Update for OP
No worries.
As for (1) - you should just need to add the sound line before or after the expected text output, as in that shown loop example.
As for (2) it's no where near as flexible. You are limited to using CRTL+G in a .bat/.cmd file and calling that before or after your expected output line.
Yet, again, you'd have to code to trap all the output you are after. Playing wav files, mean calling a media player in your code especially for cmd.exe.
# PowerShell playing a wav file
$PlayWav=New-Object System.Media.SoundPlayer
$PlayWav.SoundLocation='C:\Foo\Soundfile.wav'
$PlayWav.playsync()
# CMD playing a wav file
start 'C:\Foo\Soundfile.wav'
Here's the real issue with play .wav files, or anything outside of the normal console beeps, the media player will be called each time and have to display to play the file and have to be dismissed. Not a very automated thing..
So, IMHO for what you are after stick with the native console sounds.