我jack2
在 Ubuntu 16.04 LTS 上安装jack
,jack-tools
并qjackctl
从官方存储库使用。
我的 USB 音频连接将 44100 Hz 送入插孔。插孔配置(通过qjackctl
)以 44100 Hz 运行。但是,运行时它会自动更改为 48000 Hz,导致扬声器的音高大约高出 2 个音符,并显示以下消息:
ERROR: playback and capture sample rates do not match (48000 vs. 44100)
我读过大量(非常古老的)关于采样率与 jack、alsa 或脉冲音频有关的讨论,并添加了一个名为的文件,.asoundrc
它似乎不再起作用了。但无论如何,这都超出了我的能力范围。我只想将“播放采样率”更改为 44100 Hz。有人能解释一下我应该在 2018 年(或 2016 年 - Ubuntu 16.04)采取什么步骤,这样 jack 就不会将我的 44100 Hz 输入播放为 48000 Hz 吗?
USB 设备:
$ cat /proc/asound/card1/stream0
KORG INC. ToneLabST at usb-0000:00:14.0-1, full speed : USB Audio
Playback:
Status: Stop
Interface 1
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 1 OUT (ADAPTIVE)
Rates: 44100
Capture:
Status: Stop
Interface 2
Altset 1
Format: S16_LE
Channels: 2
Endpoint: 2 IN (ASYNC)
Rates: 44100
可能相关的报告:
2018 年 8 月更新
我全新安装了 Ubuntu 18.04 LTS,并再次尝试了此操作。
sudo apt update
sudo apt install jack jack-tools qjackctl
env QT_SCALE_FACTOR=1.5 qjackctl
这时我正在插上ToneLab STUSB 电缆。我遇到了同样的问题。请注意频率不匹配。
Starting jack server...
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Acquired audio card Audio1
Acquired audio card Audio0
creating alsa driver ... hw:PCH|hw:ToneLabST,0|128|3|44100|0|0|nomon|swmeter|-|16bit
configuring for 44100Hz, period = 128 frames (2.9 ms), buffer = 3 periods
ALSA: final selected sample format for capture: 16bit little-endian
ALSA: use 3 periods for capture
ALSA: final selected sample format for playback: 16bit little-endian
ALSA: use 3 periods for playback
ERROR: playback and capture sample rates do not match (48000 vs. 44100)
根据要求,以下是aplay -l
:
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CX8200 Analog [CX8200 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: ToneLabST [ToneLabST], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
下面是pactl list cards
:
Card #0
Name: alsa_card.pci-0000_00_1f.3
Driver: module-alsa-card.c
Owner Module: 7
Properties:
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xec340000 irq 146"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1f.3"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "9d71"
device.product.name = "Sunrise Point-LP HD Audio"
device.form_factor = "internal"
device.string = "0"
device.description = "Built-in Audio"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
Profiles:
input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 60, available: yes)
output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority: 6000, available: yes)
output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority: 6060, available: yes)
output:hdmi-stereo: Digital Stereo (HDMI) Output (sinks: 1, sources: 0, priority: 5400, available: no)
output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5460, available: yes)
output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (sinks: 1, sources: 0, priority: 300, available: no)
output:hdmi-surround+input:analog-stereo: Digital Surround 5.1 (HDMI) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 360, available: yes)
output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (sinks: 1, sources: 0, priority: 300, available: no)
output:hdmi-surround71+input:analog-stereo: Digital Surround 7.1 (HDMI) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 360, available: yes)
output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (sinks: 1, sources: 0, priority: 5200, available: no)
output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI 2) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5260, available: yes)
output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround-extra1+input:analog-stereo: Digital Surround 5.1 (HDMI 2) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround71-extra1+input:analog-stereo: Digital Surround 7.1 (HDMI 2) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (sinks: 1, sources: 0, priority: 5200, available: no)
output:hdmi-stereo-extra2+input:analog-stereo: Digital Stereo (HDMI 3) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5260, available: yes)
output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround-extra2+input:analog-stereo: Digital Surround 5.1 (HDMI 3) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround71-extra2+input:analog-stereo: Digital Surround 7.1 (HDMI 3) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (sinks: 1, sources: 0, priority: 5200, available: no)
output:hdmi-stereo-extra3+input:analog-stereo: Digital Stereo (HDMI 4) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5260, available: yes)
output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround-extra3+input:analog-stereo: Digital Surround 5.1 (HDMI 4) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround71-extra3+input:analog-stereo: Digital Surround 7.1 (HDMI 4) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (sinks: 1, sources: 0, priority: 5200, available: no)
output:hdmi-stereo-extra4+input:analog-stereo: Digital Stereo (HDMI 5) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5260, available: yes)
output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround-extra4+input:analog-stereo: Digital Surround 5.1 (HDMI 5) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (sinks: 1, sources: 0, priority: 100, available: no)
output:hdmi-surround71-extra4+input:analog-stereo: Digital Surround 7.1 (HDMI 5) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 160, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:analog-stereo+input:analog-stereo
Ports:
analog-input-internal-mic: Internal Microphone (priority: 8900, latency offset: 0 usec)
Properties:
device.icon_name = "audio-input-microphone"
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:hdmi-stereo+input:analog-stereo, output:hdmi-surround+input:analog-stereo, output:hdmi-surround71+input:analog-stereo, output:hdmi-stereo-extra1+input:analog-stereo, output:hdmi-surround-extra1+input:analog-stereo, output:hdmi-surround71-extra1+input:analog-stereo, output:hdmi-stereo-extra2+input:analog-stereo, output:hdmi-surround-extra2+input:analog-stereo, output:hdmi-surround71-extra2+input:analog-stereo, output:hdmi-stereo-extra3+input:analog-stereo, output:hdmi-surround-extra3+input:analog-stereo, output:hdmi-surround71-extra3+input:analog-stereo, output:hdmi-stereo-extra4+input:analog-stereo, output:hdmi-surround-extra4+input:analog-stereo, output:hdmi-surround71-extra4+input:analog-stereo
analog-input-mic: Microphone (priority: 8700, latency offset: 0 usec, not available)
Properties:
device.icon_name = "audio-input-microphone"
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:hdmi-stereo+input:analog-stereo, output:hdmi-surround+input:analog-stereo, output:hdmi-surround71+input:analog-stereo, output:hdmi-stereo-extra1+input:analog-stereo, output:hdmi-surround-extra1+input:analog-stereo, output:hdmi-surround71-extra1+input:analog-stereo, output:hdmi-stereo-extra2+input:analog-stereo, output:hdmi-surround-extra2+input:analog-stereo, output:hdmi-surround71-extra2+input:analog-stereo, output:hdmi-stereo-extra3+input:analog-stereo, output:hdmi-surround-extra3+input:analog-stereo, output:hdmi-surround71-extra3+input:analog-stereo, output:hdmi-stereo-extra4+input:analog-stereo, output:hdmi-surround-extra4+input:analog-stereo, output:hdmi-surround71-extra4+input:analog-stereo
analog-output-speaker: Speakers (priority: 10000, latency offset: 0 usec)
Properties:
device.icon_name = "audio-speakers"
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
analog-output-headphones: Headphones (priority: 9000, latency offset: 0 usec, not available)
Properties:
device.icon_name = "audio-headphones"
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
hdmi-output-0: HDMI / DisplayPort (priority: 5900, latency offset: 0 usec, not available)
Properties:
device.icon_name = "video-display"
Part of profile(s): output:hdmi-stereo, output:hdmi-stereo+input:analog-stereo, output:hdmi-surround, output:hdmi-surround+input:analog-stereo, output:hdmi-surround71, output:hdmi-surround71+input:analog-stereo
hdmi-output-1: HDMI / DisplayPort 2 (priority: 5800, latency offset: 0 usec, not available)
Properties:
device.icon_name = "video-display"
Part of profile(s): output:hdmi-stereo-extra1, output:hdmi-stereo-extra1+input:analog-stereo, output:hdmi-surround-extra1, output:hdmi-surround-extra1+input:analog-stereo, output:hdmi-surround71-extra1, output:hdmi-surround71-extra1+input:analog-stereo
hdmi-output-2: HDMI / DisplayPort 3 (priority: 5700, latency offset: 0 usec, not available)
Properties:
device.icon_name = "video-display"
Part of profile(s): output:hdmi-stereo-extra2, output:hdmi-stereo-extra2+input:analog-stereo, output:hdmi-surround-extra2, output:hdmi-surround-extra2+input:analog-stereo, output:hdmi-surround71-extra2, output:hdmi-surround71-extra2+input:analog-stereo
hdmi-output-3: HDMI / DisplayPort 4 (priority: 5600, latency offset: 0 usec, not available)
Properties:
device.icon_name = "video-display"
Part of profile(s): output:hdmi-stereo-extra3, output:hdmi-stereo-extra3+input:analog-stereo, output:hdmi-surround-extra3, output:hdmi-surround-extra3+input:analog-stereo, output:hdmi-surround71-extra3, output:hdmi-surround71-extra3+input:analog-stereo
hdmi-output-4: HDMI / DisplayPort 5 (priority: 5500, latency offset: 0 usec, not available)
Properties:
device.icon_name = "video-display"
Part of profile(s): output:hdmi-stereo-extra4, output:hdmi-stereo-extra4+input:analog-stereo, output:hdmi-surround-extra4, output:hdmi-surround-extra4+input:analog-stereo, output:hdmi-surround71-extra4, output:hdmi-surround71-extra4+input:analog-stereo
Card #1
Name: alsa_card.usb-KORG_INC._ToneLabST-00
Driver: module-alsa-card.c
Owner Module: 26
Properties:
alsa.card = "1"
alsa.card_name = "ToneLabST"
alsa.long_card_name = "KORG INC. ToneLabST at usb-0000:00:14.0-3, full speed"
alsa.driver_name = "snd_usb_audio"
device.bus_path = "pci-0000:00:14.0-usb-0:3:1.0"
sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.0/sound/card1"
udev.id = "usb-KORG_INC._ToneLabST-00"
device.bus = "usb"
device.vendor.id = "0944"
device.vendor.name = "KORG, Inc."
device.product.id = "0201"
device.product.name = "ToneLabST"
device.serial = "KORG_INC._ToneLabST"
device.string = "1"
device.description = "ToneLabST"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-usb"
Profiles:
input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority: 60, available: yes)
input:iec958-stereo: Digital Stereo (IEC958) Input (sinks: 0, sources: 1, priority: 55, available: yes)
output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority: 6000, available: yes)
output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority: 6060, available: yes)
output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (sinks: 1, sources: 1, priority: 6055, available: yes)
output:iec958-stereo: Digital Stereo (IEC958) Output (sinks: 1, sources: 0, priority: 5500, available: yes)
output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (sinks: 1, sources: 1, priority: 5560, available: yes)
output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (sinks: 1, sources: 1, priority: 5555, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: output:analog-stereo+input:analog-stereo
Ports:
analog-input: Analog Input (priority: 10000, latency offset: 0 usec)
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:iec958-stereo+input:analog-stereo
iec958-stereo-input: Digital Input (S/PDIF) (priority: 0, latency offset: 0 usec)
Part of profile(s): input:iec958-stereo, output:analog-stereo+input:iec958-stereo, output:iec958-stereo+input:iec958-stereo
analog-output: Analog Output (priority: 9900, latency offset: 0 usec)
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-stereo+input:iec958-stereo
iec958-stereo-output: Digital Output (S/PDIF) (priority: 0, latency offset: 0 usec)
Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereo, output:iec958-stereo+input:iec958-stereo
答案1
编辑 - 更简短/简单的答案:您可以通过使用 ToneLabs 作为主声卡来解决这个问题,如果您需要笔记本电脑扬声器/耳机插孔输出,请使用 alsa_out。
使用外部 USB ToneLabs 卡启动 JACK(它也有输出,对吗?)- 使用 QJackControl(选择 alsa,从设备列表中选择 ToneLabsST)和 44100Hz 采样率 - 或者在命令行上:
$ jackd -d alsa -d hw:1 -r 44100
在终端/命令行中,使用您的内置声卡以该声卡能够达到的速率运行 alsa_out:
$ alsa_out -d hw:0 -r 48000 -j IntelHDA
(保持终端打开 - 您可以使用 CTRL-C 停止该命令的运行)。
现在您的插孔(在 QJackControl 的连接窗口/选项卡或 Patchage 中)应该具有与 ToneLabST 对应的“系统”输入和输出端口,但另外还具有一个名为 IntelHDA 的“可写客户端”,这是您的内部声卡。您现在可以随心所欲地修补任何东西。
额外奖励:alsa_in
您还可以将笔记本电脑的麦克风添加到混音中。
使用虚拟驱动程序的更长、更旧的答案:
您还可以通过在 jack 和 alsa_in 和 alsa_out 命令中使用虚拟驱动程序来将具有不同采样率的不同声卡额外连接到 jack 服务器来解决此问题。
根据上面提供的信息,我认为您的内置声卡(您想要为扬声器提供声音输出)无法达到 44100Hz 的采样率,而您的外部设备 Korg ToneLabs ST 需要(或可能无法在 44100HZ 之外运行)。因此解决方案可能(!)如下所示:
使用虚拟驱动程序在命令行中以 44100Hz 采样率启动 JACK(在 QJackCtl 中也可以):
$ jackd -d dummy -r 44100
在另一个终端窗口中运行 alsa_in(这是您的输入 - ToneLabs usb 连接),采样率为 44100:
$ alsa_in -d hw:1 -r 44100 -j ToneLabs
在另一个终端窗口中运行 alsa_out(您的输出 - 计算机集成声卡),采样率为 48kHz(因为这是它的全部功能):
$ alsa_out -d hw:0 -r 48000 -j IntelHDA
(顺便说一句:-j 参数是可选的,它只是提供了 jack 客户端的名称)
在 QJackCtl 的连接选项卡/窗口中,您应该将 ToneLabs 设置为“可读客户端/输入端口”,将 IntelHDA 设置为“可写客户端/输出端口”,以及系统端口。系统端口是虚拟端口,它们不会产生任何结果。但其他两个是您的两张不同的声卡 - 输入为 ToneLabs,输出为 intel_HDA。
我认为实际上也可以像第一步那样直接使用 ToneLabs 作为主 ALSA 设备(而不是虚拟驱动程序)启动 JACK,然后只需(如第三步所示)提供一个额外的 alsa_out 端口,即具有不同 48kHz 速率的集成 IntelHDA 输出卡/扬声器/耳机。这样,您实际上可以即时将任何支持插孔的应用程序修补到笔记本电脑的输出或 ToneLabs 输出。
奖励:通过使用 PulseAudio 中的插孔模块,您还可以从浏览器等“常规”应用程序路由输出,或将您的现场播放输入到 Skype 通话中!