Matrix Routing
Overview
Section titled “Overview”Matrix routing is MZAP’s core capability. It allows any audio player to be routed to any combination of output zones, creating a flexible many-to-many audio distribution system.
How It Works
Section titled “How It Works”The routing matrix is managed by the MatrixRouter component. When you attach a player to a zone:
- A splitter stream is created from the player’s audio output
- The splitter feeds into the zone’s mixer
- The mixer combines all incoming audio (from all attached players) and sends it to the physical device channel
Changes to routing happen in real-time — no audio interruption occurs when adding or removing connections.
Routing Examples
Section titled “Routing Examples”Single Player, Multiple Zones
Section titled “Single Player, Multiple Zones”Route background music to every speaker in a venue:
Player "BGM" → Zone "Lobby L" → Zone "Lobby R" → Zone "Restaurant L" → Zone "Restaurant R"Multiple Players, Single Zone
Section titled “Multiple Players, Single Zone”Mix music and announcements into one output:
Player "Music" → Zone "Main L"Player "Announcements" → Zone "Main L"Independent Zones
Section titled “Independent Zones”Different content in different areas:
Player "Jazz" → Zone "Bar L", Zone "Bar R"Player "Pop" → Zone "Gym L", Zone "Gym R"Player "Classic" → Zone "Spa L", Zone "Spa R"Use the Matrix API endpoints to manage routing programmatically:
# Get current routingcurl http://localhost:5000/api/matrix
# Attach a player to zonescurl -X POST http://localhost:5000/api/players/{playerId}/attach-zones \ -H "Content-Type: application/json" \ -d '{"zoneIds": ["zone-1", "zone-2"]}'
# Detach a player from zonescurl -X POST http://localhost:5000/api/players/{playerId}/detach-zones \ -H "Content-Type: application/json" \ -d '{"zoneIds": ["zone-1"]}'