每当我启动 Hydrogen 时,它会破坏所有其他使用 Pulse 的应用程序中的音频,例如,在启动 Hydrogen 一次后,我无法再在 Chrome 中播放视频,直到我重新启动我的 PC 或执行 sudo alsa force-reload。我发现有人有类似的问题,但没有解决这个问题的实际指南,通常有指向 http://jackaudio.org/pulseaudio_and_jack 的链接(已移至http://jackaudio.org/faq/pulseaudio_and_jack.html)我我正在使用 Ubuntu Studio 14.04 64 位。
或者,如果这真的不可能实现,有人能告诉我如何在一个声卡上使用 Jack 而在另一个声卡上使用 Pulse 吗?这样我就可以只在需要 JACK 时插入 USB 声卡。
请不要让我使用Windows。
从 16.04 开始,事情变得简单多了:)
只需安装
qjackctl
和pulseaudio-module-jack
模块:然后配置
qjackctl
启动后运行如下命令。将其复制到“设置...”>“选项”>“启动后执行脚本”:就是这样。Pulseaudio 将识别(通过 D-Bus)JACK 启动,并自动将音频路由到它。当 JACK 停止时,Pulseaudio 将恢复正常路由并再次开始将音频直接发送到卡。
所以(几乎)默认情况下,Pulseaudio 实现了上面由 mmv-ru 详述的设置。
这个 Youtube 视频:“Jack and PulseAudio Together as Friends - Linux”似乎有一些答案:
解决方案的关键似乎是确保 pulseaudio-module-jack 安装了:
然后 sudo 编辑 /etc/pulse/default.pa 文件以在手动加载音频驱动程序部分下包含两行:
然后 - 我认为 - 重新启动 pulseaudio。我刚刚重新启动了 PC(懒惰,我知道)并且它很有用......启动 Ardor 不再杀死 pulseaudio,他们一起玩得很开心。
我的解决方案适用于 Fedora 23。
不要碰 /etc/pulse/default.pa !
配置qjackctl
~/.config/rncbc.org/QjackCtl.conf 的相关片段:
pactl 的接收器名称可以通过以下方式找到:
这是 ~/.config/rncbc.org/QjackCtl.conf 的另一片段,用于显示完整命令
“启用 D-Bus 接口”对 Qjackctl 本身很重要。
这个怎么运作
现在启动时,PC 仅使用 PulseAudio 运行,一切都自动运行,就像没有 Jack 一样。
启动Qjackctl后,
pactl suspend-sink alsa_output.pci-0000_00_1b.0.analog-stereo 1
jack_control start
pactl set-default-sink jack_out
起初看起来没有必要,因为所有正在运行的PA客户端都切换到新的sink,但是如果没有这个命令,新的应用程序将卡在暂停的sink上)因此系统被重新配置为使用“Pulse on top of Jack”。(我跳过了硬件输入挂起,因为我根本不用它)
如果未选中“应用程序退出时停止 JACK 音频服务器”,我可以关闭 Qjackctl 并重新运行它而不会干扰设置。
在通过 Qjackctl 阻止 Jack 之后,一切都恢复到简洁的 Pulse!
pactl suspend-sink alsa_output.pci-0000_00_1b.0.analog-stereo 1
使用的工具
LANG=C pacmd list-sinks|grep -E "index:|name:|alsa.long_card_name =|alsa.name ="
或LANG=C pactl list sinks|grep -E "(Sink #|Name:|alsa.long_card_name =|alsa.name =)"
检测 alsa 设备名称问题是 Hydrogen(如 Ardour)在启动时启动 jackd 但在退出时不关闭它:
但是您可以
killall jackd
在 Hydrogen 退出后在终端中运行。同时使用 Jack 和 pulseaudio 软件的复杂方法是安装“pulseaudio-module-jack”(如果不存在,还安装 qjackctl(jackd 的 gui)和 pavucontrol)。重启脉冲音频
pulseaudio -k
。现在关闭音频应用程序(Jack 和 pulseaudio),
使用 qjackctl(单击开始按钮)运行 jackd(必须在 qjackctl 设置的最后一个选项卡中选择 dbus 选项)。
在 Pavucontrol“输出设备”选项卡中,点击“jack sink”附近的绿色“默认设备”按钮
现在 pulseaudio 软件和 Hydrogen 应该同时运行。
使用 qjackctl,在第一个“设置”选项卡中,您可以更改 Jackd 音频设备。
路由所有系统以使用 jack 运行的最简单方法:
安装
打开qjackctl。在设置>选项>
检查启动后执行脚本并粘贴:
检查关机后执行脚本并粘贴:
现在启动 qjack 并打开您的声音设置。您会找到 Pulse Audio Jack Sink Output 端口。选择它,所有系统将同步。如果您停止 Jack 服务器/qjack,声音将再次回到您的默认端口。
[这里是整体视图]
2020 年更新。Debian 克星。希望也适用于 Ubuntu。
无需再使用任何脚本。
安装
pulseaudio-module-jack
。它包含一个模块,负责检测 jack 何时启动并从中获取/下沉。您可以在 pulseaudio 配置文件中检查:
/etc/脉冲/default.pa
确保 jackdbus 已启动。如果使用 qjackctl 启动 jack,请在设置 -> 杂项中选中 dbus 复选框。
这应该是它所需要的。
Ubuntu 20.04,我发现它是各种答案的混合体
Setup...
-->Options
-->中Execute script after Startup
粘贴以下内容:启动 JACK,在 QJackCtl 中,PulseAudio Sink 和 Source 应该连接到系统
在 Ubuntu 设置中,选择 JACK Sink 作为输出
现在可能容易多了。在全新安装 Linux Mint 18.2(Ubuntu 16.04 软件包基础)之后,今天对我有用的是:满足我真正的基本需求:
使用 Synaptic 安装 QSynth 和 QJackCtl。
将所需的声音字体复制到适当的文件夹中,例如
/usr/share/sounds/sf2/
在QSynth 设置中:在Audio选项卡下将Audio Driver更改为pulseaudio。
在QSynth Setup 中:在SoundFonts下:Open ... 并根据需要选择一个。
在QJackCtl Setup > Settings > Advanced 中:
服务器前缀:pasuspsender --
/usr/bin/jackd
在QJackCtl 设置 > 选项中:
启动后执行脚本:
在QJackCtl Connect: ALSA中:将左侧的键盘条目连接到右侧的FLUID Synth。
在声音的主要系统设置中,选择所需的输出设备。
现在我可以在观看视频的同时弹奏键盘(例如在 YouTube 上使用 Firefox)——以前我一次只能做其中一个,而没有很多我很少能跟踪的调整。
希望能帮助某人,或鼓励他们再试一次 :-)。
有两种方法可以回答这个问题。
前一段时间我写了一个命令,有人告诉我说在尝试了这里所有的解决方案之后他运气不好。但是这个解决方案对他有用,所以我会把它贴在这里以防其他人能得到帮助。注意:我并不是说这个解决方案是最优雅的解决方案,但它对我来说做得很好:
This solution may be slighly improved by unloading correctly the modules when quitting Jack, maybe using the ugly grep proposed here, but I didn't really found any benefit for me.
Note also that I give quite detailed instructions on how to debug such issues.
My solution (see theory below to understand why it works/fails and debug any potential issue)
Install:
Run qjackctl:
Click on
Setup
, and check that the output Interface is the correct one (if you have an HDMI output for example this check may be important). In my case, I'll just use the default and I'll come back here if I've some issues later.Then, in the advanced tab, I replaced the Server Prefix
jackd
withpasuspender -- jackd
. This is supposed to tell pulseaudio to temporarily let jack manage the sound card. I'm not sure if it's really required, but I guess it cannot hurt:Then, in the tab "Options", put in the
Execute script after Startup
the following code:The goal of this command is to create new outputs (sink) to pulseaudio that points to jack, to enable this new sink by default (all newly open applications will write to jack), and it also change the output of all the existing applications to make sure they point to jack.
Then, to make sure pulseaudio restarts when jack is closed, I also added in the field
Execute script after Shutdown
:That's it! Now, you just need to save by clicking on
Apply
and to click onStart
to start jack:You should see something like that if it works (and of course no errors):
A bit of theory to understand why it works, or why it fails
So basically, you can't play sound because only one program can play sound at the same time on the same sound card. So when Jack is playing, pulseaudio is blocked. Now, it also turns out that most desktop applications can talk to pulseaudio but not to Jack. So when Jack is on, you just don't have sound anymore. The trick is to route the pulseaudio trafic to Jack with something like that:
Note that all links must be correctly configured. We will see now how they are configured and how to check if they are configured correctly.
So to create the link
pulseaudio -> Jack
we are going to load a module that creates a new pulseaudio sink (i.e. a virtual output device) calledJack sink
: that way any applications writing in that sink will be redirected on Jack. You could have several already existing sinks, like one for the internal audio, and if you have a bluetooth headset, you can have one sink for it too. To check on which sink an application is actually playing, install and runpavucontrol
(pavucontrol
is super useful anyway for all sound-related stuff, since you can control basically everything from it). You can see the list of sinks in a tab named likeInput devices
(sorry if the translation is bad), in my case I have right now 2 sinks (jack is not yet loaded):If you just have one sink, you may not see anything interesting, but if you have several sinks, you can check in the first tab which application is playing on which sink (here you see that firefox is playing on my bluetooth headset), and you can change it if needed:
So if you have some issues, you can:
pulseaudio -> jack
: check that you have a sink corresponding to jack (if not, try to run manually the commandpactl load-module module-jack-sink
that was supposed to be run automatically. If it fails, make sure you installed thepulseaudio-module-jack
, and eventually restart pulseaudio by simply killing itkillall pulseaudio
. No worries, no need to restart pulseaudio, it respawn automatically.). Also make sure that the volume is not 0%, and that the channel is not muted:application -> pulseaudio
: check that your applications are writing on that sink. If not, you can manually change the sink (but the startup script was supposed to change the sink automatically) that way:jack -> sound card
: If you still have troubles (this part could also concern a trouble you have with the softwares that write on jack directly likezynaddsubfx
), check out theGraph
part of jack:You should start will all nodes packed together, but you can move them to make them easier to see. Then make sure that all applications you want to ear are connected to
system
(in my casezynaddsubfx
was not connected automatically). NB: if you have an older version of QJackctl, then you may have tabs instead of this. But it's the same: you will have green inputs/outputs in the "Jack" tab that you can manually connect, the violet ones will be in the "Alsa" tab, and the red ones in the "MIDI" tab... but in fact all external MIDI devices that you plug will appear in the Alsa tab: the reason is that there are two kinds of "MIDI": the legacy Alsa Midi (ports are global to the system), and the more recent Jack Midi (each application can have its own midi input/outputs).zynaddsubfx
has some strange defaults values and will appear as "Midi/red" instead of "Alsa/green", making it impossible to connect to an external midi device. More precisely, if you runzynaddsubfx
from the command line without any option or with:(which means input from Alsa MIDI, output to jack) it should not be a problem, you will be able to connect the MIDI devices:
但是,如果您以图形方式运行它,默认的 Jack 条目会自动运行
zynaddsubfx -I jack -O jack
...并且会出现zynaddsubfx
输入将在红色/MIDI 选项卡中创建,而实际外部 MIDI 设备在紫色/Alsa 中的问题标签。所以这意味着您将无法将外部 MIDI 键盘映射到zynaddsubfx
:因此,解决方案是
zynaddsubfx
使用不带选项的命令行运行,或者使用命令行运行zynaddsubfx -I alsa -O midi
,一切都应该有效!当然,如果他们到了需要 jack 的地步,人们会希望同时运行 pulseaudio 和 jack,因为大多数浏览器媒体播放器都不知道 jack!..很遗憾。
我一直看到一次只运行其中一个的建议,这在我看来是一种可怕的妥协。在我看来,这两个服务(即 jack 和 pulseaudio)虽然都可以独立运行,但 kxstudio 管理不善,至少我正在使用它,这有点悲惨。
所以会发生什么:
jack 在 pulseaudio 运行时无法启动(并且使用它想要使用的声卡驱动程序,这很公平)所以需要先启动它
pulseaudio 需要在启动和运行后指向插孔
很简单..嘿?由于某些原因,我对此感到无尽的悲伤,因为……
首先,我认为是因为 pulseaudio 4.0 似乎有问题并且弄乱了 alsa 驱动程序,因此在某些情况下它会保持锁定状态,因此即使 pulseaudio 没有运行,jack 也无法启动。(说未能设置捕获参数或类似的 smtg)
我最后所做的是
按照这个顺序,然后我终于让它们通过 qjackctl 正常运行,这确保它们以正确的方式启动(在 pulseaudio 中加载插孔接收器,并将其设置为默认值)。
顺便说一句,我看到 Cadence 被推荐了,我不明白为什么对我来说它与 qjackctl 相比似乎是垃圾。
无论如何,问题是使用 qjackctl 启动 jack 需要一段时间,为了避免每次启动时的等待时间,您可以使用 kde 的这个救生功能来加载以前的会话。确保您在自动启动中没有 qjackctl,因为无论 singleton = true 设置如何,每次重新启动时您都会多一个实例(整晚都有 buggy buggy)。
这是因为我不再觉得摆弄它,例如编写一个智能脚本来确保 pulseaudio 已关闭(或暂停)启动插孔并检查它是否正常启动,然后启动 pulseaudio,加载插孔模块等。
否则依赖操作系统启动守护进程并正确加载配置将是正常的(健康的)场景,但它似乎没有发生。
玩得开心..