This directory contains a audio producer python script captures real-time audio data and sends it to a Kafka topic.
The configuration for the producer is stored in a producer.properties
file. Below is an example configuration:
[producer]
bootstrap.servers=10.70.14.81:9092
topic=raw_audio
sample.rate=44100
channels=2
chunk.size=1024
- Ensure you have a Kafka server running and accessible at the address specified in the
producer.properties
file. - Install the required Python packages:
pip install confluent_kafka sounddevice configparser
- Run the audio producer script:
python3 producer.py
producer.properties
: Configuration file for the Kafka producer.producer.py
: Main script to capture audio and send it to Kafka.
- The script reads configuration from
producer.properties
. - It checks if the Kafka server is available.
- It initializes a Kafka producer.
- It captures audio data in real-time using the
sounddevice
library. - It sends the captured audio data to the specified Kafka topic.
Press Ctrl+C
to stop the audio recording and gracefully shut down the producer.
confluent_kafka
sounddevice
configparser
Back to [main readme](../README.md).