Skip to content

UlisesChoco/lanvoice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LanVoice

A lightweight, peer-to-peer voice communication application for local networks. LanVoice enables real-time audio streaming between two computers using UDP sockets.

Features

  • 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

Acknowledgments

  • 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.

Requirements

  • Java 8 or higher
  • Two computers connected to the same local network (or localhost for testing)

How It Works

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.

Architecture

  • 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

Audio Configuration

Parameter Value
Sample Rate 16000 Hz
Sample Size 16 bits
Channels 1 (Mono)
Buffer Duration 30 ms

Usage

Basic Usage (localhost testing)

java -jar LanVoice.jar

This will use default values:

  • Remote address: localhost
  • Remote port: 50005
  • Local port: 50005

Custom Configuration

java -jar LanVoice.jar [remoteAddress] [remotePort] [localPort]

Example: Two computers on LAN

Computer A (IP: 192.168.1.10):

java -jar LanVoice.jar 192.168.1.20 50005 50005

Computer B (IP: 192.168.1.20):

java -jar LanVoice.jar 192.168.1.10 50005 50005

Help

java -jar LanVoice.jar --help

Building from Source

Compile all Java files and create a JAR:

javac -d out src/*.java
jar cfe LanVoice.jar Main -C out .

Troubleshooting

  • No audio? Make sure your microphone and speakers are properly configured in your OS settings.
  • High latency? Try reducing the BUFFER_DURATION_MS value in Audio.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.

Limitations

  • No encryption (not recommended for sensitive communications)
  • No NAT traversal (requires direct network connectivity)
  • Two peers only (no group calls)

License

This project is open source. Feel free to use and modify it.

About

Minimal UDP-based voice chat for real-time communication over local networks (LAN)

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages