JACK: output from speakers but not from headphones.

I have a Sager 5160 laptop running Ubuntu 11.04. I am having a problem with JACK where sound comes out of the speakers fine, but when I plug headphones in the speakers cut out like they are supposed to, but nothing comes through the headphones.
The system works fine when I am just using the standard Ubuntu sound system so I’m not really sure what’s going on, can anybody help?

unfortunately, your understanding of how the sound in your laptop works is slightly flawed. the switch between output to the headphones and the speakers is not done by the hardware or the device drivers, but is left to other software. the device driver provides information that a headphone jack was inserted or removed, but its up to some other level of software to then change the state of the hardware’s mixer to alter the routing appropriately (or not at all). PulseAudio, a desktop sound system/server, will do this for you because it considers that part of its job.

JACK, however, does not consider this part of its job and is not interested in managing the state of your h/w mixer for you. JACK wasn’t designed to be used with consumer hardware that has this kind of design (although it does work with it for the most part), and it (almost) never does anything to alter the state of the h/w mixer that controls audio flow because we assume that, since you are using pro-audio and music creation applications, you have set it up the way you want it and you intend for it to remain that way.

older laptops (and even some desktop) soundcards did this output switch in hardware (e,g, my old HP Pavilion), but in recent years it has become more and more common to make the switch the responsibility of software. JACK just isn’t that software. if you want to do it by hand, you will need to use an application that controls the h/w mixer. alsamixer (run from a terminal window) is ugly but very functional. there are a few other GUI apps that do similar things but i can’t recommend any of them (unfortunately).

Thanks for the comprehensive reply paul, I thought it might be something like that, I was hoping I’d be able to use my internal soundcard for some quick editing when I’m about but it looks like I’m going to have to use an external card. Thanks anyway!
I will check out alsamixer anyway, see if I can get anything going.

EDIT: I found the solution, the headphones are presented as outputs 3 & 4 under system in the connections window. Thanks for your help!

It has been several years since you posted this answer; have any GUI apps come along enough for you to recommend them? I should mention I tried using JACK + Cadence + routing ALSA -> PusleAudio -> JACK, but while trying to get output over HDMI from Ardour, I got my system into a state where I got no audio from Chrome, Ardour 5, nor the music player app that comes with elementary os; not over HDMI, nor my laptop speakers, nor my headphone jack.

Intel HDA audio is an interesting setup. It appears to linux like one device but in general it is not. It is better to think of HDA as an audio bus (on the digital side) that may connect a number of audio devices to the system is a somewhat consistent manner. However, each device may have different capabilities in terms of available sample rates, buffer sizes and clock sharing. For example some laptops that appear to use a number of sample rates will only clock the internal mic at 48000 (I have one) which makes it sound bad when the SR is set to 44100 (the pulse default). The speaker and headphone out puts will generally handle buffer sizes down to 64/2 or 64/3 sample sizes and yet the hdmi will be 48000 only and the minimum buffer size may be as much as 8k. So assuming jackd is connected to the internal audio at a modest 1024/2 buffer size with the default 44100 SR and yet the output is set to the subdevice belonging to HDMI, the normal thing when the buffersize is smaller than the card will handle (when I have tried) is jackd crashes. Cadence may think jackd is running or at least trying to and so has pulse set up to not see any alsa devices and use jack only… so no sound.

So first thing, if you have not rebooted, is to killall -9 jackd jackdbus
Then when you open Cadence make sure you set it to only use one device, not internal sound and hdmi at the same time. Use either alsa_in and alsa_out to connect to hdmi… actually you will probably have to use zita-j2a to connect to hdmi as hdmi will probably use different settings from the internal device. Set zita-j2a to use a large buffer size of at least 4096, you may need double that though. Please note after all that, the audio out from the hdmi system will have noticeable delay. It is not meant to be used for real time use but rather synced so it’s delay matches that of the video for watching movies.

I am purposely talking about the worst hdmi implementations, there may be some that are not so bad, but I would suggest using setting that work with the worst case to get it working and then change the setting till it quits again to find out where your sweat spot is for your system. I don’t think any hdmi implementations use other than 48000 or higher (96000 for example but should work with 48000 anyway). This is not a matter an alsa mixer could help you with, though qasmixer is a nice GUI based mixer for all that. The idea that jack is made for professional audio interfaces still stands when all is said and many of the newer USB 2.0 audio device give alsa no controls at all and use “front panel controls” instead.

Please note that I am not saying that HDMI audio is inferior quality as it is digital all the way to your TV or “Receiver” and so it’s quality is dependent on the TV or receiver and their quality. However, the large buffer means the computer only has to deal with the audio once in a very long time (as computers go) and therefore has more time for other things like games and video rendering. The SW can sync the audio by either sending it early, or just making sure it is just as late as the video.

This is great info; thanks for the response. I not only rebooted, but I restored to a Timeshift daily snapshot, as the only thing of significance I had done since the time of the snapshot was try to get ALSA->JACK->PusleAudio working, and at my day job as a software engineer, I find it hard to stay focused without music playing in the background.

I’ve been trying to configure things this way because my current setup involves a relatively inexpensive Windows 10 tablet / laptop that has only SSD and no fan connected to my Behringer XENYX X2222USB. However, its disk space is limited, and its keyboard is super small, kind of a pain to use, as is the bluetooth keyboard I have for it (small and kind of a pain), so I was figuring it would be good to do my recording on that computer and my editing on my linux laptop (which I attach to a SmartTV over HDMI for plenty of screen real estate). Prior to trying to get JACK working, if I open a session with ALSA, it will only play over my laptop’s speakers (not even the bluetooth headphones), which is clearly suboptimal.

It sounds like what I really need to do is invest in some more hardware (better bluetooth keyboard and mouse for my recording computer, or a USB hub so I can connect more than just the mixer via USB; an external SSD for my recording computer; or just a better recording computer), or a lot of time to make things work the way I want.

I’ll have to give your suggestions a shot, once I have some time where I can revert to a snapshot if I need to without worrying about losing work.