Hughes Industries

Setting Up a Linux Laptop for Audio/Music Production in 2020

A guide from Hughes Industries Ltd.

To setup a similar project see this git repo

Introduction (why bother?)

Running "professional" audio software and integrating a computing environment with analog equipment generally means using Mac or Windows. Hughes Industries prefers FOSS and POSIX environments and also favours reproducible (or ephemeral) computing environments, i.e. creating a "fresh" environment should be quick and reliable.

Problems audio developers have experienced as a side effect of the Catalina MacOS update may also lead more musicians and audio professionals to look at Linux as an alternative platform.

Rough notes:

        - macOS catalina update
          - no control over environment
          - had to get back to "last known good state"
          - I'd like a the ability to recover a snapshot
          - had similar trouble when a macbook pro died
          - separate hardware, data and software
          - the right level of abstraction
            - I want a stable "black box" while I'm making music
            - I want a toolkit for constructing these "black boxes"
            - when I climb the ladder, into the black box, I want to
              forget (or kick away) the ladder
            - https://en.wikipedia.org/wiki/Wittgenstein%27s_ladder
        - Don't let yourself get attached to anything you are not
          willing to walk out on in 30 seconds flat if you feel the
          heat around the corner.
        - devOps
        - freedom and ownership
        - cost
        - interest
        - business
          - audio damage
          - air windows
        - creative options
          - audio over IP (dante alternative)
          - audio in container (audio tools over the web)
            custom dub plates
      

Hardware

The following kit list was used for testing:

      - thinkpad x270
      - lenovo usbc hub
      - roland rubix 2i2
      - asus external monitor
      - yamaha hs8 monitors
      - guitar
      - synth
        - pulse 2
          - midi
        - reface dx
          - midi
      - controller
        - keylab
          - reaper
            - try buit in reaper mode
            - http://www.mossgrabers.de/Software/Reaper/Reaper.html
              uses/allows MCU so might allow using one mopde to allow
              compatibility with renoise
          - renoise
            - duplex https://github.com/Aisjam/Renoise/tree/master/Duplex/Controllers/Arturia_Keylab_Mkii_61
            - https://www.renoise.com/tools/arturia-keylab-mkii
      

Software

After trialing a few of the "media and audio" tailored distributions we concluded that they were very large and unfamiliar. The preference is to have as small a base system as possible and only add the essentials. Adding components incrementally and monitoring their effects on the whole over time. While interested in NixOS (something for a future investigation) we opted for Manjaro Linux. Hoping to strike a balance between getting up an running quickly (drivers and desktop environments ready to go) and including only the bare essentials on which to build a "simple" and easy to understand system.

The test environment aimed to get as close to a "typical" Mac based audio setup. These are some of the considerations:

      # basics
      os: manjaro linux with xfce
        realtime capabe kernel
      routing:
        jack
        pulse audio
        alsa
      DAWs
        renoise
        reaper
      # Plugins

      ## To Try

      - u-he
      - Audio Damage
      - https://venomode.com/plugins
      - https://github.com/pdesaulniers/wolf-spectrum
      - https://github.com/pdesaulniers/wolf-shaper
      - https://vcvrack.com/
      - https://libremusicproduction.com/tools.html
      - http://linux-sound.org/linux-vst-plugins.html
      - https://lsp-plug.in/
      - http://calf-studio-gear.org/
        seem to be a bit like neutron
      - https://github.com/x42/fil4.lv2
      - http://eq10q.sourceforge.net/
      - https://oxesoft.wordpress.com/ (https://www.youtube.com/watch?v=6YQVKhY0YZ0)
      - https://x42-plugins.com/x42/
        - https://github.com/x42/meters.lv2)
      - http://openavproductions.com/sorcer/
      - http://www.zamaudio.com/
      - http://jamin.sourceforge.net/en/about.html

      ## Approved

      - Airwindows
      

Method

These are the setup notes:

      # Manjaro Linux

      Using xfce as desktop.

      X270 needed secure boot disabling in the BIOS (enter, F1, security,
      secure boot, disabled, F10)

      Enabled swap with hibernate (to persist RAM on hibernation)

      Switch kernel:

      - Manjaro Settings Manager (not Settings Manager!)
      - default 5.2.21-1 should be fine

      Setup:
      ```
      # install some tools
      sudo pacman -Syu vim qjackctl cadence realtime-privileges pulseaudio-jack exfat-utils

      # setup user
      sudo usermod -a -G realtime rudenoise
      # test
      groups rudenoise

      # ensure group has realtime priority
      cat /etc/security/limits.d/99-realtime-privilages.conf
      # sould see
      # @realtime - rtprio 98

      # stop pulse audio
      pulseaudio --kill

      # reaper needs a bridge from alsa midi to jack
      sudo pacman -S a2jmidid
      # Add as post startup script
      a2jmidid -e &
      # jack must be up first
      # then kill
      # pkill a2jmidid
      # HOW TO AUTO LAUNCH WITH JACK?
      # add jackctl > setup > options > execute scruipt after startup
      # /usr/bin/a2jmidid -e &
      # add jackctl > setup > options > execute script on shutdown
      # /usr/bin/killall  a2jmidid

      # add the following to qjackctl > setup > settings > advanced > server prefix
      # to suspend pulseaudio while jack is running
      pasuspender -- jackd

      # qjackctl creates the following ~/.jackdrc file (clients will
      # automatically call this file to start jack
      # /usr/bin/paususpender -- jackd -v t1000 -dalsa -dhw:Rubix22 -r96000 -p128 -n2
      # yeilds < 2.5ms latency @ 96khz
      # other flags to set (https://linux.die.net/man/1/jackd)
      # --realtime/-R (default true)
      # -n3 # apparently preferred for USB
      # -T # auto shutdown when client exits
      

Latency

A worry users planning to record and monitor live instruments and vocals would be latency. The delay introduced as the signal passes through the ADC, digital processing and back out through the ADC. "Class Compliant" audio interfaces are easily coupled with Linux environments but it is interesting to see how well they can perform:

As this setup used Jack as the defualt method for routing audio through the system jack_delay_ was used to measure the time to send a signal from the audio-interface outputs back into the inputs (connecting the left out channel directly to the left input channel).

      ```
      # attempt to measure latency: https://wiki.linuxaudio.org/wiki/jack_latency_tests
      # http://kokkinizita.linuxaudio.org/linuxaudio/downloads/index.html jack_delay-0.4.2.tar.bz2 (11k)
      tar -xjf jack_delay-0.4.2.tar.bz2
      cd jack_delay/source
      make
      ./jack_delay

      96k,    64 frames,  3 buff -> claims 2      -> actual 5.103 ms  - ALMOST
      96k,    128 frames, 3 buff -> claims 4      -> actual 9.728 ms  - GOOD
      96k,    256 frames, 3 buff -> claims 8      -> actual 18.613 ms - GOOD

      96k,    64 frames,  2 buff -> claims 1.33   -> actual 3.561 ms  - GLITCH
      96k,    128 frames, 2 buff -> claims 2.67   -> actual 6.145 ms  - ALMOST good if dropped from 256
      96k,    256 frames, 2 buff -> claims 5.33   -> actual 12.197 ms - GOOD


      48k,    32 frames,  3 buff -> claims 2      -> actual 5.641 ms  - ALMOST
      48k,    64 frames,  3 buff -> claims 4      -> actual 9.808 ms  - GOOD
      48k,    128 frames, 3 buff -> claims 8      -> actual 19.766 ms - GOOD


      48k,    32 frames,  2 buff -> claims 1.33   -> actual 4.224 ms  - GLITCH
      48k,    64 frames,  2 buff -> claims 2.67   -> actual 7.203 ms  - GOOD/ALMOST
      48k,    128 frames, 2 buff -> claims 5.33   -> actual 13.349 ms - GOOD

      # interesting aside https://www.soundonsound.com/techniques/optimising-latency-pc-audio-interface
      # vocal monitoring < 3ms
      # drummer < 6ms
      # guitars < 12ms
      # keyboards < 6ms

      # other thoughts:
      # when not recording audio (using the device DAC only) can it be clocked faster?

      ```
      

Comparison

Is it good? Yes.

Is it cheaper than Mac? Yes.

Is the ecosystem comparable to Mac? Not really. More configurable and controlled, much smaller ecosystem and requirement to know the details.

Is it the default general purpose audio environment Hughes Industries recommends? Not yet...

Conclusions

Further investigation needed. Assuming users can find the software they prefer for the platform and are able to make the configurations themselves, then it's worth experimenting with.