Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
No sound using JACK sound server [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Sat Jul 24, 2021 7:27 am    Post subject: No sound using JACK sound server [solved] Reply with quote

Hi,

I'd like to use JACK for some applications but I can't get any sound out of it. What I did is

Code:
emerge jack2


add my user to the realtime group, enable the jack USE flag, and

Code:
emerge -uND world

.

However, when after starting the server with qjackctl I try to play some track using mpv
Code:
mpv -ao=jack <some file>
, I don't get any sound. In principle, the setup seems to be fine because, even though I don't hear anything, when I run mpv there is no error (as if it were actually playing), and I can see the "CPU usage" in qjackctl increase. It's as though JACK output was muted, but I can't see no JACK-specific control in alsamixer.

I have the same problem when I try jack_simple_client, which (allegedly) plays a simple test tone.

Any clues?

Cheers.


Last edited by mani001 on Sun May 08, 2022 6:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Sat Jul 24, 2021 8:29 am    Post subject: Reply with quote

Did you configure it to talk to alsa and started it?
I used Cadence to tweak a few options (e.g. my bridge type is set to Alsa->Jack plugin) and ensure jack is started when I login:
Code:

~ $ cat .bash_login
jack_control start


Actually, try starting it first.
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Sat Jul 24, 2021 11:27 am    Post subject: Reply with quote

Quote:
Did you configure it to talk to alsa and started it?


Maybe...what does that imply? :D I have alsa selected as "Driver" in qjackctl. I was starting the server using the latter, but I also tried Cadence (with the Alsa->Jack plugin you mention), and maually, with identical result. Again, I think the music is playing because the DSP load in Cadence increases. Furthermore, if I stop the server, mpv spits a
Code:
[ao/jack] cannot open server

message, meaning that when I start the server something is going on.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Sat Jul 24, 2021 12:26 pm    Post subject: Reply with quote

Well, jack allows you to route sound in weird ways, so inspecting it's canvas may be a good idea.
Is your player connected to the speaker? Mind that it's only visible when it holds an open channel with jack server.
Are you even using the right audio device? AFAIK jack2 can only use one playback device at any time, and you probably have analogue (headphone jack) and digital (audio channel in HDMI), so that's a bare minimum of 2 devices.
Are your speakers connected to the one jack is using?
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Sun Jul 25, 2021 7:45 am    Post subject: Reply with quote

Quote:
Is your player connected to the speaker? Mind that it's only visible when it holds an open channel with jack server.


Sure, when I play something through ALSA (mpv without the -ao=jack) I hear sound.

Quote:
Are you even using the right audio device? AFAIK jack2 can only use one playback device at any time, and you probably have analogue (headphone jack) and digital (audio channel in HDMI), so that's a bare minimum of 2 devices.
Are your speakers connected to the one jack is using?


I think so, but I'm not sure. How can I check? In Advanced settings of QjackCtl, I have hw:PCH, 1 (ALC 1150 Digital) as ouutput and hw:PCH, 0 (ALC 1150 Analog) as input. I tried more things here but they all ended up with JACK not even being able to start. I have another sound device integrated in an NVIDIA card (HDMI), but it's not selected as output, so that shouldn't be it.

An extra bit of info: when I try to play something through JACK using mpv, checking the graph I can see two lines connecting mpv with system (out_0 to playback_1 and out_1 to playback_2). I would think that's fine, but I don't know.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Sun Jul 25, 2021 9:27 am    Post subject: Reply with quote

Quote:
An extra bit of info: when I try to play something through JACK using mpv, checking the graph I can see two lines connecting mpv with system (out_0 to playback_1 and out_1 to playback_2). I would think that's fine, but I don't know.
Ok, and when you play something with the default interface instead, do you see it as a source connected to speaker's sink in jack?
Can you detach it? And does it go silent when you do?
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Sun Jul 25, 2021 11:53 am    Post subject: Reply with quote

No, no connection if I don't pass --ao=jack to mpv (but I hear sound).

I don't see a sink for the speakers in the graph (might that be the problem?). This

https://www.dropbox.com/s/0y4e9srzt9nz7yk/Screenshot_20210725_134442.png?dl=0

is what I see when I use mpv with --ao=jack (and the server is running).
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Mon Jul 26, 2021 7:31 pm    Post subject: Reply with quote

Quote:
No, no connection if I don't pass --ao=jack to mpv (but I hear sound).
This bit, I have an impression that your jack bridge doesn't work.
Among the things I run, next to nothing is jack-aware, and yet it looks like THIS
Visible applications are web browser and speakertest, using default devices. And they do produce sound.

JACK routes audio streams, but ALSA is the one talking to your hardware. So, if your JACK is not talking to your ALSA, this is probably it.
I don't know how to fix it. Maybe switching to another bridge type would help. Maybe re-merging libraries (rebuild world with USE -jack, then again with USE=jack) could clean up some mess - it happens. Maybe it's something else, but still on this line.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 495

PostPosted: Mon Jul 26, 2021 10:01 pm    Post subject: Reply with quote

First, if you go into qjackctl set-up>>misc and uncheck "replace connections with graph button".
The graph is fine if you are trying to set-up filters etc, but for simple in->out the connections dialog is easier to work with.

If you are thinking jackd may not be attached to the correct alsa hardware, for testing leave the jackd command line alone and just use alsa_out, for example
Code:
/usr/bin/alsa_out -j HDMI_Audio -d hw:0,11 -c 2
Once alsa_out connects to your speakers/monitor etc it creates output port(s) in your jack client list, then you can just drag/drop a source to it and check if it's the hardware you are expecting.
My HDMI outputs have no reason to their numbering that I can discern, so I ran
Code:
for a in 0 1 2;do for b in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
do echo "hw:$a,$b"
alsa_out -j "$a,$b" -d hw:$a,$b -c2
done
done
and every time I got a valid connection, I connect a source to it and see if it's the monitor I'm looking for.
Once you get the working numbers for $a and $b you can put these in to your jackd command line (or qjackctl et al)

You also need to make sure that nothing else is connecting to the alsa hardware you want to use, pulseaudio and pipewire both do this by default.
You can obviously delete /etc/xdg/autostart/pipewire.desktop and /etc/xdg/autostart/pulseaudio.desktop to stop this behaviour, but the proper way to do it would be to copy both these files to ~/.config/autostart/ and append the line
Code:
Hidden=true
to each.

Finally, while messing around trying to get things working, clemantine has very good sound server awareness (can see alsa outputs, pulse and jack all in the prefs dialog), and the little vu-meter is helpful for telling when it's actually producing sounds during testing, just my 2c.
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Fri Jul 30, 2021 6:35 pm    Post subject: Reply with quote

Thank you both for your help.

Quote:
This bit, I have an impression that your jack bridge doesn't work.


Maybe, but in Cadence I tried every possibility in "Bridge Type" to no avail.

Quote:
Once alsa_out connects to your speakers/monitor etc it creates output port(s) in your jack client list, then you can just drag/drop a source to it and check if it's the hardware you are expecting.


I tried your bash loop, but I get an error at every iteration. Essentially, at every iteration I get a chunk like this

Code:
hw:0,0
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.18
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2021 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit


ATTENTION: The playback device "hw:0" is already in use. Please stop the application using it and run JACK again
JackTemporaryException : now quits...
Released audio card Audio0
audio_reservation_finish
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
jack server not running?


Strangely enough I also get

Code:
ATTENTION: The playback device "hw:0" is already in use. Please stop the application using it and run JACK again


even when I write, e.g., (for hw 1)

Code:
alsa_out -j "1,3" -d hw:1,3 -c2


8O

Code:
You also need to make sure that nothing else is connecting to the alsa hardware you want to use, pulseaudio and pipewire both do this by default.


I don't use pulseaudio or pipewire, just plain ALSA.

Quote:
Finally, while messing around trying to get things working, clemantine has very good sound server awareness (can see alsa outputs, pulse and jack all in the prefs dialog), and the little vu-meter is helpful for telling when it's actually producing sounds during testing.


Clementine is quite nice for this, indeed :) It happens the same as with mpv: in the vu-meter I can see that something is playing but I can't hear anything. That's when i choose "Default device on Output audio to JACK server" (or "Default device on Virtual audio sink for internal process communication" but the latter might be unrelated...just applying trial and error). On the other hand, when I choose "Default device on Output to a sound card via ALSA" I can hear the song playing.
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 495

PostPosted: Fri Jul 30, 2021 8:12 pm    Post subject: Reply with quote

The error chunks from the bash loop are leading me to ask what is starting jackd?
I don't know about cadence but qjackctl can write to ~/.jackdrc, and if it ends up with an errant set of options, just causes further confusion.
Try starting jack from a terminal with jackd -d dummy, as long as the "default" server is not running it should start and connect to nothing. Now if you get a "device already in use" running the loop you know it's from some external source. The three states I expect to see when looping are below
Code:
hw:0,0
Capture open error: No such file or directory
hw:0,1
Capture open error: Device or resource busy
hw:0,3
selected sample format: 32bit
**ctrl-c**
hw:0,4
selected sample format: 32bit
plus you'll get an alsalib error if your try to connect to a non-existent card.
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Sun Aug 01, 2021 8:36 am    Post subject: Reply with quote

I got the alsa_out thing working. My bad: I was starting JACK with qjackctl (as a user), but running your loop as root (at some point, for some reason I though you needed root privileges to run alsa_out) :oops: Anyway, now I start JACK with qjackctl, and your loop stops at hw:1,{3, 8, 9, 10, 11, 12}, which, according to qjackctl, are associated with HDMI, but it doesn't "engage" with hw0, which I believe is my speakers output.

If I run

Code:
jackd -d dummy


and execute your loop again, I also get (besides all the hw:1 stuff), hw:0,1 as a valid interface. So, I guess you are right and something is "taking hold" of my speakers. I'm running KDE...might that be it? It seems that in the good ol' days phonon could capture your device and things get messy

https://bbs.archlinux.org/viewtopic.php?id=90520

but this is a 10+ years old post, and I can't find anything seemmingly related among KDE's settings.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Sun Aug 01, 2021 8:54 am    Post subject: Reply with quote

Quote:
So, I guess you are right and something is "taking hold" of my speakers

Uhm... dmix?

What does aplay -L report on your machine actually?
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Mon Aug 02, 2021 2:11 pm    Post subject: Reply with quote

aplay -L returns

Code:
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=PCH
    HDA Intel PCH, ALC1150 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC1150 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    Front output / input
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCH,DEV=0
    HDA Intel PCH, ALC1150 Digital
    IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
    HDA NVidia, HDMI 1
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
    HDA NVidia, HDMI 2
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
    HDA NVidia, HDMI 3
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=4
    HDA NVidia, HDMI 4
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=5
    HDA NVidia, HDMI 5
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=6
    HDA NVidia, HDMI 6
    HDMI Audio Output
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Mon Aug 02, 2021 6:21 pm    Post subject: Reply with quote

An this one is mine.
Code:
$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
lavrate
    Rate Converter Plugin Using Libav/FFmpeg Library
jack
    JACK Audio Connection Kit
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
sysdefault:CARD=PCH
    HDA Intel PCH, ALC257 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC257 Analog
    Front output / input
surround21:CARD=PCH,DEV=0
~/snip/~

I'm using ALSA ->JACK (plugin) as a bridge. And sure enough, alsa offers JACK device.
Now, I don't really know how sound subsystems work, so take it with a grain of salt, but this is another thing that suggests me that your jack is not connected to alsa
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3595

PostPosted: Mon Aug 02, 2021 7:38 pm    Post subject: Reply with quote

using USE=jack as much as possible here.
Some removable USE flags may remain:
Code:
grep -hv '^#'  /etc/portage/package.use/* | sort | grep '\( alsa\| apulse\| jack\| pulseaudio\)'
app-emulation/qemu alsa
dev-java/openjdk alsa
lxde-base/lxpanel alsa
media-gfx/blender jack
media-libs/libsdl alsa
media-libs/openal jack
media-libs/portaudio alsa
media-libs/portaudio jack
media-plugins/alsa-plugins jack
media-plugins/calf jack
media-sound/ardour jack
media-sound/audacity jack
media-sound/cadence pulseaudio
media-sound/ecasound jack
media-sound/hydrogen jack
media-sound/jack2 alsa
media-sound/mpd jack
media-sound/pulseaudio jack
media-sound/sndpeek jack
media-sound/sonic-visualiser jack
media-sound/spotify pulseaudio
media-tv/kodi alsa
media-tv/kodi pulseaudio
media-video/ffmpeg alsa
media-video/ffmpeg jack
media-video/mplayer jack
media-video/mpv jack
media-video/pipewire alsa
www-client/firefox jack
I recall having fixed issues with
Code:
kill -9 $(pgrep jackdbus)
rm ~/luc/.asoundrc
then restarting jackdbus via cadence if required.
Using
Code:
Installed versions:  9999(2)*l(17:04:01 01/08/2021)(alsa dbus libsamplerate pam -classic -doc -ieee1394 -metadata -opus -readline -sndfile ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" PYTHON_SINGLE_TARGET="python3_9 -python3_8")
Hope it helps.
Thks 4 ur attention, interest & support
_________________
USE="-* ..." in /etc/portage/make.conf here.
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Wed Aug 04, 2021 2:40 pm    Post subject: Reply with quote

I have the "jack" USE flag enabled globally, so that shouldn't be an issue.

Code:
pgrep jackdbus


returns nothing when JACK is started (through qjackctl). Is it pulseaudio-related? Not sure whether it should be running...
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Thu Aug 05, 2021 11:47 pm    Post subject: Reply with quote

It is running on my system.
AFAIR jack2 requires dbus, so yeah, it probably should be.
Back to top
View user's profile Send private message
mani001
Guru
Guru


Joined: 04 Dec 2004
Posts: 485
Location: Oleiros

PostPosted: Sun May 08, 2022 6:51 pm    Post subject: Reply with quote

For future reference: this worked itself out... From what I read somewhere (can't remember) I think the problem was due to was some kind of bug in the previous ALSA version (1.2.4). Anyway, adding [solved].
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum