Skip to main content

Leverage the macOS `say` command into you scripts

Project description


Ever wanted to leverage the macOS builtin speech synthesis directly into python ? Or just make your code to talk...
With the Python macos_speech package you can do it in a pythonic way. Easy and zen.

Getting Started:


pip install macos_speech


macOS 10.x or for oldest OS X
For now, this package only works on Python >= 2.6 and Python >= 3.6.x
Only tested on Python 2.7.10 and 3.7.2.

Basic usage

from macos_speech import Synthesizer

speaker = Synthesizer(voice='Alex', device='Built-in')

speaker.text = """How my God! I can make my python code to talk!

And I can even send multiple lines! Awesome.

Some informations

from macos_speech import Synthesizer

speaker = Synthesizer()

print '''Voices:
for voice in speaker.voices:
  print '{} {} {}'.format(, voice.lang, voice.desc)

print ''

print 'Audio devices:'
for device in speaker.devices:
  print 'ID: {}, NAME: {}'.format(,

print ''

print '''Output file possible formats:
for format in speaker.formats:
  print '{} {} ({}) [{}] [{}]'.format(,,

Synthesizer Properties

from macos_speech import Synthesizer

synthe = Synthesizer()

# Helper properties

# Configuration properties

# File IO (takes absolute pathes strings)
synthe.infile  # A file containing text to say (mutually exclusive with self.text - high priority)
synthe.outfile # The output audio file (default should be 'output.aiff'
               # but you can specify file and data formats)

# Simple configs (takes strings)
synthe.rate    # The speech rate
synthe.quality # The audio quality (between 0 and 127 both included)
synthe.text    # The text to say (mutually exclusive with self.infile - low priority)

# Pythonified configs (takes macos_speech.CustomClasses)
synthe.format  # The audio output file/data format : macos_speech.AudioFormat
               # (Works only with self.outfile populated)

synthe.device  # The audio output device           : macos_speech.AudioDevice
               #                                 (or 'name' or 'id' on Python 3)
               # (Only used if no self.outfile)

synthe.voice   # The voice to use                  : macos_speech.Voice
               #                                   (or 'name' on Python 3) 

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for macos-speech, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size macos_speech-1.0.0.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page