This project enables real-time audio streaming from a microphone on one machine (the sender) to another machine (the receiver) over the internet using WebSockets. It's useful for remote monitoring or broadcasting audio from a microphone source.
The project consists of three main components:
sender.py
: Captures audio from the microphone and sends it to the server using WebSockets.server.py
: A WebSocket server that relays audio data from the sender to the receiver.receiver.py
: Connects to the server via WebSocket and plays the received audio stream.
- Python 3.x
pyaudio
for audio capture and playback.websocket-client
for WebSocket communication in sender and receiver.aiohttp
for the WebSocket server.numpy
for audio data manipulation in the receiver.
Ensure you have Python 3.x installed. Then, install the required Python packages:
pip install pyaudio websocket-client aiohttp numpy
- Server: Start the server component first by running
python server.py
. - Sender: Run the sender component on the machine with the microphone you wish to stream from with
python sender.py
. - Receiver: Finally, run the receiver component on the machine where you want to listen to the audio stream with
python receiver.py
.
- The system is designed to work over networks, but ensure your firewall and network settings allow for the required WebSocket connections.
- The
WS_URL
in both sender and receiver scripts should be updated to match your server's address and port. - This is a basic implementation intended for educational purposes or as a foundation for more complex streaming solutions.
remote-audio-streaming, live-audio-streaming, python-websockets, audio-over-websocket, real-time-microphone-streaming, microphone-to-pc-streaming, web-audio-api, audio-capture, streaming-audio-data, audio-broadcasting, websockets-audio-transport, remote-sound-monitoring, sound-streaming, python-audio-processing, network-audio-stream, microphone-audio-transmission, audio-streaming-application, voice-streaming, remote-listening, audio-data-transfer