OSC Control

mtrack supports Open Sound Control (OSC) for remote control and status reporting, making it easy to integrate with OSC-capable controllers and software.

Configuration

Enable the OSC server in your mtrack.yaml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
controllers:
  - kind: osc
    port: 43235  # Optional, defaults to 43235
    broadcast_addresses:
      - 127.0.0.1:43236
    
    # Player control events (optional, defaults shown)
    play: /mtrack/play
    prev: /mtrack/prev
    next: /mtrack/next
    stop: /mtrack/stop
    all_songs: /mtrack/all_songs
    playlist: /mtrack/playlist
    
    # Status reporting events (optional, defaults shown)
    status: /mtrack/status
    playlist_current: /mtrack/playlist/current
    playlist_current_song: /mtrack/playlist/current_song
    playlist_current_song_elapsed: /mtrack/playlist/current_song/elapsed

Control Events

Send OSC messages to control the player. All control events require no arguments.

Play

Start playback:

/mtrack/play

Stop

Stop playback:

/mtrack/stop

Previous

Navigate to previous song:

/mtrack/prev

Next

Navigate to next song:

/mtrack/next

All Songs

Switch to all songs playlist:

/mtrack/all_songs

Playlist

Switch to defined playlist:

/mtrack/playlist

Status Events

mtrack broadcasts status information to the configured broadcast addresses.

Status

Current player status (stopped/playing) and elapsed time:

/mtrack/status "stopped" or "playing 1:23.456 / 4:14.000"

Current Playlist

The entire current playlist:

/mtrack/playlist/current "Song1, Song2, Song3, ..."

Current Song

The song the playlist is currently pointing to:

/mtrack/playlist/current_song "Song Name"

Elapsed Time

Time elapsed and total duration:

/mtrack/playlist/current_song/elapsed "1:23.456 / 4:14.000"

Custom OSC Addresses

You can customize all OSC addresses in your configuration:

1
2
3
4
5
6
controllers:
  - kind: osc
    port: 43235
    play: /custom/play
    stop: /custom/stop
    # ... etc

TouchOSC Integration

A starting TouchOSC file has been provided in the mtrack repository. You can use this as a template for creating your own TouchOSC interface.

Use Cases

Mobile Control

Use an OSC app on your phone to control mtrack remotely.

Integration with DAWs

Some DAWs support OSC, allowing you to trigger mtrack from your recording software.

Custom Controllers

Build custom control interfaces using OSC-capable hardware or software.

Example: Using oscsend

Control mtrack from the command line using oscsend (from liblo-tools):

1
2
3
4
5
6
7
8
# Play
oscsend 127.0.0.1 43235 /mtrack/play

# Stop
oscsend 127.0.0.1 43235 /mtrack/stop

# Next song
oscsend 127.0.0.1 43235 /mtrack/next

Example: Python OSC Client

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from pythonosc import udp_client

client = udp_client.SimpleUDPClient("127.0.0.1", 43235)

# Play
client.send_message("/mtrack/play", [])

# Stop
client.send_message("/mtrack/stop", [])

# Next
client.send_message("/mtrack/next", [])