Skip to content

Robotic voices in pygame #13

@kwcurrin

Description

@kwcurrin

This is not an issue but a tip.
(where should tips be added on github?)

This weekend I found a good way to add text-to-speech to pygame games. If you have a mac, use the "say" program. If you have windows, use the "espeak" program available for download here:
http://espeak.sourceforge.net/

Both of these programs are available through the commandline. I've found that calling os.system('espeak "hello world"') works but causes delays in pygame. However, you can save text spoken by say or espeak to a wav file. These sounds can then be loaded like any other pygame sound for seemless game use. I have implemented this in my race game.

Note, printing text to the terminal in pygame most likely will be inaccessible to a screen reader.

Hope that is helpful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions