Audio Through USB

From MOD Wiki
Jump to navigation Jump to search

Using netJACK2

NOTE: This requires the use of JACK as sound server in your PC.

First, connect the MOD unit to your PC via usb cable. Make sure to open port 19000 on your firewall. If you use Linux with ufw, you can use:

sudo ufw allow 19000

Then, ssh into the unit, and run:

touch /data/enable-netmanager
systemctl start jack-netmanager

NOTE: You only need to run this command once. The next the unit boots, jack-netmanager will be loaded by default. Delete the /data/enable-netmanager file inside the unit to remove this auto-start feature.

Now run jackd on your own computer (connected to the unit via USB), like this:

jackd -R -P 80 -d net -a 192.168.51.1 -C 2 -P 2 -i 1 -o 1 -l 4 -n mod-slave -s

Adjust the parameters as needed, but keep mod-slave as the client name.

Parameters explained

-R Use realtime scheduling, enabled by default.
-P Set the realtime scheduling priority, in this case 80.
-d JACK backend, in this case the "net" driver.
-a Multicast address, in this case the IP address of the MOD unit.
-C Number of audio input ports on the slave. This determines the number of audio output ports on the MOD unit, marked as "Hardware Audio To Slave" ports in the web interface.
-P Number of audio output ports on the slave. This determines the number of audio input ports on the MOD unit, marked as "Hardware Audio From Slave" ports in the web interface.
-i Number of MIDI input ports on the slave. This determines the number of MIDI output ports on the MOD unit, marked as "Hardware Midi To Slave" ports in the web interface.
-o Number of MIDI output ports on the slave. This determines the number of MIDI input ports on the MOD unit, marked as "Hardware Midi From Slave" ports in the web interface.
-l Number of cycles, determines the network latency.
-s Setting this option makes the JACK slave memorize the ports that are connected to the JACK master. In case the master disappears and reappears the JACK slave will try to reconnect those ports automatically.

or if you prefer to use jackdbus:

jack_control eps realtime true eps realtime-priority 80
jack_control ds net dps multicast-ip 192.168.51.1 dps client-name mod-slave
jack_control dps input-ports 2
jack_control dps output-ports 2
jack_control dps midi-in-ports 1
jack_control dps midi-out-ports 1
jack_control dps latency 4
jack_control dps auto-save true
jack_control start

Using USB Audio Gadget

NOTE: This requires v1.10 or later.

NOTE: This is EXPERIMENTAL

First ssh into the unit, and run:

touch /data/enable-usb-multi-gadget
touch /data/enable-usb-audio-gadget
# if using windows, also run:
touch /data/enable-usb-windows-compat

Now we reboot

sync && hmi-reset && reboot

Some caveats and known issues:

  • USB audio requires very precise timings, loading big resources on the web interface over USB can lead to audio dropouts (best results are achieved with web interface over WiFi, leaving USB for audio and MIDI)
  • De-sync of USB packets will pause the audio (either capture or playback) for 10 seconds
  • MOD Duo works 100%
  • MOD Duo X "limited edition" only works in capture mode
  • MOD Duo X "production units" work well most of the time, with occasional playback sync issues
  • MOD Dwarf has issues with playback, but capture works well
  • For use in Windows, an up-to-date Windows 10 is required