High-performance, low-latency PCM audio streaming over WebSockets with Music Assistant integration.
AriaCast Server is a lightweight, bidirectional audio streaming receiver written in Python. It transforms any device (Windows, Linux, macOS, Raspberry Pi) into a network "speaker" capable of receiving raw PCM audio, synchronizing metadata in real-time, and offering remote volume control.
Now featuring Music Assistant plugin integration and a modern, artwork-enhanced web player with glassmorphism UI and dynamic backgrounds.
- Hybrid Audio Transport:
- WebSocket Stream: Low-latency raw PCM transmission (48kHz/16-bit default)
- HTTP Stream:
/stream.wavendpoint for compatibility with generic players (VLC, Browser)
- Adaptive Buffering: Smart server-side buffering to handle network jitter
- Cross-Platform: Core logic in Python with platform-specific extensions
- Bidirectional Control:
- Native system volume control (Windows
pycawsupport with PowerShell fallback) - Real-time metadata synchronization (Title, Artist, Album, Artwork, Position, Duration)
- Native system volume control (Windows
- Artwork Support: Automatic downloading and serving of album artwork
- Progress Tracking: Real-time playback position and duration
- Auto-Discovery: Dual-stack discovery using Multicast DNS (Bonjour/
_audiocast._tcp) and custom UDP broadcast - Music Assistant Plugin: Full integration as a Music Assistant provider with source selection and control
- Web Dashboard: Modern, responsive web player with artwork backgrounds and visualizer
- Glassmorphism UI: Modern frosted glass design with backdrop blur
- Dynamic Backgrounds: Album artwork automatically becomes the page background
- Spectrum Visualizer: Colorful real-time audio spectrum analysis
- Responsive Design: Optimized for desktop, tablet, and mobile
- Real-time Stats: Buffer monitoring, sample rate, and connection status
-
Clone the repository:
git clone https://github.com/AriaCast/Ariacast-server-python.git cd Ariacast-server-python -
Install dependencies: Ensure you have Python 3.9+ installed.
pip install -r requirements.txt
Note: On Windows, some build tools might be required for
pycaworsounddevicedepending on your environment. On Linux, you may needlibportaudio2.
Start the server using the provided launcher script:
python start.py# Run with default configuration
python start.py
# Run in verbose mode (debug logs)
python start.py -v
# Run with a specific configuration profile (see config_examples.py)
python start.py -c living_room
# Run in web-only mode (no local playback, just stream relay)
python start.py --web-onlyThe server is implemented in a Music Assistant plugin that integrates AriaCast as an audio source:
Access the modern web player at:
http://<server-ip>:8090/
- π¨ Dynamic Backgrounds: Album artwork automatically becomes the blurred page background
- π Real-time Metadata: Title, artist, album, and playback progress
- π΅ Spectrum Visualizer: Colorful audio frequency analysis
- ποΈ Volume Control: Styled slider with smooth animations
- π Live Stats: Buffer status, sample rate, channels, and connection state
- π± Responsive: Works perfectly on all device sizes
AriaCast uses a client-server architecture where:
- Client: Streams audio to the server, sends metadata, and controls playback
- Server: Receives audio, provides playback, and exposes control/metadata endpoints
| Endpoint | Type | Direction | Description |
|---|---|---|---|
/audio |
Binary | Client β Server | PCM audio stream |
/stats |
JSON | Server β Client | Playback statistics |
/control |
JSON | Bidirectional | Volume and playback control |
/metadata |
JSON | Bidirectional | Track metadata (title, artist, artwork) |
/artwork |
Binary | Server β Client | Downloaded album artwork |
Audio data is sent as binary WebSocket frames:
| Component | Details |
|---|---|
| Frame Type | Binary (OpCode 0x2) |
| Frame Size | Exactly 3840 bytes |
| Content | Raw PCM audio data |
| Timing | Frames should be sent at 50 frames/second (20ms intervals) |
Audio Data Format:
Sample Rate: 48000 Hz
Bit Depth: 16-bit signed integer (little-endian)
Channels: 2 (Stereo)
Duration: 20 milliseconds
Frame Size: 960 samples Γ 2 channels Γ 2 bytes = 3840 bytes
Enhanced metadata support with artwork downloading:
Update Metadata (Client β Server):
{
"type": "update",
"data": {
"title": "Song Title",
"artist": "Artist Name",
"album": "Album Name",
"artwork_url": "https://example.com/cover.jpg",
"artworkUrl": "https://example.com/cover.jpg",
"duration_ms": 240000,
"position_ms": 45000,
"is_playing": true
}
}Volume Commands (Client β Server):
{"command": "volume", "direction": "up"}
{"command": "volume", "direction": "down"}
{"command": "volume_set", "level": 75}Playback Commands (Server β Client, Music Assistant integration):
{"action": "play"}
{"action": "pause"}
{"action": "next"}
{"action": "previous"}Edit config_examples.py or modify the ServerConfig class:
@dataclass
class ServerConfig:
SERVER_NAME: str = "My AriaCast Speaker"
VERSION: str = "1.0"
PLATFORM: str = "Ubuntu"
DISCOVERY_PORT: int = 12888
STREAMING_PORT: int = 12889
WEB_PORT: int = 8090
ENABLE_LOCAL_AUDIO: bool = True
AUDIO: AudioConfig = AudioConfig()aiohttp- Async Web Serversounddevice- Audio Playbackzeroconf- mDNS Discoverynumpy- Audio Buffer Management
pycaw- Windows Core Audio Library (volume control)music-assistant- For plugin integration
- Python: 3.9+
- Audio: PortAudio-compatible sound system
- Network: Multicast DNS support (Bonjour/Avahi)
Local Area Network
ββ AriaCast Server
β ββ Audio Playback (sounddevice)
β ββ WebSocket Server (aiohttp)
β β ββ /audio - Audio stream
β β ββ /control - Bidirectional control
β β ββ /metadata - Track information
β β ββ /stats - Playback statistics
β β ββ /artwork - Album artwork
β ββ UDP Discovery (12888)
β ββ mDNS Advertiser (_audiocast._tcp)
β ββ Web Dashboard (8090)
β
ββ Music Assistant (Optional)
β ββ AriaCast Provider Plugin
β
ββ AriaCast Clients
ββ Discovery Phase (mDNS/UDP)
ββ Streaming Phase (WebSockets)
Contributions are welcome! Please feel free to submit pull requests, report issues, or suggest enhancements.