Difference between revisions of "Audio Through USB"

From MOD Wiki
Jump to navigation Jump to search
 
(57 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Using JACK2 net ==
 
  
first connect the mod via usb cable to the PC.
+
== Using USB Audio Gadget ==
start JACK2 on your PC.
 
  
note down the IP assigned to your PC by the MOD.
+
'''NOTE: For best results please use v1.14 or later'''
on linux this can be done by using:
 
<source lang="bash">
 
ifconfig -a | grep "192.168.51." | awk 'sub("addr:","")' | awk '{print $2}'
 
</source>
 
  
note this value, we'll be referencing it as 'XYZ'.
+
'''NOTE: This is EXPERIMENTAL'''
  
make sure to open port 19000 on your linux firewall. if you have ufw you can use:
+
First [[Access_MOD_using_SSH|ssh into the unit]], and run:
<source lang="bash">
 
sudo ufw allow 19000
 
</source>
 
  
With that setup, load jack2 netmanager client, by running on your PC:
+
<pre>
<source lang="bash">
+
touch /data/enable-usb-multi-gadget
jack_load netmanager -i "-a 192.168.51.XYZ"
+
touch /data/enable-usb-audio-gadget
</source>
+
# if using windows, also run:
 +
touch /data/enable-usb-windows-compat
 +
</pre>
  
then ssh into the mod, and run:
+
Now we reboot
<source lang="bash">
+
<pre>
systemctl stop jack2 mod-host mod-peakmeter ttymidi mod-ui
+
sync && hmi-reset && reboot
jackd -R -P 80 -d net -a 192.168.51.XYZ -C 2 -P 2 -i 0 -o 0 -l 9 -n mod-duo
+
</pre>
</source>
 
  
open another ssh window, and run:
+
Some caveats and known issues:
<source lang="bash">
+
 
jack_load mod-host
+
* Only 48000 Hz sample rate is supported (this is intentional, matches the internal sample rate of the unit)
jack_load mod-peakmeter
+
* 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)
jack_load ttymidi -i "/dev/ttyS2"
+
* MOD Duo X "limited edition" only works in capture mode
mod-ui.run
+
* For use in Windows, an up-to-date Windows 10 or later is required
</source>
+
 
 +
Forum Threads:
 +
 
 +
* https://forum.moddevices.com/t/duo-x-as-usb-audio-input-and-midi-device-experimental/3469
 +
* https://forum.moddevices.com/t/solved-usb-audio-jack-with-pipewire-on-linux-how-to-mod-duo/7723/7
 +
 
 +
=== Windows specific tweaks ===
 +
 
 +
When picking an audio driver/mode look for "WASAPI" or "Windows Audio".<br>
 +
If there is an option for "exclusive mode" try that first; it won't allow other applications to use the usb audio device at the same time but it reduces the amount of latency.
 +
 
 +
Under this WASAPI/Windows-Audio mode with 512 buffer size we have measured roundtrip latencies of around 80ms in normal/shared mode, and 60ms in exclusive mode.<br>
 +
When exclusive mode is selected we were able to reduce buffer size to 256, giving a roundtrip latency of around 38ms.
 +
 
 +
Note that latency decreases if you use the MOD unit analog IO, as the analog IO has a full roundtrip latency of 8ms.<br>
 +
There is extra buffering for handling the USB audio card in software, which is needed in order to keep everything in sync between the MOD unit main audio interface and the USB audio side.
 +
 
 +
==== ASIO4ALL ====
 +
 
 +
Using ASIO4ALL has been confirmed to work, but needs some tweaks:
 +
 
 +
* Set buffer size to 128 or higher
 +
* In advanced settings set buffer offset to 16ms
 +
* Turn off all other options in advanced settings
 +
 
 +
This should result in around 60ms total roundtrip latency, will be less if you use the MOD unit analog IO.
 +
 
 +
==== FL Studio ASIO ====
 +
 
 +
The FL Studio ASIO driver has also been confirmed to work, no special tweaks needed.<br>
 +
Its minimum buffer size of 256 should work fine as-is.
 +
 
 +
In our measurements it gives a total roundtrip latency of around 75ms, will be less if you use the MOD unit analog IO.
 +
 
 +
== Using netJACK2 ==
 +
 
 +
'''NOTE: This requires the use of JACK as sound server in your PC.'''
 +
 
 +
See [[Audio Through NetJack2]]

Latest revision as of 10:11, 26 July 2023

Using USB Audio Gadget

NOTE: For best results please use v1.14 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:

  • Only 48000 Hz sample rate is supported (this is intentional, matches the internal sample rate of the unit)
  • 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)
  • MOD Duo X "limited edition" only works in capture mode
  • For use in Windows, an up-to-date Windows 10 or later is required

Forum Threads:

Windows specific tweaks

When picking an audio driver/mode look for "WASAPI" or "Windows Audio".
If there is an option for "exclusive mode" try that first; it won't allow other applications to use the usb audio device at the same time but it reduces the amount of latency.

Under this WASAPI/Windows-Audio mode with 512 buffer size we have measured roundtrip latencies of around 80ms in normal/shared mode, and 60ms in exclusive mode.
When exclusive mode is selected we were able to reduce buffer size to 256, giving a roundtrip latency of around 38ms.

Note that latency decreases if you use the MOD unit analog IO, as the analog IO has a full roundtrip latency of 8ms.
There is extra buffering for handling the USB audio card in software, which is needed in order to keep everything in sync between the MOD unit main audio interface and the USB audio side.

ASIO4ALL

Using ASIO4ALL has been confirmed to work, but needs some tweaks:

  • Set buffer size to 128 or higher
  • In advanced settings set buffer offset to 16ms
  • Turn off all other options in advanced settings

This should result in around 60ms total roundtrip latency, will be less if you use the MOD unit analog IO.

FL Studio ASIO

The FL Studio ASIO driver has also been confirmed to work, no special tweaks needed.
Its minimum buffer size of 256 should work fine as-is.

In our measurements it gives a total roundtrip latency of around 75ms, will be less if you use the MOD unit analog IO.

Using netJACK2

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

See Audio Through NetJack2