Installation on Linux - pavhofman/nonlinear-compensation GitHub Wiki

Installation For Octave 5.2 on Linux Ubuntu 20.04

The Measurement Chain

The measurement chain will have the following structure: REW/Arta -> rew_loop [->] octave_loop -> mainPlay.m -> your soundcard playback -> DUT/calibration adapter -> your soundcard capture -> mainRec.m -> octave_loop [->] rew_loop -> REW/Arta

Installing Required Octave Packages

  • Install required octave packages for the compensation.
sudo apt-get install  octave octave-general octave-struct octave-control octave-miscellaneous octave-zeromq octave-io octave-statistics octave-optim octave-instrument-control octave-database

Configuring REW Loopback

  • Load snd-aloop module
sudo modprobe snd-aloop
  • Load the module permanently
sudo bash -c "echo snd-aloop >> /etc/modules-load.d/modules.conf"

Naming Loop Devices

  • Create local alsa config ~/.asoundrc
cat > ~/.asoundrc <<'_EOF'
pcm.octave_loop {
  type hw
  card "Loopback"
  device 0
  format S32_LE
  channels 2
}

pcm.rew_loop {
  type hw
  card "Loopback"
  device 1
  format S32_LE
  channels 2
}
_EOF

Disabling the Needed Sound Devices in Pulseaudio

Pulseaudio (PA) is very greedy and acquires (keeps open) any soundcard (including loopback cards) it finds. It does it randomly, causing weird complications. Fortunately PA can be told to ignore any soundcard.

  • Open the PA config screen (right-click on the speaker icon -> Settings or run pavucontrol (sudo aptitude install pavucontrol)
  • -> Hardware tab -> for your soundcard and the loopback cards set "Off" (or "Disable", always the last item of the selection).

Installing & Configuring REW

  • Installing JDK8
sudo apt-get install openjdk-8-jre
  • Download REW (preferrably the BETA version), install (check OpenGL support), run

Optional - Installing & Configuring Wine & Arta

  • Arta requires windows emulation layer Wine
  • Default wine configuration uses pulseaudio -> change to alsa
  • Default alsa driver offers only soundcards, no PCM devices -> configure register entries (for details see Wine Alsa Configuration)
sudo apt-get install winehq-stable winetricks
winetricks sound=alsa
wine reg ADD 'HKCU\Software\Wine\Drivers\winealsa.drv' /v ALSAOutputDevices /t REG_MULTI_SZ /d rew_loop
wine reg ADD 'HKCU\Software\Wine\Drivers\winealsa.drv' /v ALSAInputDevices /t REG_MULTI_SZ /d rew_loop

Installing, Configuring, and Checking Arta

Download Arta from Arta download page and run the installer in wine

cd ~
wget http://www.artalabs.hr/download/ArtaSetup192.exe
wine ArtaSetup192.exe
  • Run Arta from main menu
  • Check Arta with your soundcard: select your device for playback/capture, connect analog loop, start Arta generator and check arta spectrum
  • Setup your soundcard playback/capture levels and playback/capture ports (key 'M' (un)mutes, 'space' selects inputs):
alsamixer -c YOUR_CARD_ALSA_ID
  • When the soundcard is correctly configured, switch Arta devices to In: arta_loop, Out: arta_loop

Installing & Configuring the Compensation Tool

  • Clone github repo, copy compiled playrec.mex to the octave directory:
cd ~/work
git clone --recurse-submodules https://github.com/pavhofman/nonlinear-compensation.git
cp ~/work/playrec/playrec.mex ~/work/nonlinear-compensation/octave/

Configuring the Tool

  • Find Out Playrec IDs of Sound Devices:
cd ~/work/nonlinear-compensation/octave
octave mainListPlayrecDevs.m
  • From the list take name of your HW soundcard and enter it into the config files copied from examples. The example config options are explained in their comments. In most cases the soundcard name will be the same for each direction, just swapped.

  • Note: xed is graphical Mint Mate editor, use any editor you like.

cd ~/work/nonlinear-compensation/conf
cp configRec.conf.example configRec.conf
cp configPlay.conf.example configPlay.conf

Running the Tool

~/work/nonlinear-compensation/bin/start.sh