Skip to main content

Wrapper for AWS Polly with segmentation, playback queue and client-server setup

Project description

python-polly

python-polly is a simple wrapper around AWS's text-to-speech service Polly.

Features are:

  • Cache requests to AWS Polly locally
  • Tokenize input text into sentences or words in order to maximize usage of cache
  • Playback queue for audio output
  • Client-server setup to support concurrent output by multiple applications

Setup

pip install --user python-polly[server]

Most of the dependencies are only required by the server so I put them in as an extra option. To get the dependencies for the server use python-polly[server] otherwise just python-polly.

Usage

Server

Start the server. Default port is 6000.

polly server

Client

CLI

polly say "hello world"

Python

import polly.client
polly.client.say('hello world')

Any other JSON-RPC client e.g. cURL

curl -d '{"id": "null", "jsonrpc": "2.0", "method": "say", "params": ["hello", "Joanna", "sentence", true]}' localhost:6000

Links

Playback

https://people.csail.mit.edu/hubert/pyaudio/docs/#example-callback-mode-audio-i-o
https://github.com/spatialaudio/python-sounddevice/blob/master/examples/play_long_file.py

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 python-polly, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size python_polly-0.1.0-py3-none-any.whl (6.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size python-polly-0.1.0.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page