How do I switch between Pulseaudio and Jack on Ubuntu 12.04 LTS x86 Linux?
There are some applications on my Ubuntu 12.04 which requires Jack. Without Jack they just won't start, so I have to keep Jackd + (QjackCtl). Now the problem is jackd is not starting properly all the time. Sometime it works well, sometime it fails start(I suspect Pulseaudio is the reason).
Now, I have found a workaround to keep both Jack and Pulseaudio runnning side-by-side Here is what I have done
1. Installing pulseaudio-modules-jack
2. Editing /etc/pulse/default.pa and adding these lines
### Load audio drivers statically
load-module module-jack-sink
load-module module-jack-source
After restarting pc I can see both Jack and Pulseaudio working Ok. But here is another problem, the sound output form the speakers are very low, cpu spikes have increased quite a bit, Hardware devices are not shown. Sound control shows 5:1 sound system where I only have 2:1 sound system.
I need a way to switch between Pulseaudio and Jack. Im not a professional music maker. I need Jackd only when Im using Ardour or any other app that needs Jack. You must be thinking Pulseaudio will be automatically disabled when starting Jack. But that is not the case for me. Previously I have faced erros trying so
Here's a log of that error
14:36:48.194 Patchbay deactivated.
14:36:48.198 Statistics reset.
14:36:48.228 ALSA connection change.
14:36:48.241 D-BUS: Service is available (org.jackaudio.service aka jackdbus).
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
Registered event listener change listener: true
14:36:48.258 ALSA connection graph change.
14:37:12.679 D-BUS: JACK server could not be started. Sorry
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
QSpiAccessible::accessibleEvent not handled: "2" obj: QMessageBox(0xbfd7c2d0) ""
FIXME: handle dialog start.
Sat Feb 2 14:37:12 2013: Starting jack server...
Sat Feb 2 14:37:12 2013: JACK server starting in realtime mode with priority 10
Sat Feb 2 14:37:12 2013: [1m[31mERROR: Cannot lock down 82241434 byte memory area (Cannot allocate memory)[0m
Sat Feb 2 14:37:12 2013: control device hw:0
Sat Feb 2 14:37:12 2013: control device hw:0
Sat Feb 2 14:37:12 2013: [1m[31mERROR: Failed to acquire device name : Audio0 error : Cannot allocate memory[0m
Sat Feb 2 14:37:12 2013: [1m[31mERROR: Audio device hw:0 cannot be acquired...[0m
Sat Feb 2 14:37:12 2013: [1m[31mERROR: Cannot initialize driver[0m
Sat Feb 2 14:37:12 2013: [1m[31mERROR: JackServer::Open() failed with -1[0m
Sat Feb 2 14:37:12 2013: [1m[31mERROR: Failed to open server[0m
Sat Feb 2 14:37:13 2013: Saving settings to "/home/soham/.config/jack/conf.xml" ...
FIXME: handle dialog end.
14:37:17.923 Could not connect to JACK server as client. - Overall operation failed. - Unable to connect to server. Please check the messages window for more info.
Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
jack server is not running or cannot be started
QSpiAccessible::accessibleEvent not handled: "2" obj: QMessageBox(0xbfd7cb40) ""
FIXME: handle dialog start.
FIXME: handle dialog end.
QSpiAccessible::accessibleEvent not handled: "6" obj: QMenu(0x8d0f0a0) ""
Now my question is how can I switch between Pulse and Jack safely ? Is there any app to do so ?
Here's a screenshot -
Solution 1:
The best option I found at the moment is suspending pulseaudio while jack is running. It's described in the pulseaudio and jack page, and involves invoking the jack server through pasuspender
.
From the man pages:
pasuspender is a tool that can be used to tell a local PulseAudio sound
server to temporarily suspend access to the audio devices, to allow
other applications access them directly. pasuspender will suspend
access to the audio devices, fork a child process, and when the child
process terminates, resume access again.