Sunday 7 October 2012

Problem starting Overtone on Ubuntu Studio 12.04.

I recently tried installing a fresh copy of Ubuntu Studio 12.04 on my HP Pavilion dm1 4200sg netbook. Once I setup my system for using Clojure with Overtone, I found that I couldn't run Overtone. Typing the following in the REPL:
  (use 'overtone.live)
would fail with the error:
*** ERROR: dlsym load err '/home/richard/dev/overtone/target/native/linux/x86_64/libscsynth.so: undefined symbol: load'

The problem was that JACK server was not starting correctly. To test this, typing  
$> jackd -R -d alsa
would give the following error.

The netbook had multiple sound devices, and the default that was being chosen by JACK was at position 0. Listing the devices by typing $> aplay -l
gave the following output:  
**** List of PLAYBACK Hardware Devices **** 
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0] 
  Subdevices: 1/1 
  Subdevice #0: subdevice #0 
card 1: SB [HDA ATI SB], device 0: STAC92xx Analog [STAC92xx Analog] 
  Subdevices: 1/1 
  Subdevice #0: subdevice #0

JACK started correctly when using the soundcard at position 1: $> jackd -R -d alsa -d hw:1

Thus, I needed to reorder the soundcards so that the working one was loaded into position 0. This required knowing which modules the soundcards used. To do this I entered the following into the terminal:
$> sudo lshw -c multimedia

The output indicated that each soundcard was using the same module. In particular, each multimedia device had the line:
configuration: driver=snd_hda_intel latency=0

This means the module being used is 'snd-hda-intel'. So in order to distinguish between the soundcards, I needed to know IDs for each of them. To get these I typed the following at the terminal:
$> cat /proc/asound/card0/id
$> cat /proc/asound/card1/id


The output for each command was a single line giving the ID of the device. card0 had ID="Generic" and card1 had ID="SB".

Finally, I had all the information I needed. To change the ordering of the cards on loadup, I edited the file '/etc/modprobe.d/alsa-base.conf' to append the following two lines:
options snd-hda-intel id=SB index=0
options snd-hda-intel id=Generic index=1


This instructs the system to place the card with ID="SB" that uses the module snd-hda-intel at position 0. Similarly, the card with ID="Generic" using snd-hda-intel should be placed at position 1. 

A system reboot is required to force the changes to take effect.

Now, rerunning the command
$> aplay -l
gives the following output:  
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: STAC92xx Analog [STAC92xx Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


Which gives the required effect of reversing the order with which the soundcards were loaded.

The command
$> jackd -R -d alsa
now ran without any problems and so did Overtone!