Page 2 of 3

Re: no speaker sound but when headphones are plugged in

Posted: Tue Oct 13, 2020 8:48 pm
by olo
thanks, can I just add the switch command into the
. Menu - Preferences - Startup Applications
Click Add - Custom command
or is it more complicated?
You already wasted tons of time on my stupid cheap hardware, I donĀ“t want to "monopolize" you.
For me it is fun to track down things what are stubborn, but that is my time I waste for my own little victory.
Anyhow your help is greatly appreciated :!:

Re: no speaker sound but when headphones are plugged in

Posted: Tue Oct 13, 2020 8:58 pm
by MrEen
LOL. You never wasted any of my time. I learn by helping others, so it's all good. :D

Yes, you have the right spot for the edit, but we need to change the command a little bit, as the interpreter is too basic to handle it properly. I'll also include a short timer, just to be safe. You can play with it if you like and find what works best. This is the command for that location:

Code: Select all

bash -c "sleep 5 && amixer -c1 set Headphone toggle && amixer -c1 set Speaker toggle"

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 5:19 am
by olo
weeeell, if it is fun for you too, far shall it from me to deprive you of it. - So lets get cracking :!:

When I after one full week of searching and trying the most exotic drivers on my little gem I finally found in a Yepo forum an identical computer and the working driver I had to celebrate. So I created the fitting startup message what after 4 years still sounds with every windows start. I shall adapt this for my Mint20C when we are finished.
(if you are interested, here is it for you: shorturl.at/dfzFK )

Back to work.
Re-enabled the HDMI
Bashed the startup
Restart aaaaaaand we have sound what greets us. - Hurray
Play mp3 and sound on full is loud and clear.
plug in headphones and the sound comes out softly from all 4 speakers while the player plays uninterrupted - Hmmmkey
unplug - no sound
replug - soft sound what can be amplified to loud sound same as after start up.
unplug again - player pauses.
Time to reboot.
... is there an instead reboot process what does the same reloading of drivers and such?

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 2:45 pm
by MrEen
Argh! I was a little bit afraid something like that might happen. While the startup command works for no headphones plugged in, you're going to need to do some manual changes when you do plug in headphones and again when unplugging them.

For testing purposes, it would still be best to reboot. There are commands to restart ALSA and PulseAudio, but you then to also restart the applications that play sound.

I think I have a better idea though if this will work on your machine. Install alsa-tools-gui (quick method is apt install alsa-tools-gui in the terminal) so you can run HDAJackRetask. When it opens, make sure the bytcht_es8316 is chosen in the upper left for Select a Codec (I'm hoping the program will allow you to do that.)

Next check the Parser hints box then in the pane that opens double click on inv_jack_detect up near the top until it says yes.

Finally click on Install boot override then reboot and see if everything works properly. You'll need to comment out your Startup Application before rebooting to test this.

I'm not positive HDAJackRetask will work with your codec. If it doesn't, I'll explain how to manually make the changes necessary for plugging and unplugging headphones.

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 3:06 pm
by olo
sorry upper left shows no codecs found, sorry
the jack says yes but the boot says no , I need a codec.
I did the codec install in the start menu during the setup

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 3:12 pm
by MrEen
I had a feeling it might do that. Sorry.

Okay, I suspect the same command is what's need each time:

Code: Select all

amixer -c1 set Headphone toggle && amixer -c1 set Speaker toggle
Try that, and if it works, you could just make a keyboard shortcut for it, instead of a Startup Application.

The issue here is the reverse jack detection, so when the headphones are plugged in, the system thinks you're unplugging them, so muting them. When you unplug them, the system is muting your speaker, thinking the headphones were just plugged in.

If that works, and you can live with it, great. There's a chance we can still automate the inv_jack_detect but I need to search a bit for that.

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 3:24 pm
by olo
that is the problem with editing a post, I posted some additional info
can I just install the missing codecs?

and please how did I make a keyboard shortcut out of this line?

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 3:29 pm
by MrEen
It's not that you're missing a codec. It's just the type you have isn't compatible with that software. That software only works with the snd-hda-intel audio driver, and your system doesn't use that. I hadn't thought of that when I made the suggestion.

The keyboard shortcut we'll work on after we know what commands are going to work.

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 3:35 pm
by olo
OK going to test later until tomorrow - Thank you

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 3:54 pm
by MrEen
You're welcome. And good luck again! :D

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 6:49 pm
by olo
OK switching works on the fly.
only little bug is, when in headphone mode sound is mono out of all 4 speakers
so the switch to headphones needs to disable the speakers and go to stereo ... pretty please if possible

Re: no speaker sound but when headphones are plugged in

Posted: Wed Oct 14, 2020 7:07 pm
by MrEen
Okay, maybe I assumed too much, and thought the Speaker was changing mute status on headphone events.

With the sound coming from everywhere, does this stop the speaker:

Code: Select all

amixer -c1 set Speaker toggle
This command will come in useful during testing:

Code: Select all

amixer -c1 | head -n 20

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 2:22 pm
by olo
boot
no sound
input MrEen 1
stero output speakers

Code: Select all

~$ amixer -c1 set Headphone toggle && amixer -c1 set Speaker toggle
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 3
  Mono:
  Front Left: Playback 3 [100%] [0.00dB] [off]
  Front Right: Playback 3 [100%] [0.00dB] [off]
Simple mixer control 'Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
input MrEen 2
Speaker off
Headphone output in MONO

Code: Select all

amixer -c1 set Speaker toggle
Simple mixer control 'Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
input MrEen 3
no change in headphone mode

Code: Select all

$ amixer -c1 | head -n 20
ALSA lib tlv.c:108:(snd_tlv_parse_dB_info) Too big dB_scale TLV size: 264
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 3
  Mono:
  Front Left: Playback 3 [100%] [0.00dB] [off]
  Front Right: Playback 3 [100%] [0.00dB] [off]
Simple mixer control 'Headphone Mixer',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 11
  Front Left: 4 [36%] [-6.00dB]
  Front Right: 4 [36%] [-6.00dB]
Simple mixer control 'Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Mic Boost',0
  Capabilities: pswitch pswitch-joined
restart and post for later editing
there and back again

input MrEen 2
turns sound on or of in headphone or speaker mode

restart and post for later editing
there and back again

input MrEen 1
stereo speaker playback
input MrEen 3
no effect

Code: Select all

$ amixer -c1 | head -n 20
ALSA lib tlv.c:108:(snd_tlv_parse_dB_info) Too big dB_scale TLV size: 264
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 3
  Mono:
  Front Left: Playback 3 [100%] [0.00dB] [off]
  Front Right: Playback 3 [100%] [0.00dB] [off]
Simple mixer control 'Headphone Mixer',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 11
  Front Left: 4 [36%] [-6.00dB]
  Front Right: 4 [36%] [-6.00dB]
Simple mixer control 'Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Mic Boost',0
  Capabilities: pswitch pswitch-joined
end of test cycle...
waiting for input from MrEen

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 4:24 pm
by MrEen
Okay, this is quite difficult to troubleshoot from a distance.

From the looks of your options, you only have a single speaker in that device, which is why it shows Mono. When the system thinks it's supposed to be outputting to the speaker, but is actually outputting to the headphones, you appear to me getting mono there.

I'd like you to run alsamixer -c1 in the terminal. You'll see the Headphones and Speaker options at the beginning. Play with both the volume adjustments using the up and down arrow keys, as well as the Mute status, which is done with the m key. Muted columns show MM at the bottom instead of OO.

See if you can use that to fix the sound in every scenario. You can keep the original boot command to have working speakers at bootup, but it's not looking likely that we can automate the proper switches when the headphones get plugged and unplugged.

I almost wonder if the Speaker and Headphone options are reversed somehow. But that's not something I've ever seen before. In fact, I know it's not that case because of the first command working they way we want.

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 7:26 pm
by olo
there is just the mono headphone slider doing anything, the others I can move without results.
Speaker slider sits on 0.
Switching the output shows no different result in the mixer. rebootet and tested separat.

I think, as I mentioned in my initial post, in windows I needed a rare driver for this crazy sound card.
Searching for the name, the mixer shows the same name in the card info, I came across this pages.
It is my processor and card and Linux info but I have no idea to do with it, maybe you understand it.
https://code.woboq.org/linux/linux/soun ... 316.c.html
the es8316 is the sound card
https://github.com/torvalds/linux/blob/ ... s/es8316.c

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 7:35 pm
by olo
here seems to be a solution, i hope you can understand it
https://askubuntu.com/questions/1034619 ... untu-18-04

$ dmesg | grep 8316
[ 11.456660] bytcht_es8316 bytcht_es8316: quirk IN1_MAP enabled
[ 11.456665] bytcht_es8316 bytcht_es8316: quirk MONO_SPEAKER enabled
[ 11.580490] bytcht_es8316 bytcht_es8316: snd-soc-dummy-dai <-> media-cpu-dai mapping ok
[ 11.581128] bytcht_es8316 bytcht_es8316: snd-soc-dummy-dai <-> deepbuffer-cpu-dai mapping ok
[ 11.612126] bytcht_es8316 bytcht_es8316: ES8316 HiFi <-> ssp2-port mapping ok
[ 11.634343] input: bytcht-es8316 Headset as /devices/pci0000:00/808622A8:00/bytcht_es8316/sound/card1/input14

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 7:47 pm
by MrEen
Sorry, I screwed up a bit. The Speaker column is just a switch, with no volume controls. It is either muted or not muted as the only options.

That code stuff you linked to is already in the kernel.

I looked a bit more through the far too many options, and maybe your headphones are actually being control by these options:

Code: Select all

Simple mixer control 'Left Headphone Mixer LLIN',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Left Headphone Mixer Left DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
You just have too many options to know what to do with them. I briefly thought this one might matter:

Code: Select all

Simple mixer control 'DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 192 [100%] [0.00dB]
  Front Right: Playback 192 [100%] [0.00dB]
And this line very near the top of the amixer output might be a cause of your issues:

Code: Select all

ALSA lib tlv.c:108:(snd_tlv_parse_dB_info) Too big dB_scale TLV size: 264
And here's more headphone items:

Code: Select all

Simple mixer control 'Left Headphone Mixer LLIN',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Left Headphone Mixer Left DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Left Headphone Mux',0
  Capabilities: enum
  Items: 'lin1-rin1' 'lin2-rin2' 'lin-rin with Boost' 'lin-rin with Boost and PGA'
  Item0: 'lin1-rin1'
Simple mixer control 'Right Headphone Mixer RLIN',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Right Headphone Mixer Right DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Right Headphone Mux',0
  Capabilities: enum
  Items: 'lin1-rin1' 'lin2-rin2' 'lin-rin with Boost' 'lin-rin with Boost and PGA'
  Item0: 'lin1-rin1'
I'm afraid I just don't know the magic formula for this codec.

All of the above stuff is in alsamixer. Just keep hitting the right arrow key, and sometime in the next few days you'll get to the end of all the options. :lol:

Just saw your new post, so looking at the link now.

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 7:54 pm
by MrEen
I don't know if this will help or not, but it's worth a try:

Code: Select all

sudo tee /etc/modprobe.d/sof-fix.conf <<<'options snd-intel-dspcfg dsp_driver=1'
Reboot after running that in the terminal and see if there any difference. If it didn't help, thy this instead:

Code: Select all

sudo tee /etc/modprobe.d/sof-fix.conf <<<'options snd-intel-dspcfg dsp_driver=2'
Reboot and test again, and if still no help, remove it with this:

Code: Select all

sudo rm /etc/modprobe.d/sof-fix.conf

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 7:57 pm
by MrEen
And the link you last posted was of no real help I'm afraid. There have too many changes since that post and the outputs are different anyway.

Re: no speaker sound but when headphones are plugged in

Posted: Fri Oct 16, 2020 8:18 pm
by olo
thanks, the above did not work, I think we stick with putting switch 1 in the autostart again and you wanted to tell me how I can make a keyboard shortcut, icon etc to just switch via command 2