# MIDI Control

Automate Audion streaming with MIDI commands from your presentation software, lighting console, or MIDI controller.

## Overview

MIDI control allows you to start and stop streaming without touching your Mac. Perfect for:

- **ProPresenter users:** Trigger stream with service start/end
- **Lighting consoles:** Control audio with your lighting cues
- **MIDI controllers:** Use physical buttons to control streaming
- **Automation:** Integrate with existing show control systems

## Supported MIDI

Audion works with:

- ✅ USB MIDI devices
- ✅ Bluetooth MIDI devices
- ✅ Network MIDI (RTP-MIDI)
- ✅ Virtual MIDI ports
- ✅ MIDI interfaces

**Message types supported:**
- Control Change (CC) messages
- Note On messages

## Setup Overview

1. Connect your MIDI device
2. Enable MIDI in Audion
3. Select your MIDI device
4. Learn Start command
5. Learn Stop command
6. Test your setup

## Enabling MIDI Control

### Step 1: Open Preferences

1. Click **Audion** in the menu bar
2. Select **Preferences...** (or press `⌘,`)
3. Click the **MIDI** tab

### Step 2: Enable MIDI

1. Check **"Enable MIDI control for streaming"**
2. Audion will scan for available MIDI devices

### Step 3: Select Your Device

1. Click the **MIDI Device** dropdown
2. Select your MIDI controller/interface
3. Wait for "Connected" confirmation

> **Tip:** If you don't see your device, make sure it's connected and powered on, then restart Audion.

## Learning MIDI Commands

Audion uses a "learn" mode to capture your MIDI commands.

### Learning the Start Command

1. Click **"Learn"** next to "Start Command"
2. Status will show: "Waiting for MIDI input to assign as Start command..."
3. **Press/move the control** on your MIDI device you want to use
4. Audion captures the command automatically
5. The command name appears (e.g., "CC64 on Ch1")

**That's it!** Your Start command is saved.

### Learning the Stop Command

1. Click **"Learn"** next to "Stop Command"
2. Status will show: "Waiting for MIDI input to assign as Stop command..."
3. **Press/move a different control** on your MIDI device
4. Audion captures the command
5. The command name appears

**Important:** Use different controls for Start and Stop to avoid conflicts.

### Canceling Learn Mode

If you change your mind:
- Click the **"Learn"** button again (it becomes "Cancel")
- Or press a different control to overwrite

### Clearing Commands

To remove a learned command:
1. Click **"Clear"** next to the command
2. The command is removed
3. MIDI control for that action is disabled

## Command Types

### Control Change (CC) Messages

**What they are:**
- Most common MIDI message type
- Sent by knobs, faders, buttons
- Include CC number and value (0-127)

**Example:** "CC64 on Ch1"
- CC number 64 (sustain pedal)
- On MIDI Channel 1

**Audion behavior:**
- CC values 64-127 trigger the command
- Values below 64 are ignored
- Works great for buttons and switches

### Note On Messages

**What they are:**
- Triggered by piano keys or drum pads
- Include note number and velocity

**Example:** "C3 on Ch1"
- Note C in octave 3
- On MIDI Channel 1

**Audion behavior:**
- Any velocity > 0 triggers the command
- Works great for keyboard-style triggers
- Velocity value doesn't matter

## Integration Examples

### ProPresenter

ProPresenter can send MIDI commands via network or USB MIDI.

**Setup:**
1. In ProPresenter, create a MIDI cue
2. Set it to send a CC message (e.g., CC64 value 127)
3. Place cue at service start
4. Create another cue with different CC for service end
5. Learn these commands in Audion

**Workflow:**
- ProPresenter triggers cue at service start → Stream begins
- ProPresenter triggers cue at service end → Stream stops
- Completely automated!

### Lighting Console

Most lighting consoles can output MIDI.

**Setup:**
1. Configure your console to send MIDI
2. Connect via MIDI cable or network MIDI
3. Create a cue that sends a MIDI command
4. Learn the command in Audion

**Use case:**
- Link streaming start with house lights down
- Stop streaming when service ends
- Integrate with existing show flow

### MIDI Foot Controller

Use a foot pedal to control streaming hands-free.

**Setup:**
1. Connect foot controller via USB
2. Learn the commands from the pedals
3. Place controller near your audio position

**Benefits:**
- Hands-free operation
- Instant control during service
- No computer access needed

### MIDI Controller/Keyboard

Any MIDI keyboard or pad controller works.

**Setup:**
1. Connect via USB or Bluetooth
2. Learn specific keys or pads
3. Label them for easy reference

**Tip:** Use keys/pads at opposite ends to avoid accidental triggers.

### Virtual MIDI (DAW Integration)

Trigger Audion from music production software.

**Setup:**
1. Create virtual MIDI port (Audio MIDI Setup)
2. Configure your DAW to output MIDI
3. Select virtual port in Audion
4. Learn commands from your DAW

**Use case:**
- Integrate with Ableton Live sets
- Sync with backing tracks
- Advanced automation workflows

## Troubleshooting MIDI

### Device Not Appearing

**Check:**
- Is device connected and powered on?
- Try different USB port
- Restart Audion
- Check Audio MIDI Setup app (Applications → Utilities)

**For Bluetooth MIDI:**
- Open Audio MIDI Setup
- Window → Show MIDI Studio
- Click Bluetooth icon to pair device

### Commands Not Working

**Verify:**
1. MIDI is enabled in Preferences
2. Correct device is selected
3. Commands were learned correctly
4. Device is sending MIDI (check MIDI monitor)

**Test:**
- Click "Clear" and re-learn the command
- Try a different control on your device
- Verify device is actually sending MIDI

### Wrong Command Triggers

**Problem:** Different control activates the stream

**Solution:**
- Clear all learned commands
- Be deliberate when learning new commands
- Use controls that are far apart on your controller
- Check for duplicate CC numbers on your device

### Intermittent Response

**Causes:**
- Wireless interference (Bluetooth)
- Low batteries in wireless devices
- USB hub power issues
- Network latency (network MIDI)

**Solutions:**
- Use wired connection if possible
- Replace batteries
- Connect directly to Mac
- Reduce network MIDI latency

## Advanced MIDI Topics

### MIDI Channels

Audion respects MIDI channels:
- Commands on Channel 1 won't trigger commands learned on Channel 2
- Use channels to separate different controllers
- Most devices default to Channel 1

### CC Value Threshold

For Control Change messages:
- Values 64-127 (halfway up) trigger the command
- Values 0-63 are ignored
- This prevents accidental triggers from analog faders

### Multiple Controllers

You can only select one MIDI device at a time. To use multiple:

**Option 1:** MIDI merger
- Use a MIDI merger device
- Combines multiple MIDI sources
- Audion sees one unified device

**Option 2:** Virtual MIDI
- Create virtual MIDI port
- Route multiple devices to it
- Select virtual port in Audion

### Network MIDI (RTP-MIDI)

macOS includes network MIDI support:

**Setup:**
1. Open Audio MIDI Setup
2. Window → Show MIDI Studio
3. Double-click "Network" icon
4. Add session and connect devices
5. Select in Audion

**Use cases:**
- Control from iPad/iPhone apps
- Wireless MIDI from another Mac
- Cross-room MIDI without cables

## MIDI Command Reference

### Common CC Numbers

These are standard, but your device may vary:

- **CC 1:** Modulation wheel
- **CC 7:** Volume
- **CC 10:** Pan
- **CC 11:** Expression
- **CC 64:** Sustain pedal
- **CC 80-83:** General purpose
- **CC 102-119:** Unassigned (good for custom use)

### Choosing CC Numbers

**Best practice:**
- Use unused CC numbers (80+)
- Avoid CC 1, 7, 10, 11, 64 (common uses)
- Document what you're using
- Configure in your MIDI device if possible

## Best Practices

✅ **Do:**
- Test commands before services
- Label physical controls on your device
- Document your MIDI setup
- Keep Audion MIDI preferences backed up
- Train multiple people on the system

❌ **Don't:**
- Use same control for start and stop
- Forget to save after making changes
- Change MIDI setup minutes before service
- Use controls you might hit accidentally
- Rely solely on MIDI (have manual backup)

## Workflow Examples

### Basic Church Service

**Equipment:** USB MIDI controller with buttons

**Setup:**
- Button 1 → Start streaming
- Button 2 → Stop streaming
- Place controller at audio booth

**Operation:**
1. Sound tech presses Button 1 when service starts
2. Stream begins automatically
3. Press Button 2 when service ends

### Automated with ProPresenter

**Equipment:** Mac running ProPresenter + Audion

**Setup:**
- First slide MIDI cue → Start stream
- Last slide MIDI cue → Stop stream
- Network MIDI or USB MIDI loopback

**Operation:**
- Presentation operator advances slides normally
- Streaming starts/stops automatically
- Zero extra steps required

### Complex Production

**Equipment:** Lighting console + MIDI interface + Audion

**Setup:**
- Lighting Cue 1 → Start stream
- Lighting Cue 100 → Stop stream
- DMX console sends MIDI via interface

**Operation:**
- Technical director runs show
- Lighting cues trigger streaming
- Fully integrated with show control

---

**Next Steps:** Learn about [Audio Setup](audio-setup.md) or read [Troubleshooting](troubleshooting.md) tips.
