User avatar
azeam
Posts: 194
Joined: Fri Oct 26, 2012 11:13 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Tue Apr 09, 2013 9:29 pm

JulianBrooks wrote:Hi AutoStatic,

This and the linuxaudio pages are super-useful, many thanks.

When I run this (after adding the repository)
sudo apt-get --no-install-recommends install jackd2$ sudo apt-get --no-install-recommends install jackd2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libjack-jackd2-0 libjack-jackd2-dev python-dbus python-dbus-dev
Suggested packages:
jack-tools meterbridge python-dbus-doc python-dbus-dbg
Recommended packages:
qjackctl python-gi python-gobject-2 python-qt4-dbus
The following NEW packages will be installed:
jackd2 python-dbus python-dbus-dev
The following packages will be upgraded:
libjack-jackd2-0 libjack-jackd2-dev
2 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,242 kB of archives.
After this operation, 2,655 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Preconfiguring packages ...
dpkg: unrecoverable fatal error, aborting:
files list file for package `fake-hwclock' contains empty filename
E: Sub-process /usr/bin/dpkg returned an error code (2)


Stuck now:( Any ideas?

Cheers,

Julian
I get:
Try to move/delete the file /var/lib/dpkg/info/fake-hwclock.list

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Tue Apr 09, 2013 9:43 pm

Hi azeam,

Worked a treat.

Many thanks,

Julian

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Tue Apr 09, 2013 10:01 pm

Whoo - Pd & jack2 on the Pi.

Fantastic!!

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Wed Apr 10, 2013 8:00 am

JulianBrooks wrote:Whoo - Pd & jack2 on the Pi.

Fantastic!!
Have fun!
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Thu Apr 11, 2013 9:41 pm

Hi again,

Can I ask a possibly dumb question please:
"Warning: this can cause unpredictable behaviour when running a desktop environment on the RPi"
Does this apply when using ssh and vnc?

Cheers,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Fri Apr 12, 2013 10:51 am

SSH: no
VNC: yes because you're remotely viewing a running graphical session. And that session most probably uses D-Bus, gvfsd etc. so shutting those down can cause weird issues in the remote graphical session.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Fri Apr 12, 2013 10:52 am

Good to know.

Many thanks,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Mon Apr 15, 2013 8:40 am

RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

gritz
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am

Re: RPi and real-time, low-latency audio

Mon Apr 15, 2013 10:56 am

Good stuff! Eight milliseconds isn't too shabby at all and the spring reverb in particular caught my ear.

Is the audio interface handling the MIDI in?

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Mon Apr 15, 2013 11:21 am

gritz wrote:Good stuff! Eight milliseconds isn't too shabby at all and the spring reverb in particular caught my ear.

Is the audio interface handling the MIDI in?
Hi gritz, no the MIDI is handled by a MIDI-USB cable. The audio interface does have MIDI in and out but I can't use them as I have to switch the interface to a mode where those are disabled in order to make the interface work well with the RPi.
The spring reverb is a simple effect based on Freeverb, so nothing really fancy. guitarix also comes with a stereo reverb effect based on zita-rev1 and that's a different beast, I've used that one in the other video I've posted. When using the stereo reverb I have to raise the number of frames/period though so system latency is higher in that case.
It is also possible to use convolution with IR files which means you could basically emulate any reverb you'd like.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

gritz
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am

Re: RPi and real-time, low-latency audio

Mon Apr 15, 2013 11:53 am

Thanks for the reply AutoStatic - I really should give guitarix a try, but I'm currently weaning myself back on to pedals and the whole analogue thing! Hmmm, convolution... now where's that "acoustic guitar body" response I have somewhere... :o

Hats off to you sir, you've been something of a pioneer with getting low latency fx processing squeezed into the Pi. I can imagine that a lot of people will be trying this out.

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Mon Apr 15, 2013 1:02 pm

gritz wrote:Thanks for the reply AutoStatic - I really should give guitarix a try, but I'm currently weaning myself back on to pedals and the whole analogue thing!
That's what I prefer too, for me nothing beats a tube amp with some good stompboxes
gritz wrote:Hmmm, convolution... now where's that "acoustic guitar body" response I have somewhere... :o
Never thought of that actually. If it's in a format guitarix can load then it will probably work fine.
gritz wrote:Hats off to you sir, you've been something of a pioneer with getting low latency fx processing squeezed into the Pi. I can imagine that a lot of people will be trying this out.
Thanks! So far the response has been quite minimal though.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Mon Apr 15, 2013 7:32 pm

Hi again,

Another question...
My rpi has only 256mg of ram
"## Remount /dev/shm to prevent memory allocation errors
sudo mount -o remount,size=128M /dev/shm

I don't have that much to spare, can I set it lower somehow/where? Like would jack be happy with only 64M set here?

Cheers,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Wed Apr 17, 2013 12:54 pm

JulianBrooks wrote:Hi again,

Another question...
My rpi has only 256mg of ram
"## Remount /dev/shm to prevent memory allocation errors
sudo mount -o remount,size=128M /dev/shm

I don't have that much to spare, can I set it lower somehow/where? Like would jack be happy with only 64M set here?
You could try without remounting /dev/shm. I've just tested this and JACK (Jack1 to be exact) seems to work just fine. So I'm wondering if this step is mandatory at all.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Wed Apr 17, 2013 11:12 pm

Cool, good to know.
Many thanks.

I've ended up building a no gui install based on the hexxeh image
http://www.raspbian.org/HexxehImages
and tweaks mainly from here
http://blog.extremeshok.com/archives/1081
adding alsa base & utils then jack2 (might remove and add 1 instead) and the systems way happier.

Not added overclocking yet as it felt unstable and mashed a couple of sd cards along the way.

The whole overclocking thing seems to be both a dark art and very subjective (another topic though:).

Cheers,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Thu Apr 18, 2013 8:59 am

JulianBrooks wrote:and tweaks mainly from here
http://blog.extremeshok.com/archives/1081
adding alsa base & utils then jack2 (might remove and add 1 instead) and the systems way happier.
I reckon, that blog mentions quite some things I hadn't thought about, like replacing open-ssh with dropbear. Thanks for posting it! I wouldn't raise the swappines though, especially when doing audio.
JulianBrooks wrote:The whole overclocking thing seems to be both a dark art and very subjective (another topic though:).
True. If you really don't want too run the risk of corrupting SD cards then you shouldn't use it. But we're hackers who want to get the most out of their RPi right ;)

Edit: using dropbear is not an option as the Raspbian package of dropbear does not support PAM.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Fri Apr 19, 2013 2:21 pm

Thanks for the swappiness hint (great word swappiness:).
So are we saying that swap and audio is a no-no?
Also I've got dropbear on my minimal image and all seems ok (famous last words).
I've done a quick search of PAM but am not really sure what itdoes and why it makes dropbear a no-go?

The minimal image was put together for a particular audio installation. All the tips and tweaks meant that my patch now runs as-is, whereas before it wouldn't run without some overclocking, which is why I've left it out so far.

Cheers for all the top tips so far,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Fri Apr 19, 2013 8:25 pm

JulianBrooks wrote:Thanks for the swappiness hint (great word swappiness:).
So are we saying that swap and audio is a no-no?
It's not a no-no but best is to keep it as low as possible because you want your system to only swap when it's absolutely necessary as swap is almost always slower than RAM. Also, the default for Raspbian is 1, I'd just keep it that way.
JulianBrooks wrote:Also I've got dropbear on my minimal image and all seems ok (famous last words).
I've done a quick search of PAM but am not really sure what itdoes and why it makes dropbear a no-go?
PAM=Pluggable Authentication Modules, bit hard to give a short description. In the case of JACK, by default JACK uses realtime priorities and a normal user can't set realtime prios. With the help of PAM this becomes possible. When using Dropbear you can't set realtime prios so JACK won't run in realtime mode. Which is imo a must on the RPi.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Fri Apr 19, 2013 9:56 pm

Aaah - yes gotcha.

That's why I couldn't RT!!

Nice one,

Julian

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Wed Apr 24, 2013 7:41 pm

Been pondering the RT/dropbear/available RAM thing for a few days and I hope you don't mind me asking another question:
As this particular RPi is for an installation that isn't accessible via internet, has no other usage and I'm the only user - can I still get RT if I'm root? Yes I know it's very frowned upon etc etc but I'm a big boy and can take responsibility for mashing my system if needed (plus of course I'm backed-up to the hilt).

Cheers,

Julian

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Wed Apr 24, 2013 9:04 pm

Yes you can.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Sun Apr 28, 2013 8:20 pm

http://martinezjavier.wordpress.com/201 ... sa-driver/

Patch has been merged in the RPi kernel sources. This means JACK should now also work directly with the onboard audio as the ALSA driver now has MMAP support.
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5268
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: RPi and real-time, low-latency audio

Wed May 01, 2013 8:57 pm

AutoStatic wrote:Patch has been merged in the RPi kernel sources. This means JACK should now also work directly with the onboard audio as the ALSA driver now has MMAP support.
The current /etc/asound.conf (which enabled mmap emulation) is no longer required, and may cause problems.
So, if you have rpi-updated, and have audio problems then:

Code: Select all

sudo rm /etc/asound.conf
will probably help.

User avatar
AutoStatic
Posts: 326
Joined: Tue Jan 01, 2013 10:27 pm
Contact: Website

Re: RPi and real-time, low-latency audio

Thu May 02, 2013 7:53 am

Thanks for the heads up dom!
RPi and real-time, low-latency audio: http://wiki.linuxaudio.org/wiki/raspberrypi
RPi audio repository: http://rpi.autostatic.com/
RPi and audio blog: https://autostatic.com/tag/raspberrypi/

JulianBrooks
Posts: 35
Joined: Wed Mar 20, 2013 1:08 pm

Re: RPi and real-time, low-latency audio

Sun May 05, 2013 6:33 pm

Hey all,

So ...
Overclocking.

There is way too much conflicting info out and about regarding this and certainly nothing I've come across specific to audio (apart from here and the linuxaudio page).

My feeling is that there's a massive difference between people who are occasionally scaling upwards into overclocking and RPi's setup for audio usage where we want to be running flat-out all the time.

Would anyone care to share their overclocking settings for experimentation (obviously at the users own risk)? Perhaps the whole config.txt would be super-helpful, certainly for me as the minimal image I've built my RPi on has nothing at all in that file atm.

Cheers,

Julian

P.S. - I'll be backing up before I start.

P.P.S. - Thanks for the alsa tip.

Return to “Graphics, sound and multimedia”