client = texttospeech.TextToSpeechClient() synthesis_input = texttospeech.SynthesisInput(text="Hello, I am a male voice") voice = texttospeech.VoiceSelectionParams( language_code="en-US", name="en-US-Neural2-D", # Male voice ssml_gender=texttospeech.SsmlVoiceGender.MALE ) audio_config = texttospeech.AudioConfig(audio_encoding=texttospeech.AudioEncoding.MP3) response = client.synthesize_speech(input=synthesis_input, voice=voice, audio_config=audio_config)
engine.say("Hello, I am a male voice using pyttsx3") engine.runAndWait()
# Load audio audio = AudioSegment.from_file(fp, format="mp3") gtts male voice
If you need professional male voices (like en-US-Neural2-D or en-GB-Neural2-B ), use Google Cloud Text-to-Speech — but the free gtts .
: Extremely high quality (WaveNet/Neural), dozens of male voices. client = texttospeech
male_audio = gtts_male_voice("This is a male-sounding voice using GTTS.") male_audio.export("male_voice.mp3", format="mp3")
However, you can achieve different vocal profiles or use alternatives to get the male sound you need: If you are looking to implement a in
For more advanced voice synthesis, consider these alternatives:
However, a common point of confusion for new users is the lack of a specific parameter to change the gender of the voice. If you are looking to implement a in gTTS, you may have noticed the documentation is sparse on this front.
Here is how gTTS handles voice gender, and how you can ensure you are getting a male voice for your project.