Connecting to alsa plug layer (44100Hz projects with 48000Hz-capable soundcard)?


(Luka) #1

Hi,

just got a brand new ThinkPad X1 Carbon 6. It comes with an intel hda a.k.a. RealTek intergrated soundcard that I would love to use with Ardour. The only problem seems to be that it (or kernel module) supports only 48000Hz sampling rate (see below)

While I’m trying to find out if there is anything that can be done with the kernel module to support 44100 sampling rate, I was wondering if Ardour can connect to the plug layer of ALSA system where sampling rate conversion can happen. Or is there any other way where I could actually use Ardour in 44100Hz mode using an internal card that is able to accept/output only 48000Hz sampling rate?

I don’t need this for high-end professional work, just so I can work on ardour project while on the road and don’t need to connect an external audio interface everytime, so the latency can be high and software sampling rate conversion artifacts are acceptable.

aplay -L reports

[...]
hw:CARD=PCH,DEV=0
    HDA Intel PCH, ALC285 Analog
    Direct hardware device without any conversions
[...]
plughw:CARD=PCH,DEV=0
    HDA Intel PCH, ALC285 Analog
    Hardware device with all software conversions

I tried JACK to use plughw device, but:

$ jackd  -d alsa -d plughw:PCH,0 -r 44100
jackdmp 1.9.12
[...]
creating alsa driver ... plughw:PCH,0|plughw:PCH,0|1024|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit float little-endian
You appear to be using the ALSA software "plug" layer, probably
a result of using the "default" ALSA device. This is less
efficient than it could be. Consider using a hardware device
instead rather than using the plug layer. Usually the name of the
hardwa
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit float little-endian
You appear to be using the ALSA software "plug" layer, probably
a result of using the "default" ALSA device. This is less
efficient than it could be. Consider using a hardware device
instead rather than using the plug layer. Usually the name of the
hardwa
ALSA: cannot set period size to 1024 frames for playback
ALSA: cannot configure playback channel
Released audio card Audio0
audio_reservation_finish
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server

Creating my own .asoundrc fails too (probably doing something wrong here anyway):

$ cat .asoundrc 
pcm.mainout {
	type hw
	card 0
	device 0
}

pcm.!default {
	type plug
	slave.pcm "mainout"
}

$ jackd -d alsa -d default -r 44100
jackdmp 1.9.12
[...]
creating alsa driver ... default|default|1024|2|44100|0|0|nomon|swmeter|-|32bit
configuring for 44100Hz, period = 1024 frames (23.2 ms), buffer = 2 periods
ALSA: mmap-based access is not possible for the capture stream of this audio interface
ALSA: cannot configure capture channel
Released audio card Audio0
audio_reservation_finish
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server

The complete output from alsa-info is here: http://www.alsa-project.org/db/?f=19218cb76746b39c4b137bc76931524b9a3caac0 where among others you can also see

Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
...
Node 0x06 [Audio Output] wcaps 0x411: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM

funny thing is that the INPUT actually seems to support other rates too!

I’d be grateful for any clarifications or pointers!


(Robin Gareus) #2

A much simpler way it to start jackd with the no soundcard at the target-rate and then add soundcards using zita-ajbridge or alsa_in/out.

jackd -d dummy -r 44100

alsa_in -d hw:0 -r 48000
alsa_out -d hw:0 -r 48000

(Luka) #3

Robin,
you are a godsend.
This works like a charm, thank you very very much!!!
:heart::heart::heart::heart:


(Luka) #4

considering that this will be a permanent system setup, is there a way to configure default jack connections so that default connection is alsa_out and not system (dummy)? I know I can use QJackCtl to setup this in a way, but I am thinking about some config file that jack is listening to - like .jackrc or something?