thesofproject / sof

Sound Open Firmware
Other
540 stars 309 forks source link

[FEATURE] Is it possible to run sof and along with the Jack connection kit? #2572

Open buscon opened 4 years ago

buscon commented 4 years ago

Hi,

Is it possible to run sof and along with the Jack connection kit? I tried to do that but I get: Wed Mar 18 10:02:08 2020: creating alsa driver ... hw:sofsklhdacard|hw:sofsklhdacard|1024|3|48000|0|0|nomon|swmeter|-|32bit Wed Mar 18 10:02:08 2020: configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 3 periods Wed Mar 18 10:02:08 2020: ALSA: final selected sample format for capture: 32bit integer little-endian Wed Mar 18 10:02:08 2020: ERROR: ALSA: cannot set period size to 1024 frames for capture Wed Mar 18 10:02:08 2020: ERROR: ALSA: cannot configure capture channel Wed Mar 18 10:02:08 2020: Released audio card Audio0 Wed Mar 18 10:02:08 2020: ERROR: Cannot initialize driver Wed Mar 18 10:02:08 2020: ERROR: JackServer::Open failed with -1 Wed Mar 18 10:02:08 2020: ERROR: Failed to open server

lgirdwood commented 4 years ago

@buscon there should be nothing preventing this except maybe the topology doesn't support the jack config (I think you are also probably the first person to try Jack). Any chance you can share your dmesg, plus any other logs (sof-logger will dump FW logs). It does look like the topology you are using does not support 32bit via the PCM (but pipeline may do internally within DSP), can you try 24 or 16bit PCM ?

buscon commented 4 years ago

Thank you @lgirdwood for your answer.

Dmesg does log something else, maybe it tells you something? Here it is: [11276.589313] snd_hda_codec_realtek ehdaudio0D0: didn't find PCM for DAI Digital Codec DAI [11276.589314] snd_hda_codec_realtek ehdaudio0D0: ASoC: can't open codec Digital Codec DAI: -22 [11276.589315] Digital Playback and Capture: ASoC: BE open failed -22 [11276.589316] HDA Digital: ASoC: failed to start some BEs -22

Where do I find the sof-logger?

I tried setting Jack to 16bit but I get the same error.

plbossart commented 4 years ago

@buscon can you first try with plain vanilla aplay and use hw:0,0? I don't think I've seen anyone use the Digital (SPDIF) output as well. and please attach the full dmesg log and point us to the link where the alsa-info.sh results are stored, thank you

lgirdwood commented 4 years ago

@buscon sof-logger is part of the sof repo, IIRC scripts/build-tools.sh should build it.

buscon commented 4 years ago

@buscon can you first try with plain vanilla aplay and use hw:0,0? I don't think I've seen anyone use the Digital (SPDIF) output as well. and please attach the full dmesg log and point us to the link where the alsa-info.sh results are stored, thank you

I did not mention that, but pulseaudio works without problems, so aplay with hw:0,0 works too., The alsa-info.sh results are here: http://alsa-project.org/db/?f=178d7ffbb4b7854b1189531af241bf8019fb8cd7

Dmesg: dmesg.log

buscon commented 4 years ago

@buscon sof-logger is part of the sof repo, IIRC scripts/build-tools.sh should build it.

ok, so far I've been using the already compiled version, so I do not have that for now.

Sciss commented 2 years ago

Hi there. I think I run into the issue listed here. The sound card is listed by aplay as

card 1: sofhdadsp [sof-hda-dsp], device 0: HDA Analog (*) []

It works with Pulse Audio, and some ALSA applications like aplay, but jackd has lots of trouble with it. Finding a bug listed for Ubuntu, I managed to make them work together by setting the buffer size to 2016, and then forcing the jack client, in my case SuperCollider, on a block size that is an integer division of 2016, so 32. Also I have to select force-16-bit, otherwise sound is distorted.

Why is such an irregular block size that is not a power of two needed, and why it doesn't work with jack 32-bit? I think this is a bug not a feature request. Thanks

buscon commented 2 years ago

@Sciss thanks for your suggestion and temporary solution!

Now I managed to test your suggestion, on my system I can also use a buffer size of 1008, but not lower than that.

lgirdwood commented 2 years ago

@Sciss fwiw, the minimum (kconfig default) block size used by FW is 1ms at 48kHz, so 48 * frame size. Have you been able to try this block size with your buffer config ?

plbossart commented 2 years ago

IIRC we allowed the topologies to work with periods that were not aligned with 1ms, precisely for Jack support and power-of-two requirements. if this was the case, we might have a regression indeed.

@kv2019i does this rings a bell?

Sciss commented 2 years ago

if this was the case, we might have a regression indeed.

I should mention I run on Debian 11; perhaps it was fixed in a newer version?

$ sudo apt list --installed | grep sof
...
firmware-sof-signed/stable,now 1.7-1 all [installed]
Sciss commented 2 years ago

fwiw, the minimum (kconfig default) block size used by FW is 1ms at 48kHz, so 48 * frame size. Have you been able to try this block size with your buffer config ?

Ah, I see. Well, this means I can run, for example with jack buffer size 768, and keep my jack client SuperCollider at its own default of 64 samples (which must be an integer division of the jack buffer size). So that's not too bad, just weird in the sense that programs like QJackCtl suggest a power of two, and the normal defaults of jack (1024) don't work.

I don't know, however, if there are other jack based programs that cannot work outside the power-of-two assumption.