ECE497 Notes on Ubuntu and Audio Cape

From eLinux.org
Revision as of 02:34, 21 February 2013 by Mmoravec (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To install Ubuntu on the BeagleBone follow the instructions at http://elinux.org/BeagleBoardUbuntu

In Ubuntu, to get ALSA to work with the BeagleBone Audio cape, the following modules should be specified in '/etc/modules'

 snd_soc_tlv320aic3x
 snd_soc_davinci
 snd_soc_davinci_mcasp
 snd_soc_evm

You can test the audio by running `speaker-test`. Also running `aplay -l` will show a list of available sound cards. If the sound card is not shown, run `lsmod` and `dmesg` and make sure the kernel modules above have loaded without errors.

Rakarrack is a very nice open source audio effects processor that looks just like a guitar pedalboard. It uses the Jack Audio Connection Kit to stream audio allowing for realtime audio effects

Start by installing jackd2. This requires a patch for the current version (1.9.10) on ARM (see http://jack-audio.10948.n7.nabble.com/Jack-Devel-jack2-on-ARM-patch-td15962.html). Run the recipe found at that page (copied below with a couple modifications).

 wget http://jack-audio.10948.n7.nabble.com/attachment/15962/0/jack2_armel.diff
 apt-get source jackd2
 cd jackd2-1.9.8~dfsg.4+20120529git007cdc37 
 patch -p1 -i ../jack2_armel.diff 
 dpkg-buildpackage -rfakeroot -uc -b 
 cd .. 
 sudo dpkg -i libjack-jackd2-0_1.9.8~dfsg.4+20120529git007cdc37-2ubuntu1_armhf.deb jackd2_1.9.8~dfsg.4+20120529git007cdc37-2ubuntu1_armhf.deb

Then install Rakarrack by running the following:

 sudo apt-get install rakarrack
 

The installation should install jackd as a dependency. To check the installed jack packages run the following:

 dpkg --get-selections | grep jack
 

You should see something like this:

 ubuntu@arm:~$ dpkg --get-selections | grep jack
 jack                                            deinstall
 jackd                                           install
 jackd1                                          deinstall
 jackd2                                          install
 libjack-jackd2-0:armhf                          install
 libjack0:armhf                                  deinstall
 qjackctl                                        deinstall

Now you should be able to run the rakarrack GUI. Use `ssh -X ubuntu@192.168.0.XXX` to connect to the BeagleBone with X11 forwarding and then run `rakarrack`. The program should be able to find jackd by itself. If not try killing the jack processes and restart rakarrack. One way to do this is run `ps -AL | grep jack`, and then run `kill -9` with the pid number.

If you have problems with jackd not running you can try running in manually (make sure it is not running in the background first). Run `jackd -d alsa` and the output should look somethings like the following:

ubuntu@arm:/etc$ jackd -d alsa
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2013 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit
control device hw:0
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 16 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 16 periods for playback

When Rakarrack opens, it may warn you that your CPU is not fast enough to run some of the audio effects (e.g. convolutron). See (http://forums.fedoraforum.org/archive/index.php/t-254181.html) for some tips on mitigating performance problems. If you crash jackd, you can easily kill its processes as shown above and restart Rakarrack (there is no need to reboot or anything).

Some things to improve performance (a bit...)

Increase clock speed of BeagleBone by running the following:

 sudo cpufreq-set -f 720MHz
 sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
 

The output of that last command should be '720000'

Also in Rakarrack go to 'Settings->Preferences->Audio' and lower all the downsample settings to '4000' and the up to 'Fastest'

With these settings, I was able to get the Expander, Sustainer, Looper, and Dual Flange to work without crasing jackd