NOTE: It's slow but more Automated faster/offline version here
This Python script allows you to easily read any text from a website, PDF, or anywhere else on your computer out loud. It's a useful tool for people who prefer listening to reading, for those who have difficulty reading due to visual impairments, or for anyone who wants to multitask while still consuming information. Additionally, the script allows you to read almost anything by simply pressing the left button of the text you want to read and hovering over it with your mouse. This means you can quickly and easily read any text on your computer without having to manually copy and paste it into another program.
-
Ensure that you have Python 3 installed on your computer.
-
pip install -r requirements.txt
-
Or, You can Install the following dependencies manually :
- gtts
- pygame
- pyautogui
- pyperclip
- pynput
- urllib3
-
Download the
read-anything-aloud.py
script from this repository and save it to your computer.
- Open a terminal or command prompt and navigate to the directory where you saved the
read-anything-aloud.py
script. - Run the script by typing
python read-anything-aloud.py
and pressing Enter. - The script will run in the background and listen for when you click your left mouse button.
- To use the script, click and hold your left mouse button simply hover your mouse over any text you want to read aloud and The script will automatically copy the text and read it aloud using the gTTS API.
- You can exit the script at any time by pressing Ctrl + C in the terminal or command prompt.
If you want to customize the script, you can modify the following variables:
lang
: The language that the text should be read in (default is 'en').cleaned_text
: The regular expression used to remove non-alphabetic characters and spaces from the copied text (default is '[^a-zA-Z ]+').
You can also modify the audio()
function to use a different text-to-speech API or to modify the way the audio is played.
This script was created by Shohan