This project is a real-time voice chat application where users can communicate over a network using their microphones. The application uses UDP for low-latency audio transmission, making it suitable for real-time communication. The GUI is built using Qt, providing an intuitive interface for managing connections, muting/unmuting the microphone, and adjusting volume levels.
-
Client-Server Architecture:
- The server acts as a relay, forwarding audio packets from one client to all other connected clients.
- Clients connect to the server via UDP sockets.
-
Real-Time Audio Streaming:
- Audio is captured from the user's microphone and transmitted in real-time using low-latency UDP.
- Received audio packets are played back using Qt's multimedia framework.
-
GUI Components:
- Connect/Disconnect Buttons: Allow users to join or leave the chat room.
- Mute/Unmute Button: Toggle the microphone on/off.
- Volume Control: Adjust the playback volume of incoming audio.
- Status Display: Show connection status and active participants.
-
Multithreading:
- Separate threads handle audio capture, audio playback, and network communication to ensure smooth performance.
-
Error Handling:
- Handle disconnections gracefully.
- Provide feedback for errors such as failed connections or missing audio devices.
- STL:
std::vector,std::thread,std::mutex. - OOP: Encapsulation and modularity in designing
AudioCapture,AudioPlayback,Client, andServerclasses. - Multithreading: Concurrent handling of audio capture, playback, and network communication.
- Networking: UDP sockets for real-time audio streaming.
- GUI Framework: Qt for building the graphical user interface.
- Audio Processing: Qt Multimedia for capturing and playing back audio.
VoiceChatApp/
├── include/
│ ├── AudioCapture.hpp // Audio capture class
│ ├── AudioPlayback.hpp // Audio playback class
│ ├── Client.hpp // Client class definition
│ ├── Server.hpp // Server class definition
│ └── MainWindow.hpp // Main GUI window
├── src/
│ ├── AudioCapture.cpp
│ ├── AudioPlayback.cpp
│ ├── Client.cpp
│ ├── Server.cpp
│ └── MainWindow.cpp
├── main.cpp // Main entry point
├── CMakeLists.txt // Build configuration
└── README.md // Project documentation
-
Server:
- Listens for incoming UDP packets from clients.
- Broadcasts received audio packets to all connected clients.
-
Client:
- Captures audio from the microphone using Qt Multimedia.
- Sends captured audio packets to the server via UDP.
- Receives audio packets from the server and plays them back using Qt Multimedia.
-
GUI:
- Provides buttons to connect/disconnect, mute/unmute, and adjust volume.
- Displays the connection status and active participants.
- A user starts the server application.
- Multiple clients launch the GUI-based client application and connect to the server.
- Users can speak into their microphones, and their voices are transmitted in real-time to all other connected clients.
- Users can mute their microphones, adjust the volume, or disconnect from the chat.