Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jackd2 -> Pulse Audio "mmap-based access is not possible" #161

Closed
hzulla opened this issue Dec 4, 2015 · 10 comments
Closed

jackd2 -> Pulse Audio "mmap-based access is not possible" #161

hzulla opened this issue Dec 4, 2015 · 10 comments

Comments

@hzulla
Copy link

hzulla commented Dec 4, 2015

I'm trying to find a "foolproof" setup for jackd that works "good enough" for a newbie user who only wants audio output and where latency isn't a big problem. A longer description of the situation is here.

Now my naive idea was to use jackd and then connect it the "pulse" ALSA interface of the Ubuntu system. But:

$ jackd -d alsa -P pulse
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 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
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... pulse|-|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: mmap-based access is not possible for the playback stream of this audio interface
ALSA: cannot configure playback channel
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server

Ok, where can I address this? Is the mmap-based access a hard requirement of jackd or can it be configured to run without it? Can PulseAudio be told to offer mmap in its ALSA device simulation?

(Forgive any novice mistakes. I'm still stumbling through these audio settings and how they relate with each other.)

@mseeber
Copy link
Contributor

mseeber commented Dec 4, 2015

By all means, you do not want to connect to the "pulse" plugin with jack.

What you can do to get jack running is the following:

  1. Find out the Index of the soundcard that you want to use. This can be done by running aplay -l. The output on my system looks like this:
    $ aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]   
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: PCH [HDA Intel PCH], device 0: ALC3232 Analog [ALC3232 Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

I do not want to use the HDMI device, so it is card number 1 I choose.

To connect directly to the device for playback only, I would the run: jackd -d alsa -P hw:1 which results in:

$ jackd -dalsa -P hw:1
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 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
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
Acquire audio card Audio1
creating alsa driver ... hw:1|-|1024|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback

Which seems like a sane starting point just for playback without much care for latency.

@hzulla
Copy link
Author

hzulla commented Dec 5, 2015

That breaks the other programs using audio already running. While your jack config is running, e.g. Firefox stops playing audio. While this is a possible way to improve on that, it still breaks the desktop's mixer and volume control hotkeys and the user can't adjust the volume levels while jack is running.

@hzulla
Copy link
Author

hzulla commented Dec 5, 2015

Also

By all means, you do not want to connect to the "pulse" plugin with jack.

Forgive my ignorance, but why not, exactly?

@mseeber
Copy link
Contributor

mseeber commented Dec 5, 2015

The "pulse" plugin is meant for PulseAudio to connect to, not jack.

Since only one sound server can be connected to a device at the same time, you can not have JACK and PulseAudio run with the same card the easy way. There are workarounds and for a first primer, have a look here: http://jackaudio.org/faq/pulseaudio_and_jack.html Also there is a Wiki entry on this topic: https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_PulseOnJack

There are also people who are successfully using the dmix alsa plugin to run pulse and JACK but honestly, I have never tried that. What I did in the past, was running PulseAudio on top of JACK, so that desktop applications can still use PulseAudio.

@x42
Copy link
Member

x42 commented Dec 5, 2015

JACK is a professional sound-server:
It guarantees all jack-clients a fixed latency, sample accuracy (jack gets the clock directly from the hardware's oscillator or word-clock) resulting in regular periodic callbacks (reliable). it offers zero-copy (shared buffers) for inter-application communication, and provides a fixed sample-rate (no resampling) and a common transport.

To guarantee this jackd needs exclusive access to the soundcard (hardware).

Pulseaudio is almost the opposite: sliding buffers, no fixed latency, irregular wakeup (powersaving), resampling as-needed..

Pulseaudio can live on top of JACK, but not the other way around.

Most distros set this up automatically: start jackd, pulseaudio yields the soundcard and connects to jackd instead. it's seamless integration (users don't even notice). Sadly the most widespread distro regularly screes this up.

@x42
Copy link
Member

x42 commented Dec 5, 2015

PS. yes, one can hack this and make jackd use virtual devices or.. well you have the source. but by design it make no sense.

Also the "exclusive access to the soundcard (hardware)" is not entirely true: On OSX this is not a requirement because Apple's Coreaudio provide a mechanism that is equally suitable.

@hzulla
Copy link
Author

hzulla commented Dec 5, 2015

Sadly the most widespread distro regularly screes this up.

Could you point me to where it screws it up? What exactly is Ubuntu doing wrong that others are doing right? (Afaict the same problems occur on Debian and Raspbian.)

@x42
Copy link
Member

x42 commented Dec 5, 2015

Works fine on debian/stable (jessie) and debian/testing. Also Fedora users report it working

I don't know what Ubuntu is doing, but there its the number 1 issue on jack/ardour IRC support channels.
We recommend http://libremusicproduction.com/articles/advantages-choosing-audio-orientated-linux-distribution (KXStudio and AVLinux are known to work).

Raspian is a different issue (jackdbus related, there's usually no active session to connect to dbus).

@falkTX
Copy link
Member

falkTX commented Dec 5, 2015

The main issue is the pulseaudio jack module being in a separate package, which needs to be installed by the user manually.
There is not a single good reason to have that module packaged separately, the only dependency it has is libjack0 which other packages (like gstreamer) also have.
So on raw Debian and Ubuntu distros the automatic pulseaudio+jack process simply doesn't work.

Somewhat recently Ubuntu had a bug in their pulseaudio package that prevented this from working even if pulseaudio-module-jack was installed.
And in older versions the pulseaudio-module-jack was not even available to install.

@hzulla hzulla closed this as completed Dec 7, 2015
@hzulla
Copy link
Author

hzulla commented Dec 7, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants