Skip to content

Matrix Routing

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.

The routing matrix is managed by the MatrixRouter component. When you attach a player to a zone:

  1. A splitter stream is created from the player’s audio output
  2. The splitter feeds into the zone’s mixer
  3. 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.

Route background music to every speaker in a venue:

Player "BGM" → Zone "Lobby L"
→ Zone "Lobby R"
→ Zone "Restaurant L"
→ Zone "Restaurant R"

Mix music and announcements into one output:

Player "Music" → Zone "Main L"
Player "Announcements" → Zone "Main L"

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:

Terminal window
# Get current routing
curl http://localhost:5000/api/matrix
# Attach a player to zones
curl -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 zones
curl -X POST http://localhost:5000/api/players/{playerId}/detach-zones \
-H "Content-Type: application/json" \
-d '{"zoneIds": ["zone-1"]}'