A simple MQTT audio client for synthesizing text messages published to an MQTT broker
Project description
Simple MQTT Text2Speech Client
Dieser MQTT Client subscribed ein 'OutputTopic', wo Textnachrichten published werden können, die der Client dann anschließend mit pyttsx3 ausgibt. Der Beginn der Sprachausgabe durch den MQTT Client wird unter dem 'StartedTopic' signalisiert. Sobald die Sprachausgabe beendet wurde, signalisiert der MQTT Client dies unter dem '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.0.tar.gz.
File metadata
- Download URL: mqtt_text2speech-0.1.0.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 |
a0d094e10e9e8a54c8a4c9f4617aa626043dc6dff2c77d7d5e2acc90e2d76efd
|
|
| MD5 |
19138deba9415370adb59e7166771da0
|
|
| BLAKE2b-256 |
0c350b5acc9bd03196f10472b00a4994144642748f4c39e117fcc7a98418e177
|
File details
Details for the file mqtt_text2speech-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mqtt_text2speech-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 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 |
e43138adfd2c733de7143c3de4054e192600d5fe5ece0aa59887e69804580d7f
|
|
| MD5 |
c896964358d864e7c466f594a4ef3158
|
|
| BLAKE2b-256 |
50e76689cb97151587ed82ab506f4e94a4fcd80bc586bd8312a29ee14ea3739a
|