Thu. Apr 2nd, 2020

TEC FLIP

Experience Technology

Changing Windows Log On Sound Using Power Shell

3 min read
In this article I have given step by step details to changes log on sound of your windows operating system with the use of Power Shell.

Every one of us wants to customize their PC (Desktop or Laptop) according to themselves. In this process, a customized login sound is always impressive. In this article, we are going to show how you can change login sound in Windows 7. I have made the below assumption in changing the login sound for my laptop-

  1. No need to record your voice or to cut any MP-3 song. We will use text to speech (TTS) conversion method.
  2. We are changing the login sound and not the startup sound (login sound is the sound that plays after login and startup sound is the sound that plays when windows startup and login windows come.)
  3. We can change many other windows sound using this process.

Prerequisite:

  1. Basic knowledge of Windows OS.
  2. Ready to play with your Windows.

Below is the step by step guide to login sound of your Windows 7 PC.

Step-1(Optional)

Making a directory to store different sounds that we will create in this process.

Run the below command in PowerShell and it will create directory name “winsounds” in the present working directory.

New-Item -Path ./winsounds -ItemType directory

Step 2

 Run the below command in Power Shell to add system.Speech class in the current Power Shell session.

Add-Type -AssemblyName System.Speech

Note:

Next, run the below command to instantiate the object of this class.

 $speak=New-Object System.Speech.Synthesis.SpeechSynthesizer 

You can test if we have done this correctly by running the below command.

$speak.Speak("Hello Sir, the current date andtime is $(Get-Date)")

Keep your PC’s speaker on and you will hear a sound telling the current Date and time.

Step-3

Now after confirming that our text to speech conversion is working fine, we will redirect this output sound to get stored in a .wav file. I am going to store these files in the directory “winsounds” created in Step-1.

$speak.SetOutputToWaveFile("$($PWD)\winsounds\cutom_sound_01.wav")

Next, run the command to record the desired text string in .wav file format.

$speak.Speak("Hello $env:USERNAME ,Welcome to The World of Windows")

Again change the output to the default audio device i.e the speaker of your PC.

$speak.SetOutputToDefaultAudioDevice()

Step-4

Now we will change the login sound using Windows GUI. First, confirm that the .wav file is created. To do that go to the folder that you have provided in the first command of STEP-3.

Now go to the Control Panel and first select sounds and second Windows logon from the Program Events list as depicted in the below snap. Click on Browse to select the sound that we want to play at the time of Windows Logon. In this case, this is the custom_sound_01.wav file that we have created using TTS.

Browse and select the file, then test the sound y clicking on “Test” button. If it’s working fine click “OK” and restart your PC.

Additional notes: 

Try and execute the below commands in PowerShell related to this topic

  • To check all the functions and actions that you can perform on $speak object.
$speak | Get-Member 
  • To increase the audio stream rate.
$speak.rate=5
  • To decrease the audio stream rate.
$speak.rate=-5 
  • To set the volume level to max
$speak.volume=100

Leave a Reply

Your email address will not be published. Required fields are marked *

Me About Myself

Akshay Kumar Chauhan

My name is Akshay Chauhan and this is my personal blog or better my personal knowledge base where I am writing down my thoughts all around Linux, Windows, Cloud and Google Services. I am working for Infosys as AWS Cloud Engineer. I am always keen to learn new technologies and experiment with computer systems.

Copy link
Powered by Social Snap