Skip to main content

Audio mapping

New in C-Play v2.4.

The audio mapping decides which speakers play the sound of the live layers — the layers that play their audio through PortAudio: NDI, OMT, Capture, DirectShow and WebRTC.

The mpv-based layers — Video, Audio, Stream and YouTube — normally follow the regular audio output settings instead. With mpv's jack audio driver, each of them can opt in to the same audio mapping, per layer: see mpv layers via JACK.

It has three levels, each one building on the previous:

LevelWhereWhat it does
1. Up/down mixAudio settings → Perform audio mixing (up/down) to output device and Output channelsMixes every live layer to one output layout, for example 2.0 → 5.1 or 7.1 → 2.0.
2. Spatial mappingAudio mapping... dialog (button below Output channels)Optional. Makes the sound follow where each layer is shown: surround panning of the output layout, or mono to a speaker array by distance.
3. Per layerInspect view, above the audio meterEach live layer can opt out of the up/down mix and of the spatial mapping. Both are on by default. mpv layers first opt in with Audio mapping via JACK (off by default).

When a level is off, the levels after it do nothing: without the up/down mix the live layers play their source channels unmixed, and without a spatial mapping they keep the plain up/down mix.

1. Up/down mix to the output layout​

Turn on Perform audio mixing (up/down) to output device and choose Output channels in the audio settings. The supported layouts and their channel order on the device are:

LayoutChannelsOrder
2.0 Stereo2FL FR
2.1 Stereo + LFE3FL FR LFE
5.0 Surround5FL FR C SL SR
5.1 Surround + LFE6FL FR C LFE SL SR
7.0 Surround7FL FR C SL SR RL RR
7.1 Surround + LFE8FL FR C LFE SL SR RL RR
  • Mono and stereo sources are spread over a larger layout: the fronts are kept, the centre gets a phantom centre (L + R at -9 dB), the surrounds get some of the same side (-6 dB, rears -12 dB) and the LFE gets the low end of both channels.
  • Multichannel sources keep every channel that the output layout has. Channels it lacks are folded into the closest ones at -3 dB (for example 7.1 → 5.1 folds the rears into the sides, 5.1 → 2.0 folds centre and surrounds into the fronts), and any output that would get more than full scale is scaled down.
  • With the option off, each live layer opens the device with its own channel count and plays it unmixed.

2. Spatial mapping​

Click Audio mapping... below Output channels in the audio settings to open the dialog. The dialog is not modal, so you can keep it open while placing speakers in the master view. Select the mode in Spatial mapping:

  • Off (standard up/down mix) — only level 1 applies.
  • Surround panning of the output layout — the speakers of the output layout are placed around the dome.
  • Mono to a speaker array, by distance — any number of speakers, each on its own output channel.

The spatial mapping needs the up/down mix (level 1) to be on; the dialog says so when it is not.

Surround panning​

Audio mapping dialog: surround panning

Each channel of a layer is panned toward the speakers of the output layout closest to where the layer is shown, so moving a layer around the dome moves its sound with it. The total loudness stays constant while a layer moves.

  • Focus — how sharply the sound is panned (1–20, default 4). Low values spread it over many speakers, high values keep it at the speakers nearest the layer.
  • Stereo width — how far the left and right channels spread across a flat layer (0–100 %, default 100 %). The left channels play from the left part of the layer and the right channels from the right part; at 0 % all channels play from the layer's centre.
  • Speakers — one row per output channel with Azimuth (clockwise from the dome front, 0°) and Elevation (upward from the horizon, 90° is the zenith). The defaults are the standard angles of the layout (FL/FR ±30°, SL/SR ±110° for 5.x, ±90° for 7.x, RL/RR ±150°). The LFE channel is not placed: it gets the low end of every layer. Reset to default positions restores the standard angles.

The positions belong to one output layout. When you change Output channels, the speakers start again from that layout's standard angles.

Mono to a speaker array​

Audio mapping dialog: mono to a speaker array

Each layer is summed to mono and shared out over any number of speakers (up to 64), each on its own output channel. Distance is measured to the layer's covered area, including its width, height, rotation and animated scale. Speakers inside that area share the sound equally; outside it, their share falls with distance from the nearest edge. A layer covering all speakers therefore uses all of them equally. This suits installations where speakers are spread around a dome or along a circular screen rather than in a standard surround layout.

  • Speaker positions —
    • On the dome (azimuth / elevation): speakers are placed like the surround speakers, and compared with the layer's angular coverage as seen from the dome centre. Plane layers use their projected rectangle, dome layers use their rotated dome coverage, and sphere layers cover all directions.
    • Along the circular screen (degrees / height): for the circular surface mapping. A speaker is placed at an angle on the screen (the same degrees as the Centre angle of circular plane layers) and a height in cm (like the layer's vertical position). The distance is measured around the real circle, so a layer at 350° is close to a speaker at 0°. The Full surface width of the circular mapping is taken as the circumference of the screen, which sets how much the height counts compared with the angle. Only plane layers have a position on the circular screen, and only while the circular mapping is enabled.
  • Level drop — how much quieter a speaker gets per doubling of its distance to the layer (1–24 dB, default 6 dB, the inverse distance law). Higher values keep the sound at the nearest speakers.
  • Spatial blur — added to every distance, in percent of the dome/circle radius (default 5 %). It avoids that a layer right on top of a speaker plays from that speaker only.
  • Constant loudness — on (default): the shares are shares of the power, so the loudness stays the same wherever the layer is. Off: the amplitude shares sum to 100 %.
  • Speakers — each row has the speaker's output ch (1–64) and its position. Add speaker adds one next to the last one, Create evenly spaced replaces the list with the given number of speakers spaced evenly around the dome or the screen on output channels 1 and up, and the red cross removes a speaker. Several speakers can share an output channel.

The device opens as many channels as the highest output channel used by a speaker (limited to what the device has). Layers without a position — 2D layers, and in the circular layout also dome and sphere layers — play equally on all speakers.

Share of each speaker: select a 3D layer in the Layers panel and the dialog shows the share of every speaker for that layer, updated live while the layer moves or changes size. With constant loudness on, the share is the part of the power; otherwise the part of the amplitude. For example, a circular layer spanning all eight speakers gives each 12.5 %. A smaller layer favors the speakers it covers and those closest to its edges.

Placing the speakers in the master view​

Speakers shown in the master 3D view

Check Show speakers in the master view to draw the speakers in the 3D view (the view switches to the 3D view with the perspective camera if the flat video view is shown; the fisheye and sphere views work too). Speakers of the surround layout are labelled with their channel name, speakers of the array with their output channel, and array speakers also show their share of the selected layer.

  • Drag a speaker to move it. On the dome it follows the dome surface; in the circular layout it follows the unwrapped 360° screen, drawn at the distance of the circular layers.
  • Select a speaker by pressing it in the view or with the round button in its row, then check Click in the view places the selected speaker: a click in the view moves the selected speaker there. Dragging still orbits the camera.
  • The rows in the dialog show the exact values and accept typed values.

Closing the dialog hides the speakers again; the positions are saved as soon as they change.

3. Per layer: opt out of the mapping​

Inspect view audio options

The Inspect view of every live layer shows its audio options above the audio meter toggle:

  • Map audio to the output layout (up/down mix) — shown while Perform audio mixing (up/down) to output device is on. Uncheck it to play this layer's source channels unmixed; its audio output reopens with its own channel count.
  • Follow the spatial mapping (surround panning / speaker array by distance) — shown while a spatial mapping is selected, and available only while the layer uses the up/down mix. Uncheck it to give this layer the plain up/down mix, for example for a presenter microphone that should play from all fronts regardless of where its video is shown. In speaker array mode such a layer gets the standard up/down mix onto the first output channels.

Both options are on by default whenever the mapping is enabled in the audio settings. They are saved with the layer in the presentation only when turned off ("audioMapping": false, "spatialAudio": false), so existing presentations follow the mapping, and they are synced to the nodes.

mpv layers via JACK​

Video, Audio, Stream and YouTube layers play through mpv, which normally sends its audio straight to its own output. When mpv uses the jack audio driver, each of these layers can instead send its audio into the audio mapping on this page, with the same output device, up/down mix, spatial mapping and per-layer options as the live layers. This is chosen per layer and is off by default, so other mpv layers keep playing through JACK as before.

Setup​

  1. Run a JACK server on every machine that plays the audio: the master, and the nodes when Enable audio on: Nodes / Clients is on. See the Audio configuration guide for installing JACK on Windows.
  2. Let mpv use JACK: in the audio settings, check Use custom audio output for video/audio playback, select Use audio driver and choose jack. Under mpv layers via JACK at the bottom of the audio settings, a status line shows whether this is set.
  3. Select the mapped output under the audio output settings for live layers. To send the mapped channels to JACK's system:playback_* ports, enable Use custom audio output there and select C-Play JACK client. Alternatively select a multichannel ASIO/WASAPI device. Leaving this output at the system default can limit the mapping to stereo, even when mpv uses JACK.
  4. Set up the audio mapping: enable Perform audio mixing (up/down) to output device and choose Output channels. For eight independent mono speakers, select Mono to a speaker array, by distance in Audio mapping... and assign the speakers to output channels 1–8. A stereo source can feed all eight speakers; its input channel count does not limit the mapped output count.
  5. Turn it on for the layer: open the layer in the Inspect view and check Audio mapping via JACK next to its volume slider. To enable this automatically for new Video, Audio, Stream and YouTube layers, check Audio mapping via JACK by default for new layers in Audio settings (default off). This does not change existing layers or saved presentations.

The layer then shows the same options as a live layer above the audio meter toggle: Map audio to the output layout (up/down mix), Follow the spatial mapping and the audio level meter (see Per layer).

The option is saved with the layer in the presentation ("jackAudio": true or false) and synced to the nodes. Older presentations without this property keep routing off, regardless of the new-layer default. Like the rest of the mapping, the mpv audio driver and the JACK server are set up on each machine.

How it works​

mpv (layer) ──JACK──▶ cplay-mix-… (8 input ports) ──▶ up/down mix / spatial mapping ──PortAudio──▶ output device
  • For each layer with the option on, C-Play opens a JACK client of its own named cplay-mix-<process id>-<n>, with eight input ports in_1 … in_8. The layer's mpv client is named cplay-mpv-<process id>-<n>, so the master and a node can share one JACK server.
  • C-Play sets mpv's jack-port option to these input ports, so mpv connects its output ports there instead of to the system playback ports. A multichannel source keeps its channels (up to 7.1), in the same order as the output layouts.
  • The connected inputs are mixed exactly like a live layer and played on the output selected for live layers: a PortAudio device or the C-Play JACK client, whose mapped output ports connect to JACK's system playback ports. The output opens as soon as mpv connects, and reopens when the number of channels, the device or the layer's audio mapping changes. An unavailable custom device is reported instead of silently falling back to stereo; a device with too few channels produces a warning in the log.
  • The layer's volume and mute are still applied by mpv, before JACK.
  • Turning the option on or off at runtime reloads mpv's audio output, so it reconnects right away. If the JACK server is not running, C-Play tries again every few seconds.

Good to know​

  • Only with the jack driver — with any other mpv audio driver the option has no effect, and the layer plays through the regular audio output. A jack-port or jack-name set in the mpv configuration files or the layer's mpv options profile overrides the routing.
  • Two clocks — JACK and the PortAudio output device each run on their own clock. C-Play keeps the extra delay between about 20 and 100 ms, and skips ahead when more builds up, which can cause a very short glitch now and then. Choosing an output device on the same sound card that JACK uses keeps this to a minimum.
  • Watching the connections — in a JACK patchbay such as QJackCtl's graph, the layer's cplay-mpv-… ports are connected to cplay-mix-…:in_*, and not to system:playback_*.
  • Build support — the option needs a C-Play build with JACK and PortAudio support. Without it, the checkbox and the mpv layers via JACK section are not shown.

Good to know​

  • Audio on the nodes — the mapping settings and the speaker positions are read from each machine's own audio settings. When nodes play audio (Enable audio on: Nodes / Clients), configure the mapping on those nodes as well; the per-layer options come from the master.
  • Coherent stereo in the speaker array — a stereo source whose left and right channels are identical sounds about 3 dB louder when summed to mono for the array.
  • No position — 2D layers have no place in the dome: with surround panning they keep the standard up/down mix, in speaker array mode they play equally on all speakers.
  • Duplicate mode — a layer in duplicate mode plays from all of its visible duplicates at once (from all of them while none is visible). With surround panning each channel is panned toward every duplicate with an equal share of the power, so the total loudness stays the same as for a single layer. In speaker array mode each speaker is as close as its nearest duplicate, so every speaker covered by any duplicate gets the full share. Duplicates without a position (2D) are left out while another duplicate has one. With a duplicate selected, the dialog shows the shares of the whole layer, all duplicates together.
  • Audio level meter — the meter in the Inspect view shows the level after the mapping, for all live layers.