Rassberry Pi and Jack audio


54 posts   Page 1 of 3   1, 2, 3
by aidded » Sat May 12, 2012 6:26 pm
Hi

I was thinking of making a Rassberry Pi D.A.W. (Digital Audio Worksation) the only problem is i cant seem to find any software i like , so i decided to make my own as a programming project

Would it be possible to use JACK Audio Connection Kit ( jackaudio.org ) to interface with the real world

Thanks
Posts: 3
Joined: Fri Mar 30, 2012 6:32 pm
by error404 » Sun May 13, 2012 7:36 pm
Have you tried Ardour? It's pretty complete and you'll have to work for some years to even think about competing with it...

JACK should work on the Pi, though you will obviously also need a proper audio interface. Also the Pi is probably too slow for DAW work.
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm
by jannis » Mon May 14, 2012 6:44 am
jack-audio should run perfectly on the Pi but I agree with error404 that the Pi is wwaayyy to slow for a serious DAW
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by anwe79 » Thu Jun 28, 2012 10:44 am
I just got my pi yesterday and have started trying some audio stuff.
Alsa seems to work, although is still a bit glitchy (aplay is very noisy, alsaplayer works better but with some pops). I've tried getting jackd to run, but haven't got all the way yet. It starts, but doesn't seem to initialize properly.

I've fudged my x-session right now, so i'll start over from scratch soon, but it seems possible to run jackd. Maybe I should try jack and not jack2 which isn't really necessary on a pi. I know from experience jack can be very touchy about settings, eg. buffer/period size, so maybe some experimenting needs to be done...

Running a full blown daw is probably not a good idea, it will be very frustrating, but running something like netjack to capture should work.
Posts: 26
Joined: Sat Oct 08, 2011 10:30 pm
by jannis » Thu Jun 28, 2012 11:40 am
anwe79 wrote:I just got my pi yesterday and have started trying some audio stuff.
Alsa seems to work, although is still a bit glitchy (aplay is very noisy, alsaplayer works better but with some pops). I've tried getting jackd to run, but haven't got all the way yet. It starts, but doesn't seem to initialize properly.


jackd won't run on the Pi with the current driver since jackd tries to mmap the audio and exactly that operation is not supported by the alsa-driver for the BCM-sound part.
I tried to use an UBS-audio-interface (Edirol UA-101) but that also failed because the "USB driver doesn't have enough channels available"
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by anwe79 » Fri Jun 29, 2012 9:15 pm
Yep, i just learnt that the hard way :).
Tonight i set up a raspbian install and tried both jackd2 (which complains about not being able to lock memory) and jackd1 which gave me a more useful error about not being able to use mmap access.

So this is a no go with the built in sound and current driver.

@Jannis: Did you try the -i and -o switches?
I know jackd can be fussy about having the correct channel count of the hardware (at least with ffado/freebob backend).
I suppose an UA-101 should have 10 or 6 I/O depending on the sample rate setting.
Posts: 26
Joined: Sat Oct 08, 2011 10:30 pm
by jannis » Fri Jun 29, 2012 10:23 pm
anwe79 wrote:@Jannis: Did you try the -i and -o switches?
I know jackd can be fussy about having the correct channel count of the hardware (at least with ffado/freebob backend).
I suppose an UA-101 should have 10 or 6 I/O depending on the sample rate setting.


It's not jack's fault. It's the USB-driver so the device is not even accessible via ALSA.
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by anwe79 » Sat Jun 30, 2012 8:50 am
Ok, yeah i guess one of those would need special drivers to work, not a bog standard class-compliant device that one.

There is hope though, according to the link below, there is a working linux driver:
http://old.nabble.com/State-of-Edirol-UA-101---td28483748.html

I have no clue if that module is available in the distro you're using, but theoretically it could work.
Posts: 26
Joined: Sat Oct 08, 2011 10:30 pm
by jannis » Sat Jun 30, 2012 11:53 am
anwe79 wrote:Ok, yeah i guess one of those would need special drivers to work, not a bog standard class-compliant device that one.


It requires a driver but that is included in mainline linux. On my desktop and laptop it's working but the driver for the RPi's USB-host has a problem.
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by anwe79 » Tue Jul 03, 2012 11:04 pm
Well, i just wanted to let you know that i'm having trouble starting jackd even with a standard usb device.
I bought this cheap little sound dongle, and it works well with alsa, but not with jackd.

With jack2 i get:
Code: Select all
Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Bus error

I do have /etc/security/limits.d set up properly with no memory limit, so that's not the issue.
On jack1 i don't remember the error, but it also didn't work.
I've tried a few different period/buffer settings, but no go.

This is on a Raspbian install, i might try a soft float standard Debian tomorrow.

Does anyone have jackd running on any kind of sound hardware on a Pi?
Maybe it's a jackd/arm problem, i tried googling that a bit but couldn't find anything conclusive.
Posts: 26
Joined: Sat Oct 08, 2011 10:30 pm
by BigBeagle » Sun Jul 29, 2012 12:31 am
I've just tried to install jack and running jackd gives me the same error:

pi@raspberrypi /etc $ jackd -r -dalsa
jackdmp 1.9.9
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2012 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 non-realtime mode
Cannot lock down 82274202 byte memory area (Cannot allocate memory)
Bus error
Posts: 1
Joined: Sun Jul 29, 2012 12:30 am
by gallomimia » Sat Aug 11, 2012 11:21 am
I'd like to call your attention to the fact that your program is complaining about the fact that it cannot allocate 82 megabytes of ram for itself. Do you have 82 megabytes available? I suppose it should start swapping if not, but here we have a bus error instead. Maybe its requesting wired down memory pages? (Do modern kernels still do that?) Thats how this error reads to me. I'm still trying to learn more about jackd so I am by no means an expert, but does anyone else look at this error log and think "Not a program error"? Both the same amount of memory being requested by two users' error logs. Something's wrong with the environment, and you said you set the limits properly. What else can be a problem here? The only thing we can be sure of so far is that it doesn't work on the pi, but works fine on other hardware. Drivers that crash or just plain not enough ram? Try cranking the memsplit all the way to 240 and see if you get that error still?
Posts: 3
Joined: Sat Mar 03, 2012 4:59 am
by jannis » Sat Aug 11, 2012 11:58 am
I may repeat myself here, but it's not jack's fault:
jackd won't run on the Pi with the current driver since jackd tries to mmap the audio and exactly that operation is not supported by the alsa-driver for the BCM-sound part


When trying to "lock" memory using:
http://pyropus.ca/software/memtester
there is no problem at all (Since it doesn't try to mmap it):
rpi-dev ~ # memtester 100M
memtester version 4.3.0 (32-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffff000
want 100MB (104857600 bytes)
got 100MB (104857600 bytes), trying mlock ...locked.


Ah, and about the "Bus error": This is a little weird message posted by jack itself. Don't think about it in terms like "address bus" or "memory bus"-error. The wording might not be appropriate for that kind of error that occurs on the Pi.
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by yomguy » Fri Sep 14, 2012 2:58 pm
Hi!
I also have the same Bus error but managed to fix the memory lock pb.
So increase the /dev/shm size:
Code: Select all
$ sudo mount -o remount,size=128M /dev/shm

But I still get:
Code: Select all
pi@raspberrypi ~ $ jackd -v -P70 -dalsa -dhw:0 -r44100 -p512 -n2 -P
jackdmp 1.9.9
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2012 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 70
Jack: JackPosixThread::StartImp : create non RT thread
Jack: JackPosixThread::ThreadHandler : start
Jack: playback device hw:0
Jack: capture device hw:0
Jack: apparent rate = 44100
Jack: frames per period = 512
Jack: JackDriver::Open capture_driver_name = hw:0
Jack: JackDriver::Open playback_driver_name = hw:0
Jack: Check protocol client = 8 server = 8
Jack: JackEngine::ClientInternalOpen: name = system
Jack: JackEngine::AllocateRefNum ref = 0
Jack: JackPosixSemaphore::Allocate name = jack_sem.1000_default_system val = 0
Jack: JackEngine::NotifyAddClient: name = system
Bus error


;)
Posts: 1
Joined: Fri Sep 07, 2012 11:09 am
by jannis » Wed Oct 17, 2012 7:28 pm
Argh, I feel a little dumb right now since it took me so long to get this idea. I got jack-audio-connection-kit running on the RPi!
Here's how you do it:
- Install jack from "jack2"-branch (was jack-dmp) (for example jack-1.9.8)
- Run jack using the "dummy"-driver without realtime: "jackd -r -p 8 -d dummy". Channel count doesn't really matter since we won't be using them! We limit the ports to 8 to limit memory-usage but feel free to increase this value.
- Run alsa_out with lowest possible quality-setting (keep CPU-usage low): alsa_out -q 0 -v

That's about it! alsa_out will create two output-channels in jack that will be played back via ALSA to the RPi's analog jack or via HDMI. The only drawback is that you have to connect your client manually to the output-ports since they are not named "system:......."

I even went one step further and set-up a netjack-solution:
- Run jack2 on your desktop-pc/laptop
- Load the "netmanager" on your desktop/laptop: "jack_load netmanager"
Now on the Raspberry Pi:
- Run jack using the "net"-driver without realtime: "jackd -r -p 8 -d net -C 2 -P 0"
- Run alsa_out with lowest possible quality-setting (keep CPU-usage low): alsa_out -q 0 -v
- Connect the two channels coming from your "net master" (=desktop/laptop) to your ALSA-output:
jack_connect system:capture_1 alsa_out:playback_1
jack_connect system:capture_2 alsa_out:playback_2

Now you have two channels on your desktop/laptop that will be sent to your RPi via network and be played back there. Audio streaming the JACK way. More info about netjack2: http://trac.jackaudio.org/wiki/WalkThro ... r/NetJack2

If you experience XRUNs, try increasing the "frames/period" value on your "net master" machine. 256 frames/period do work quite well for me, 1024 is a pretty safe value.
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by Erwin » Wed Oct 17, 2012 8:24 pm
Did you change any other settings?
I am still getting the bus error if I try to start Jack with the dummy driver:

pi@raspberrypi ~ $ jackd -r -p 8 -d dummy
jackdmp 1.9.9
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2012 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 non-realtime mode
Cannot lock down 13318122 byte memory area (Cannot allocate memory)
Bus-Zugriffsfehler
Posts: 8
Joined: Fri Jul 13, 2012 12:49 pm
by jannis » Wed Oct 17, 2012 9:10 pm
I had that "cannot allocate memory" error when not using "-p 8" that's why I'm using it at all. But on my RPi, it doesn't try to lock that much memory ... Can you try with 4 ports?

Wait, it tries to allocate about 13MB of RAM and fails? That is strange. The only difference might be that I'm running Gentoo linux on my RPi and maybe some memory-related settings are different. I might investigate if I find the time
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by Erwin » Wed Oct 17, 2012 9:31 pm
I resolved the memory failure but still getting the bus error.

To fix the memory failure I did the following:

sudo dpkg-reconfigure -p high jackd2
and answer the question with "yes".
I answered "no" on this question during install.

I will try Gentoo the next days and see if this will solve the bus error.
I am running 2012-09-18-wheezy-raspbian on my Pi.
Posts: 8
Joined: Fri Jul 13, 2012 12:49 pm
by Erwin » Sat Oct 27, 2012 9:25 am
Jannis,

I tried Gentoo and finally got jack2 installed version 1.9.9.4 from the pro-audio overlay.
but I am still getting the same bus error.
I also tried to install the 1.9.8 version but the sources are missing.

I will try Jack1 the next days.

Erwin
Posts: 8
Joined: Fri Jul 13, 2012 12:49 pm
by jannis » Sat Oct 27, 2012 11:59 am
Erwin wrote:I tried Gentoo and finally got jack2 installed version 1.9.9.4 from the pro-audio overlay.
but I am still getting the same bus error.
I also tried to install the 1.9.8 version but the sources are missing.


You mean version 1.9999? That'd be jack1 then (a live ebuild). pro-audio overlay is perfectly fine and I verified for jack-1.9.8 and the source really is missing :(
You can try to fetch them from another site:
Code: Select all
wget -O /usr/portage/distfiles/jack-1.9.8.tgz "http://pkgs.fedoraproject.org/lookaside/pkgs/jack-audio-connection-kit/jack-1.9.8.tgz/1dd2ff054cab79dfc11d134756f27165/jack-1.9.8.tgz"

Afterwards the emerge should work okay.
About the "bus error": I don't really know what causes it. I know that the ALSA-driver for the Pi's audio-chip doesn't support mmap so it won't work directly. Using the dummy-driver and alsa_out should work. Maybe it's a privilege/realtime or shared memory(shm) problem?
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by Erwin » Sat Oct 27, 2012 6:48 pm
Jannis,

I tried the 2.9999 wich gives the 1.9.9.4 Jack2 and does not work.

Now the best part: the 1.9.8 works! at least with the dummy driver.
As soon as my usb audio card arrives I will do some more testing.
I will also test this source on the 2012-09-18-wheezy-raspbian image to see if it works.

Thank you for your help.
Posts: 8
Joined: Fri Jul 13, 2012 12:49 pm
by f0m3 » Thu Nov 01, 2012 1:41 pm
Hi,
i am new here and do not yet have a RPI. But i am keen on jack audio and do audio looping with sooperlooper.
I was just wonderingt if RPI would run sooperlooper and jackd / any ladspa host. That could build a great freely configureble audio effects thing.
Maybe one could integrate RPI into something like a used Behringer BCD 2000 or a BCR 2000. That would be a lot of fun.
Posts: 1
Joined: Thu Nov 01, 2012 1:32 pm
by Erwin » Fri Nov 02, 2012 9:09 pm
Hello,

I think before we can make proper use of jack we have to wait until the USB problems are solved because there is no audio input on the Pi.
There is work being done to solve these problems but we have to be patient.
Posts: 8
Joined: Fri Jul 13, 2012 12:49 pm
by billb » Tue Nov 06, 2012 9:53 pm
I have the Rocksmith Real Tone Cable which apparently plays well with Linux. I plugged it into a powered USB hub connected to the Pi and it was immediately recognized (the device showed up as expected in dmesg output) and I was able to select it as an input device in qjackctl.

So I thought I was well on my way to having a neat little guitar effects processor, but then I started seeing jack crashing / failing to start, then started Googling, then found this topic. :(

Looks like both Guitarix and Rakarrack both use jack.

The tutorial I was sort-of following is here:
http://www.timelordz.com/blog/2011/12/f ... recording/
User avatar
Posts: 173
Joined: Wed Sep 19, 2012 10:27 pm
by jannis » Tue Nov 06, 2012 10:21 pm
billb wrote:So I thought I was well on my way to having a neat little guitar effects processor, but then I started seeing jack crashing / failing to start, then started Googling, then found this topic. :(


What messages/errors do you see from jack? Which settings do you use?
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm