We have moved to a new Sailfish OS Forum. Please start new discussions there.
1

Downmix to mono with headphones?

asked 2014-10-20 16:57:40 +0300

Tegu gravatar image

updated 2014-10-20 17:01:35 +0300

Is it possible to downmix stereo sound to while using the headphone output plug? Ideally it could be toggled on and off quickly. Downmixing the media files isn't really a good solution as I would need to store both versions for different occasions (sometimes using headphones and speakers with a broken or weak other channel). Additionally, it wouldn't work with streaming media. The speaker already does downmixing according to this (https://together.jolla.com/question/43149/downmix-to-mono/) so there probably is a way to do it with the plug, too.

I've tried the Pulseaudio commands described in this link: http://askubuntu.com/questions/17791/can-i-downmix-stereo-audio-to-mono Apparently, this changed nothing as I tried playing some stereo test video and the playback was still stereo. After that I have also tried to set the new sink as default and move a current stream in the new sink but that just resulted in silence. http://askubuntu.com/questions/71863/how-to-change-pulseaudio-sink-with-pacmd-set-default-sink-during-playback It looks like things are a bit different in Jolla even though they both are using Pulseaudio, so it probably needs a better understanding of Pulseaudio mechanics (or a completely different approach without Pulseaudio?).

edit retag flag offensive close delete

Comments

I got curious and tried the same thing. Works perfectly on the PC, silence on the Jolla phone until I moved the stream back. Next idea was that maybe remix has a different default. With remix=false on the PC I also get silence, but with remix=true on the Jolla phone there's still silence. Possibly remixing in the module is broken/disabled? It wouldn't be the first time there's a bug in Pulseaudio, and compiling to ARM instead of x86 might trigger it. I guess the next step would be compiling from source and starting to debug. I can't see anything wrong with the method, and I don't think there's a different method (unless you write your own module, or process the stream with an external program).

dthierbach ( 2014-10-21 10:11:40 +0300 )edit

You might want to vote this up if you haven't already: https://together.jolla.com/question/14952/music-player-should-have-equalizer-and-balance-lr-controls/

A decent equalizer should do the trick through a specific option or through panning 100% to either L or R.

Okw ( 2014-10-23 15:49:19 +0300 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2014-10-22 19:25:19 +0300

dthierbach gravatar image

updated 2014-10-23 08:56:05 +0300

Ok, I think I found the culprit. module-policy-enforcement seems to silence streams when they are moved to a different sink, in addition to providing a default sink by policy group.

The following works on my phone:

$ pacmd unload-module module-policy-enforcement
$ pacmd load-module module-remap-sink sink_name=sink.mono master=sink.primary channels=2 channel_map=mono,mono
$ paplay -d sink.mono /usr/share/sounds/jolla-ringtones/stereo/jolla-ringtone.wav

So I guess the way tp go is to always load a remapped sink (in /etc/pulse/arm_qct_msm8930_cdp.pa), change the sink destinations for the policy groups (/etc/pulse/xpolicy.conf), and reload the module with channel_map=left,right or channel_map=mono,mono if you want to toggle.

That's not tested; if you try it, let us know how it goes.

Edit: Another option would be to pretend a bluetooth device. Matching just seems to be done by name, so the sinkname should start with bluez. Then somehow use an Audio Mode to switch between the fake BT device and the primary. Maybe there's a DBUS interface for that?

edit flag offensive delete publish link more

Comments

Thank you for your effort! The module-policy-enforcement did the trick at least temporarily. However, it is probably better not keep it unloaded all the time, as according to the wiki page you linked, it enforces volume limits and controls audio during a call etc.

So, I tried loading the module in the .pa file but then I'm not quite sure how I should modify xpolicy.conf. Replacing sink.primary with sink.mono in the whole file just made everything silent, and replacing only in the group section did not change the sound. I also tried to load sink.mono before the module-policy-enforcement in the .pa file, but it didn't help(yes, my attempts are quite random).

The bluetooth method sounds quite surprising, but I've yet to find a way to change the audio mode. Or I just didn't understa nd the idea well.

Anyway, As a workaround, while investigating more proper ways, I just put your commands and default sink changing to a shell script and run that to get mono. Unloading is just an pulseaudio restart(a bit overkill): "systemctl --user restart pulseaudio.service".

Tegu ( 2014-10-23 22:23:50 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2014-10-20 16:57:40 +0300

Seen: 591 times

Last updated: Oct 23 '14