0

I'm using jack2 on Ubuntu 16.04 LTS by installing jack, jack-tools and qjackctl from the official repositories.

My USB sound connection feeds 44100 Hz into jack. Jack is configured (through qjackctl) to run at 44100 Hz. However, it automatically changes to 48000 Hz on run, causing the pitch from the speakers to be about 2 notes higher and the following message to show:

ERROR: playback and capture sample rates do not match (48000 vs. 44100)

I've read through tons of (very old) discussion about sampling rates having to do with jack, alsa, or pulse audio, and adding a file called .asoundrc which doesn't seem to do anything anymore. But either way, this is all out of my league. I just want to change the "playback sample rate" to 44100 Hz. Can someone explain what steps I should take in 2018 (or 2016 - Ubuntu 16.04) just so jack won't play back my 44100 Hz input as 48000 Hz?


USB device:

$ 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

Possibly related reports:


Update August 2018

I did a fresh installation of Ubuntu 18.04 LTS and tried this again.

sudo apt update
sudo apt install jack jack-tools qjackctl 
env QT_SCALE_FACTOR=1.5 qjackctl

At this time I'm plugging in the ToneLab ST USB cable. I'm experiencing the same problem. Notice how the frequencies mismatch.

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)

By request, here's 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

And here is 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
  • Please show the contents of /proc/asound/cardX/stream0 of the USB device. – CL. Mar 20 '18 at 17:53
  • @CL. - I've updated the description with the output of stream0. – Redsandro Mar 20 '18 at 23:19
  • How exactly are you running Jack? Where did you configure the 44.1 kHz? – CL. Mar 21 '18 at 7:53
  • @CL. Running and configuring through qjackctl. – Redsandro Mar 21 '18 at 10:35
  • please add audio device information.aplay -l and pactl list cards. Possible that Korg USB device may require 48kHz. JACK will sometimes run better set to 48kHz than 44.1kHz with audio interfaces. Pulseaudio can usually cope with samplerate change no problem, but settings can be adjusted easily to use 48kHz samplerate if needed – nik gnomic Aug 13 '18 at 15:25
0

EDIT - shorter/simple answer: You can solve this by using ToneLabs as your main soundcard and, if you need the output from laptop's speakers/headphone-jack output, use alsa_out.

  1. Start JACK with your external USB ToneLabs card (it has an output too, right?) - either with QJackControl (choose alsa, and from devices list choose ToneLabsST) and 44100Hz sampling rate - or on the commandline:

    $ jackd -d alsa -d hw:1 -r 44100
    
  2. in the terminal/command-line, run alsa_out with your internal soundcard at the rate that that card is capable of:

    $ alsa_out -d hw:0 -r 48000 -j IntelHDA
    

(keep the terminal open - you can stop that command running with CTRL-C).

Now your jack (in QJackControl's connections window/tab, or Patchage) should have 'system' in and out ports corresponding to ToneLabST, but additionally also have a 'writable client' called IntelHDA, which is your internal soundcard. You can now patch things however as you like.

BONUS: With alsa_in you could also add your laptop's mic to the mix.


Longer, old answer using dummy driver:

You can also solve this by using dummy driver in jack and alsa_in and alsa_out commands to additionally connect different soundcards with different sampling rates to the jack server.

According to the info provided above I figure that your internal soundcard - which you want to provide the sound output to your speakers is not capable of 44100Hz sampling rate, and your extrernal unit Korg ToneLabs ST wants (or is possibly unable to run outside of) 44100HZ. So the solution could (!) look something like this:

  1. Start JACK with a dummy driver and with 44100Hz sampling rate in command line (also possible in QJackCtl):

    $ jackd -d dummy -r 44100
    
  2. In another terminal window run alsa_in (this is your input - ToneLabs usb connection) with sampling rate 44100:

    $ alsa_in -d hw:1 -r 44100 -j ToneLabs
    
  3. in another terminal window run alsa_out (your output - computer integrated soundcard) with 48kHz sampling rate (because that's all it's capable of):

    $ alsa_out -d hw:0 -r 48000 -j IntelHDA
    

(BTW: the -j parameter is optional, it's just provides a name of the jack client)

In the connections tab/window of QJackCtl you should end up with ToneLabs as a 'Readable Client/Input Port', IntelHDA as 'Writable Client/Output Port' and also system ports. System ports are dummy ones, they lead to nothing. But the other two are your two different soundcards - ToneLabs on input, and intel_HDA on output.

I think it would actually also be possible to start JACK directly with ToneLabs as the main ALSA device (as opposed to dummy driver) as in step one, and then just - as in step three - provide an additional alsa_out port, which is your integrated IntelHDA output card/speakers/headphones with a different, 48kHz rate. This way you can actually patch any jack-aware application to either laptop's output or ToneLabs output on the fly.

BONUS: By using jack modules in PulseAudio you can also route output from 'normal' apps like your browser, or input your live playing into a skype call!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.