A simple MQTT audio client for synthesizing text messages published to an MQTT broker
Project description
Simple MQTT Text2Speech Client
This MQTT client subscribes to an 'OutputTopic' where text messages can be published, which the client will then speak using pyttsx3. The start of the speech output by the MQTT client is signaled on the 'StartedTopic'. Once the speech output is finished, the MQTT client signals this on the 'FinishedTopic'.
Environment Variables
The parameters of the MQTT Text2Speech client are read as environment variables from a .env file.
The following environment variables need to be defined inside the .env file:
OUTPUT_TOPIC = "/output-topic-msgs-are-published-to"
STARTED_TOPIC = "/started-topic"
FINISHED_TOPIC = "/finished-topic"
MQTT_BROKER_HOST = "host-ip-address"
MQTT_BROKER_PORT = "1883"
MQTT_BROKER_USERNAME = "mqtt-broker-username"
MQTT_BROKER_PASSWORD = "mqtt-broker-password"
RATE = 150
VOLUME = 1.0
VOICE = 0
Starting the MQTT Text2SpeechClient
import logging
from mqtt_text2speech.client import Text2SpeechClient
# Logging configuration to see output (optional)
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')
# Start MQTT Text2SpeechClient with environment variables configured in .env file
client = Text2SpeechClient()
client.start()
# Do stuff (Loop to keep main thread busy)
while True:
pass
# Connection to MQTT Broker will be closed if main thread ends
client.stop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mqtt_text2speech-0.1.1.tar.gz.
File metadata
- Download URL: mqtt_text2speech-0.1.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.2 Linux/6.1.0-23-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
befb383bc6b95e1132f52321138b8d36d40c68a070736f192e72ccc330e9f57e
|
|
| MD5 |
66170bb406ad79338b9fd9fbc030bde6
|
|
| BLAKE2b-256 |
a5f2a7779206ed3b939e171b5d9315fb5c54631bbbb615e9d8e8a41157d09eed
|
File details
Details for the file mqtt_text2speech-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mqtt_text2speech-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.2 Linux/6.1.0-23-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9537017999763d3a92fb38862c9b28ec5a4b4968c8d5be4ea24ba8b1899e2a2d
|
|
| MD5 |
fa70268a543f3e55228b7156070b68af
|
|
| BLAKE2b-256 |
83d7e3fe16f456581edc7b5068e43a47431d0b9811efeaae4f31e8b4d2b900f0
|