# Choose a controller connection

> Compare direct browser input, native adapters and MIDI relay for gamepads and music controllers.

Canonical: https://maru.audio/docs/controller-connections
Documentation index: https://maru.audio/llms.txt

A gamepad can control a browser instrument directly. You need a local relay
when the destination accepts a different kind of input, such as a DAW expecting
MIDI. Choose the destination first, then the connection that preserves the
controls your app needs.

For a first phrase and an editable trigger-to-MIDI assignment, start with
[Play music with a game controller](https://maru.audio/docs/play-music-with-a-game-controller.md).

## Choose a path

| Your destination | Input path | What to check |
| --- | --- | --- |
| A browser app with gamepad support | Paired gamepad → browser Gamepad API → app | Browser mapping, focus, button/axis values and optional vibration |
| A browser app with MIDI support | MIDI controller or relay → OS MIDI input → Web MIDI → app | Browser permission, selected input, channel and message type |
| A native standalone instrument | Gamepad or MIDI device → native host adapter → app | The exact host's device support; a standalone build does not add an adapter |
| A DAW instrument expecting MIDI | Gamepad → musical mapping → virtual MIDI source → DAW input | Relay software, virtual-port availability, note ownership and cleanup |
| An app requiring richer controller data | Device adapter → agreed controller protocol → app | Identity, signal precision, timing, feedback and connection lifetime |

The [Gamepad API](https://www.w3.org/TR/gamepad/) exposes browser controller
input and optional haptics. [Web MIDI](https://www.w3.org/TR/webmidi/)
exposes OS-visible MIDI ports. They are separate APIs with separate access and
capability checks. A device appearing in one does not make it an input in the other.

Maru's source SDK supplies direct browser capture and signal-to-MIDI mapping.
The source workspace also includes a local controller-app runner with SDL3
capture and an independent virtual-MIDI output. It runs Controller MIDI or
Gamepad Chords without a browser page. Building its helper needs an installed
SDL3 toolchain; its source distribution's local controller-app guide covers
setup and receiver checks. Source-runner verification is separate from packaged Desktop and
physical-controller compatibility. Importing the mapping library alone installs
no relay service or virtual port. For an executable SDK starting point, use
[Controllers and musical signals](https://maru.audio/docs/controllers.md).

## Connect to a standalone or plug-in instrument

A musical relay gives the receiving application an ordinary MIDI source. Start
the local relay, then select its source in the standalone app's MIDI Input
picker, or on a DAW instrument track. Choose the same channel and enable the
receiver's monitoring. Test one note-on and note-off before adding expression.
Select audio output independently in the standalone app or DAW.

An AU or VST instrument can receive those musical events through its host.
Generating MIDI from a plug-in for another instrument is a separate feature.
Ableton Live's [format comparison](https://help.ableton.com/hc/en-us/articles/209068929-Using-AU-and-VST-plug-ins-on-macOS)
lists direct MIDI output for VST2/VST3 and not AU. Use its
[VST MIDI-output setup](https://help.ableton.com/hc/en-us/articles/209070189-Accessing-the-MIDI-output-of-a-VST-plug-in)
when routing a MIDI-generating plug-in. This limitation does not prevent an AU
instrument from receiving the relay's MIDI through the DAW.

For CC-controlled effects, learn or assign the incoming CC at the receiver.
A moving trigger does not automatically select a filter or mix parameter.
Confirm pitch-bend range at both ends. A successful note test does not prove
expression or feedback support.

Building an app as standalone, AU or VST compiles its declared audio/MIDI
processing. It does not automatically add gamepad discovery or a background
controller app. A host must supply those services, including the behavior when
the editor closes. Use a relay when the receiver has MIDI input but lacks direct
gamepad input.

## Keep the device, connection and assignment separate

The **device** supplies controls: buttons, sticks, triggers, keys, encoders or
touch surfaces. The **connection** carries their input. The **assignment** gives
it meaning: choose a chord, play a tone, move a parameter or send a MIDI message.

A PS5 trigger can control expression directly as a continuous value. A relay
can instead turn its travel into CC11 for a MIDI instrument. The receiver sees
CC11; those bytes alone do not tell it that a PS5 trigger produced them.

For two identical controllers, keep separate connection identities. Browser
indices are attachment slots, and names describe models rather than unique
units. If direct capture and a MIDI relay both reach the app, select one path
for an assignment to avoid playing each press twice.

## Match the input to the musical job

| Input | Useful musical role | Information to retain |
| --- | --- | --- |
| Button or key gate | Start and release a tone | Both edges and the pitch chosen at the attack |
| Progressive trigger or fader | Expression, mix or a continuous parameter | Full travel and resting value |
| Centered stick | Pitch gesture or two-dimensional control | Signed axes and center/dead zone |
| Relative encoder | Change a parameter from its present value | Every signed step, including repeated steps |
| Pressure or touch | Shape a held phrase | Pressure amount or contact lifetime where supplied |

Manufacturer labels help people find controls. Assignments should retain stable
positions or control IDs. On the standard gamepad layout, PlayStation Cross and
Xbox A occupy the south position; the musical assignment can stay the same.
Recognizing a product name helps label a drawing but does not establish an
unknown input layout.

## Decide where MIDI conversion belongs

A **musical relay** produces notes, CC or pitch bend. The receiving instrument
plays those messages. Keep chord selection and transposition at the sender if
it already applied them; repeating the mapping at the receiver changes the result.

A **control relay** carries the original gestures for another app to interpret.
Both ends need an agreed mapping, identity and version. Ordinary MIDI messages
do not define a universal gamepad layout, touch protocol or rumble command.

MIDI conversion can also reduce precision. Ordinary CC has seven-bit values;
pitch bend has fourteen-bit values. Higher-resolution control requires a
specified encoding and a receiver that understands it. See the
[MIDI message reference](https://midi.org/summary-of-midi-1-0-messages).
Keep continuous values intact until the selected output requires conversion.

## Input and feedback travel independently

Trigger travel is input. Rumble, LEDs, displays and adaptive trigger resistance
are different output features. Receiving button presses does not establish any
of those capabilities, and having a MIDI output does not automatically provide them.

Use [Controller mappings and feedback](https://maru.audio/docs/controller-mappings-and-feedback.md)
to connect signal identities to assignments and visual states. If the connection
does not behave as expected, follow
[Troubleshoot controller input](https://maru.audio/docs/troubleshoot-controller-input.md).
