Skip to content

An App that turns any Android/iOS device into a wireless speaker for your PC/laptop

Notifications You must be signed in to change notification settings

haider0072/EchoLink

Repository files navigation

Phone Audio Speaker

Transform your Android phone into a wireless speaker for your PC using local network or USB tethering.

Features

  • Low-latency audio streaming from PC to Android phone
  • Support for WiFi and USB tethering connections
  • Auto device discovery via mDNS
  • Configurable audio quality presets (Low Latency, Balanced, High Quality)
  • Real-time latency monitoring
  • Native audio implementation for optimal performance

Architecture

This app uses a hybrid Flutter + Native approach:

  • Flutter: UI, networking, and device discovery
  • Native Code: Audio capture (Windows) and playback (Android) for minimal latency

Planned Native Implementations

Android (Kotlin)

  • AudioTrack API for low-latency playback
  • Method channel integration with Flutter

Windows (C++)

  • WASAPI (Windows Audio Session API) for audio capture
  • Method channel integration with Flutter

Project Structure

lib/
├── main.dart                  # Entry point, platform detection
├── models/
│   └── connection_config.dart # Configuration models
├── native/
│   └── audio_channel.dart     # Native method channel interface
├── screens/
│   ├── client_screen.dart     # Android client UI
│   └── server_screen.dart     # PC server UI
└── services/
    ├── audio_service.dart     # Audio streaming logic
    └── network_service.dart   # Network communication

android/
└── app/src/main/kotlin/       # Native Android audio implementation (TODO)

windows/
└── runner/                    # Native Windows audio implementation (TODO)

Getting Started

Prerequisites

  • Flutter SDK 3.9.2 or higher
  • For Android: Android Studio with SDK 21+
  • For Windows: Visual Studio 2022 with C++ desktop development tools

Installation

  1. Clone the repository:
cd D:\projects\phone_audio_speaker
  1. Install dependencies:
flutter pub get
  1. Run on your device:

For Windows (Server/PC):

flutter run -d windows

For Android (Client/Phone):

flutter run -d android

Usage

PC/Desktop (Server)

  1. Launch the app on your Windows PC
  2. Click "Start Server" - the app will display your local IP address
  3. Once a phone connects, click "Start Streaming" to begin audio transmission

Android Phone (Client)

  1. Launch the app on your Android phone
  2. Option A: Tap the refresh icon to discover servers automatically
  3. Option B: Manually enter the PC's IP address shown on the server
  4. Tap "Connect" on the discovered device or manual connection
  5. Once connected, tap "Start Playing" to hear audio from your PC

Network Setup

WiFi Connection

  • Ensure both devices are on the same WiFi network
  • The app uses port 8888 by default
  • Device discovery uses mDNS (Multicast DNS)

USB Tethering

  • Enable USB tethering on your Android phone
  • Connect phone to PC via USB
  • The app will automatically detect the tethered connection

Audio Configuration

Three preset quality levels:

Preset Sample Rate Buffer Size Latency Use Case
Low Latency 48000 Hz 512 samples ~30-50ms Gaming, Video calls
Balanced 48000 Hz 1024 samples ~50-100ms General use
High Quality 48000 Hz 2048 samples ~100-150ms Music listening

Permissions Required

Android

  • INTERNET
  • ACCESS_NETWORK_STATE
  • ACCESS_WIFI_STATE
  • RECORD_AUDIO (for future mic support)
  • MODIFY_AUDIO_SETTINGS

Windows

  • Network access
  • Audio device access

Implementation Status

Completed Features ✅

  1. Android Native Audio (Kotlin) - COMPLETED

    • ✅ AudioTrack implementation for low-latency playback
    • ✅ Audio buffering with configurable buffer sizes
    • ✅ Method channel integration with Flutter
    • ✅ Latency monitoring and reporting
  2. Windows Native Audio (C++) - COMPLETED

    • ✅ WASAPI loopback audio capture (captures system audio)
    • ✅ Real-time audio streaming with thread priority optimization
    • ✅ Method channel and event channel integration
    • ✅ Latency reporting via WASAPI API
  3. Flutter Framework - COMPLETED

    • ✅ Network service with WiFi and USB tethering support
    • ✅ mDNS device discovery
    • ✅ Audio streaming service coordinating native + network
    • ✅ Server UI (Windows) and Client UI (Android)
    • ✅ Configuration presets (Low Latency, Balanced, High Quality)

Next Steps (Optional Enhancements)

1. Audio Codec Support

For better compression and lower bandwidth:

  • Integrate Opus codec (already specified in models)
  • Add encoding on server side
  • Add decoding on client side
  • This will reduce network bandwidth and improve quality over WiFi

2. Additional Features

  • Volume control from client
  • Audio quality indicator
  • Multiple client support
  • Save/load connection presets

Development

Building for Release

Android:

flutter build apk --release

Windows:

flutter build windows --release

Testing

flutter test

Troubleshooting

Connection Issues

  • Verify both devices are on the same network
  • Check firewall settings on PC (allow port 8888)
  • Try manual IP connection if auto-discovery fails

Audio Issues

  • Check audio permissions on both devices
  • Try different quality presets
  • Ensure no other app is using audio devices

High Latency

  • Use USB tethering instead of WiFi
  • Select "Low Latency" preset
  • Close background apps

Contributing

This is a personal project, but suggestions and contributions are welcome.

License

MIT License

Acknowledgments

  • Flutter team for the excellent framework
  • Audio codec implementations (flutter_sound)
  • mDNS discovery library

About

An App that turns any Android/iOS device into a wireless speaker for your PC/laptop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published