RapidWareTech / pyttsx

Cross-platform text-to-speech wrapper
Other
370 stars 134 forks source link

Is there any language with female gender? #51

Open ehsaanQCTechnologies opened 7 years ago

ehsaanQCTechnologies commented 7 years ago
import pyttsx
engine = pyttsx.init()
voices = engine.getProperty('voices')
male_language_count = 0
female_language_count = 0
none_language_count = 0
for voice in voices:
    if voice.gender == 'male':
        # female language count
        male_language_count += 1
    elif voice.gender == 'female':
        # female language count
        female_language_count +=1
    else:
        # None language count
        none_language_count += 1

print 'Male gender language count : %d' %  male_language_count
print 'Female gender language count : %d' % female_language_count
print 'None gender language count : %d' % none_language_count

Output

Male gender language count : 60
Female gender language count : 0
None gender language count : 9

How i change the english and spanish language gender to female?

franc-carter commented 7 years ago

If you are using linux/espeak it looks like there are no specific female voices included. However you can simulate them by adding '+f1' up to '+f4' on the end of the the voice. I use

engine.setProperty('voice', 'english+f1')

jdr53 commented 4 years ago

The +f1 thru +f4 do add intonation but be aware that the results vary by the basic voice. So for example, "english_rp+f3" or even +f4 is rather acceptable (to me), but en-westindies+f3 is abrasive and doesn't sound feminine at all. I suggest you write a loop that repeats a fairly long text message, and repeat it for each voice and each intonation. Then choose. Or put in some randomness to kill the boredom factor. Unfortunately, there don't appear to be any available third-party voices for pyttsx3. I have found that it sometimes helps (both male and female) to fiddle with phonemes by way of creative spelling. For example, "as you wishhh" instead of "as you wish", or spelling out "okay" instead of using "ok". Your last resort may be to design your own voice / phonemes palette but that is arduous and you'll probably have a difficult time finding phoneme editors and guidance.