Python gtts male voice

Generating Female Voices for Text-to-Speech using Python

After testing different codes, I discovered a few solutions to obtain the female voice. One option is to write a single line of code to get the female voice. Another option is to write a few lines of code to print all the available voices, including the female ones. In my case, I used a specific code to iterate through the voices and locate the female voice, which was identified as HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0 on my Windows 10 machine. Lastly, I also found other female voices by searching for the ‘VoiceGenderFemale’ attribute.

Pyttsx3 voice gender (female)

Although the core pyttsx3 package does not comprise a female voice, you can still simulate the female voice by using either Linux or eSpeak.

engine.setProperty('voice', 'english+f1') engine.setProperty('voice', 'english+f2') engine.setProperty('voice', 'english+f3') engine.setProperty('voice', 'english+f4') engine.setProperty('voice', 'english_rp+f3') #my preference engine.setProperty('voice', 'english_rp+f4') 

Experimentation is possible by incorporating the +f1 to +f4 options with different fundamental tones. For additional details, refer to the pyttsx female voice issue on Github.

Pyttsx3 has offered me some suitable female voices (in my scenario). For this purpose, I am running MacOS High Sierra, Python 3.7.3 and Pyttsx3 2.90. The following code has been executed to make use of Samantha voice id:

import pyttsx3 engine = pyttsx3.init() engine.setProperty('voice', 'com.apple.speech.synthesis.voice.samantha') 

While searching for the gender attribute ‘VoiceGenderFemale’, I came across several female voices, but most of them seemed odd. The one above was the most suitable one that I found using the given code.

import pyttsx3 engine = pyttsx3.init() voices = engine.getProperty('voices') voiceFemales = filter(lambda v: v.gender == 'VoiceGenderFemale', voices) for v in voiceFemales: engine.setProperty('voice', v.id) engine.say('Hello world from ' + v.name) engine.runAndWait() 

Obtaining a female voice can be achieved by writing the following single line.

engine.setProperty('voice', voices[1].id) # this is female voice 

To print all voices, the following lines of code can be written.

voices = engine.getProperty('voices') for v in voices: print(v) 

[Python] How to convert text to speech?

With the help of gTTS (Google Text to speech) and pyttsx3, we can easily convert our text to Duration: 7:36

Читайте также:  Css line height align bottom

How To Convert Text To Speech In Python

In this python tutorial, we discuss how to convert text to speech in python! Yes you read right
Duration: 6:17

Convert Text to Speech in Python

gTTs is a Python library and Command line tool to interface with Google Translate’s text-to Duration: 11:26

Pyttsx Voice Gender

I employed the subsequent code to loop over the available voices and identify the female one.

import pyttsx engine = pyttsx.init() voices = engine.getProperty('voices') for voice in voices: engine.setProperty('voice', voice.id) print voice.id engine.say('The quick brown fox jumped over the lazy dog.') engine.runAndWait() 

The female voice that I heard on my Windows 10 computer was located at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0.

I modified my code to resemble the following.

import pyttsx engine = pyttsx.init() engine.setProperty('voice', 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0') engine.say('The quick brown fox jumped over the lazy dog.') engine.runAndWait() 

change the code here engine.setProperty(‘voice’, ‘english+f1’)

To modify the voice, simply include any of the f1-f4 commands.

This is a simpler solution:

engine = pyttsx.init() voices = engine.getProperty('voices') engine.setProperty('voice', voices[1].id) 

Python | Text to Speech by using pyttsx3, init() factory function to get a reference to a pyttsx3. Engine instance. it is a very easy to use tool which converts the entered text into

How to change voices in pyttsx3 modlue of python

voices = engine.getProperty('voices') #getting details of current voice #engine.setProperty('voice', voices[0].id) #changing index, changes voices. o for male engine.setProperty('voice', voices[1].id) #changing index, changes voices. 1 for female 

To alter the gender of the voice, select either male or female.

import pyttsx3 as p engine = p.init() voice = engine.getProperty('voice') #for female engine.setProperty(voice, "!v/f1") #for male engine.setProperty(voice, "!v/m1") engine.runAndWait() 

A simple text to speech female voice python Code Example, text to speech to specific language python ; 1. from gtts import gTTS ; 2. from playsound import playsound ; 3. ​ ; 4. mytext=»Hello Geek! How are you doing??» ; 5.

Custom Python gTTS voice

Regrettably, it seems that the desired action is not possible as the script relies on this particular webpage to retrieve voice data. Additionally, it appears that the limitation of having only one voice per language cannot be circumvented.

Upon reviewing the source material, it appears that an alternative approach would be to utilize a varying form of the English language, such as en-uk, as a potential solution. This method could generate an English output with a distinct dialect.

By executing the command «gtts-cli —all» in a command prompt, you can discover that gTTS has an extensive range of available voices. Nevertheless, the only aspect you can modify is the speaker’s accent, not their gender.

Is it possible to modify the male voice of the gTTS output by using Audacity? The gTTS tool has a high-quality female voice, but it struggles with reading long sentences or unfamiliar words. Despite this, it is still the best free tool available, surpassing both free and paid alternatives. I had to figure out how to use python and eventually discovered that Anaconda is a great solution. I was then able to properly install gTTS using pip in the terminal of my system, which I couldn’t do before Anaconda. The scripts that were designed for Python 3.+ now run without any issues in the terminal’s env 3.6.8, and all of the old Python scripts still work perfectly.

Custom Python gTTS voice, If you call «gtts-cli —all» from a command prompt, you can see that gTTS actually supports a lot of voices. However, you can only change the

Источник

Пользовательский голос Python gTTS

Я использую модуль gTTS для Python 3.4, чтобы сделать mp3-файлы из устного текста. Это сработало, но вся речь звучит неким взрослым женским голосом. Есть ли способ настроить голос, в котором gTTS читает текст?

7 ответов

К сожалению, не похоже, что вы можете сделать это. Скрипт использует эту веб-страницу для захвата голоса, и кажется, что все, что вы можете сделать, — это иметь один голос на язык.

Чтение фактического источника показывает, что вашей следующей лучшей ставкой будет попытка передать другой язык, который по-прежнему является английским (например, en-uk). Это может привести к другому результату, который все еще английский, но с другим диалектом.

Если вы вызовете «gtts-cli —all» из командной строки, вы увидите, что gTTS на самом деле поддерживает множество голосов. Однако менять можно только акценты, а не пол.

Можно ли передать вывод gTTS через Audacity и применить изменение к мужскому голосу? У gTTS у меня очень хороший женский голос, но движок плохо читает длинные предложения или неожиданные слова. Тем не менее, это лучшее, что я нашел на данный момент бесплатно, и на самом деле оно лучше, чем все другие бесплатные и многие из платных. Мне просто нужно было разработать сценарии py и использовать python, и позже я узнал, что Anaconda — это чудо-лекарство от того, что вас беспокоит. Получил мой системный терминал и программу для правильной установки gTTS, чего я не мог сделать до Anaconda. Скрипты, созданные людьми для 3.+, теперь запускаются без ошибок, пытаясь запустить их в py по умолчанию v2.7. Терминал теперь env 3.6.8, но все старые скрипты py по-прежнему работают нормально.

Источник

Оцените статью