Read Articles Using Microsoft Native Voice

Winston Ma
2 min readSep 4, 2024

--

I used to rely on the Read Aloud browser extension to have web articles read to me. However, the standard voice quality wasn’t quite what I wanted. So, I decided to create my own solution. This meant extracting the article and reading it out myself.

Extracting the Article

Extracting articles manually can be tedious. To simplify this, I found that using percollate works well. Using trimd, the article is transformed into a clean text format.

Reading the Article

For reading, I used edge-tts. The built-in edge-playback command reads the text aloud.

Putting together

# Install edge-tts
pip install edge-tts
# Install percollate
npm install -g percollate
# Install trimd
npm install -g trimd

# Read a testing article
ARTICLE_URL="https://medium.com/@savannahmuire/what-if-we-all-b17ca4a77d40"
# Read the article
percollate md -o - $ARTICLE_URL | trimd demarkdown | edge-playback -f /dev/stdin

If you hear the article, it means everything is working correctly.

To make this process easier, add the following line to your ~/.bashrc file:

# TTS
tts() { percollate md -o - $1 | trimd demarkdown | edge-playback -f /dev/stdin; }

After restarting your terminal, you can read any article with a single command:

# Read a testing article
tts "https://medium.com/@savannahmuire/what-if-we-all-b17ca4a77d40"

--

--

No responses yet