A lightweight, peer-to-peer voice communication application for local networks. LanVoice enables real-time audio streaming between two computers using UDP sockets.
- Real-time voice transmission over LAN
- Low latency audio streaming using UDP protocol
- Configurable remote address and ports
- Minimal dependencies (Java standard library only)
- Simple command-line interface
- Special thanks to WhatsApp Desktop for making their call functionality so remarkably terrible that it inspired the creation of this project.
- Heartfelt gratitude to my little brother for suggesting I build something like this so we could finally stop relying on WhatsApp Desktop for voice calls.
- Java 8 or higher
- Two computers connected to the same local network (or localhost for testing)
LanVoice captures audio from your microphone, splits it into small packets, and sends them via UDP to a remote address. Simultaneously, it listens for incoming audio packets and plays them through your speakers.
- Audio.java - Handles microphone input and speaker output using
javax.sound.sampled - UDPClient.java - Captures and sends audio packets to the remote peer
- UDPServer.java - Receives incoming audio packets and plays them
- Main.java - Entry point, parses arguments and coordinates components
| Parameter | Value |
|---|---|
| Sample Rate | 16000 Hz |
| Sample Size | 16 bits |
| Channels | 1 (Mono) |
| Buffer Duration | 30 ms |
java -jar LanVoice.jarThis will use default values:
- Remote address:
localhost - Remote port:
50005 - Local port:
50005
java -jar LanVoice.jar [remoteAddress] [remotePort] [localPort]Computer A (IP: 192.168.1.10):
java -jar LanVoice.jar 192.168.1.20 50005 50005Computer B (IP: 192.168.1.20):
java -jar LanVoice.jar 192.168.1.10 50005 50005java -jar LanVoice.jar --helpCompile all Java files and create a JAR:
javac -d out src/*.java
jar cfe LanVoice.jar Main -C out .- No audio? Make sure your microphone and speakers are properly configured in your OS settings.
- High latency? Try reducing the
BUFFER_DURATION_MSvalue inAudio.java(lower values = less latency but more packets). - Connection issues? Verify both computers are on the same network and firewalls allow UDP traffic on the specified ports.
- No encryption (not recommended for sensitive communications)
- No NAT traversal (requires direct network connectivity)
- Two peers only (no group calls)
This project is open source. Feel free to use and modify it.