In Windows and Mac OS X, whatever you type on the keyboard can be voiced (this is done through a computer-generated voice).
Steps
Method 1 of 3: Windows

Step 1. Launch the Narrator utility
Click Start, type narrator in the search bar and press Enter. Narrator launches, reading the keyboard input.

Step 2. Configure the Narrator utility
Check or uncheck the options in the Narrator window that opens.

Step 3. Change the voice of the announcer
Depending on the operating system you are using, click Voice or Voice Setting (at the bottom of the window) and change the appropriate settings.

Step 4. Check the work of the announcer
Open Notepad (or any other text editor).

Step 5. In Notepad, enter the words you want to hear

Step 6. Highlight the word in the notebook and the speaker will speak it
Or press Ctrl + alt = "Image" + Space or Ctrl + Shift + Space
Method 2 of 3: Mac OS X: Terminal

Step 1. Click Finder> Applications> Utilities

Step 2. Double click on "Terminal" to launch it

Step 3. Enter say and then enter the text to be read

Step 4. Press Enter
The text will be read by the computer.
Method 3 of 3: Mac OS X: Text Edit

Step 1. Enter text into TextEdit

Step 2. Place the cursor where you would like to start speaking the text
Otherwise, the text will be read from the very beginning.

Step 3. Click Edit> Speech> Start Speaking
The text will be read out.

Step 4. Click Edit> Speech> Stop Speaking
Audio recording will stop.