Author Topic: Pulseaudio wierdness  (Read 4282 times)

defunked

  • Newbie
  • *
  • Posts: 24
    • View Profile
Pulseaudio wierdness
« on: April 27, 2019, 11:40:01 am »
Having updated to SF 3.0.3.8, I though I would see if anything had changed with the Pulse Audio speaker/headphone situation:

Speakers continue to operate when headphones are plugged in, and headphone are mono.

Unfortunately, no change with 3.0.3.8.  However, I can still use shell commands to force the pulse audio system to switch:

pactl set-sink-port 0 output-wired_headphone
pactl set-sink-port 0 output-wired_headset
pactl set-sink-port 0 output-speaker

Note that headphones and headset both seem to route to only the headphone jack, resorting stereo operation.  And I found a nice GUI program on open-repos simply called "audio output" which lets me change the audio output from the touch interface.  So things are looking good.

All going well until I discover that using the Media application, every time a song finishes playing and a new one starts through the headphones, the volume drops by about 10 dB. If I switch pulse audio audio sink between  output-wired_headphone and  output-wired_headset, levels are restored.  But I need to toggle after every song. Pulse Audio isn't showing any volume change.  So I assume it's some hardware adaptation problem with a hardware course gain setting being reset in the audio codec IC.

Is anyone else seeing this?  And idea what it might be?

Ethan...

vader

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Pulseaudio wierdness
« Reply #1 on: April 29, 2019, 08:59:17 am »
Quote from: defunked
Having updated to SF 3.0.3.8, I though I would see if anything had changed with the Pulse Audio speaker/headphone situation:

Speakers continue to operate when headphones are plugged in, and headphone are mono.

Same thing happened in 2.x as well. A bit dissapointing really.

Quote from: defunked
Note that headphones and headset both seem to route to only the headphone jack, resorting stereo operation.  And I found a nice GUI program on open-repos simply called "audio output" which lets me change the audio output from the touch interface.  So things are looking good.

Good call! I've installed it as well now. The 10 dB problem seems to be across the board. I wrote a little sensors daemon which watched the headphone port and toggled the speakers/headphones appropriately. I had the same issue, and ended up removing it because I had to manually set it anyway.

I'll temper this next bit with the admission that I have been using linux since day 1 - and I actually mean the day Linus posted to comp.os.minix asking if anyone wanted to give his project a try. The two things I hate, no loathe most about modern linux are pulseaudio and systemd. Leaving systemd for another day, my reasons for disliking pulseaudio is that it is so grossly overcomplicated, and has many "features" which lay undiscovered until you really need it. Now I am actually a pretty good programmer, however I still haven't got sailfish (pulseaudio) audio working even close to well. When talking on the phone, the microphone and earpiece are on the same side. Such a simple thing to change you might ask.....I had the same 10dB issue, which resisted all automatic fixes and relied on swapping back and forth. Ironically, bluetooth headsets work flawlessly. I was seriously thinking of removing it and going back to alsa, but it is engrained in sailfish, so I ended up leaving it be.

Anyway, I feel better now I've had a little rant. I totally agree with "audio wierdness". Unfortunately it is mostly by design.

Adam Boardman

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Pulseaudio wierdness
« Reply #2 on: April 29, 2019, 10:19:16 am »
Quote from: vader
Now I am actually a pretty good programmer, however I still haven't got sailfish (pulseaudio) audio working even close to well.
You may want to take the pulseaudio (buster branch) work from gemian back to sailfish (as of 21st April commit its based upon the latest sfos droid module), I've added support for separation of mic/spk based upon orientation and there are plug-ins to support changing audio routing based upon plugging of devices, which seemed to work. You should update your android based system.img in /data/ to get stereo working on the speakers (I think that the gemian one also has all the stuff needed for sfos, Nikita would know for sure).

You'd need to compare the contents of gemian/pulseaudio/src/modules/droid/ and sfos/pulseaudio-modules-droid/src/droid/ (and ../common) we have slightly different directory structures but the files have the same names so shouldn't be too difficult to figure out what to compare to what and extract the bits you need. You'll also need to add the parts that poke '/proc/headphone_cs' from gemian-repowerd to sfos-mce or similar as that gives you the actual mic/spk-seperation.

We still have issues with the sensors service starting on boot in gemian so the orientation stuff needs a kick each reboot, would be interesting to hear if using the updated system.img has the same problems on sfos or not.

I don't usually monitor the sfos forum, so probably best to email me with any questions etc. This is the 'pretty good programmer' targeted version where I assume you know how to find all the sources etc.
« Last Edit: April 29, 2019, 10:19:37 am by Adam Boardman »

vader

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Pulseaudio wierdness
« Reply #3 on: April 29, 2019, 05:41:03 pm »
Quote from: Adam Boardman
You may want to take the pulseaudio (buster branch) work from gemian back to sailfish (as of 21st April commit its based upon the latest sfos droid module), I've added support for separation of mic/spk based upon orientation and there are plug-ins to support changing audio routing based upon plugging of devices, which seemed to work. You should update your android based system.img in /data/ to get stereo working on the speakers (I think that the gemian one also has all the stuff needed for sfos, Nikita would know for sure).

You'd need to compare the contents of gemian/pulseaudio/src/modules/droid/ and sfos/pulseaudio-modules-droid/src/droid/ (and ../common) we have slightly different directory structures but the files have the same names so shouldn't be too difficult to figure out what to compare to what and extract the bits you need. You'll also need to add the parts that poke '/proc/headphone_cs' from gemian-repowerd to sfos-mce or similar as that gives you the actual mic/spk-seperation.

Thanks for the heads up. I'll give it a go this weekend.

vader

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
Pulseaudio wierdness
« Reply #4 on: May 02, 2019, 04:10:25 am »
One other wierdness to watch out for - if you go back and forth between speaker and headphone, you will stop the phone ringtone (ie. it doesn't play any more). Luckily I had vibrate on, and saw the call, but the ringtone didn't play. I checked the ringtone volume and it was at max. Tried getting it back, but a reboot was required.

Hopefully pulseaudio can be fixed (or removed) in future iterations, as this is a deal breaker.

arisel

  • Newbie
  • *
  • Posts: 3
    • View Profile
Pulseaudio wierdness
« Reply #5 on: May 03, 2019, 03:44:01 am »
Quote from: vader
Hopefully pulseaudio can be fixed (or removed) in future iterations, as this is a deal breaker.

I know that might seem counter-intuitive as it further complicates things: But maybe just add jackd to the stack.  On desktop systems I've had good luck for the last several years using pulseaudio-jack to build the stack as follows: alsa -> jackd -> pulseaudio. That way all the complex routing can be done in jack. Alsa I normally just use for some base volume, buffer and samplerate settings. Pulseaudio is only used for application volume settings.