Fundamentals 5 min read

How to Make Python Speak with a Male Voice Using pyttsx3 and Registry Tweaks

This article walks through troubleshooting the pyttsx3 Python text‑to‑speech library on Windows, explains why only female voices appear by default, shows how to add the missing male “Kangkang” voice via registry edits, and provides complete working code examples for both voice selection and speech synthesis.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
How to Make Python Speak with a Male Voice Using pyttsx3 and Registry Tweaks

Introduction

In a Python community, a user asked about a problem with the pyttsx3 library. The original code attempted to set a female voice.

Original Code

import pyttsx3  # import the library

def voiceChange():
    eng = pyttsx3.init()  # initialize an instance
    voice = eng.getProperty('voices')  # get the available voices
    # eng.setProperty('voice', voice[0].id) # male voice (commented)
    eng.setProperty('voice', voice[1].id)  # female voice
    eng.say("This is a demonstration of how to convert index of voice using pyttsx3 library in python.")
    eng.runAndWait()

if __name__ == "__main__":
    voiceChange()

The code works but only female voices are available on Windows 10 by default.

Windows 10 Built‑in Voices

Windows 10 provides five voices. The male voice “Kangkang” is not loaded by default; only “Huihui” and “Zira” (female) appear.

Adding a Male Voice

By editing the Windows registry you can add the missing “Kangkang” voice. The tutorial is available at https://www.likecs.com/show-204841565.html.

After the registry change, the male voice appears in the list and can be selected.

Working Example

import pyttsx3  # 导入库

def textToVoice():
    eng = pyttsx3.init()
    voice = eng.getProperty('voices')
    eng.setProperty('voice', voice[2].id)
    eng.say("感谢大佬!太强了 太强了 太强了")
    eng.runAndWait()

if __name__ == "__main__":
    textToVoice()

The script now speaks with the male “Kangkang” voice.

Conclusion

The article demonstrates how to troubleshoot pyttsx3 voice selection on Windows, modify the registry to load a missing male voice, and provides working code examples.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

voice synthesistext-to-speechProgramming tutorialpyttsx3Windows Registry
Python Crawling & Data Mining
Written by

Python Crawling & Data Mining

Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.