How to edit audio_policy.conf in Android Lollipop

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
nubc
Posts: 2062
Joined: Tue 23 Jan 2007, 18:41
Location: USA

#21 Post by nubc »

The upcoming version Android N, due out this Summer 2016, will implement Mono Audio under the Sound heading in Settings.

Android Headlines
http://www.androidheadlines.com/2016/03 ... -mono.html

image: Mono Audio in Settings under Sound (Android N)
http://imgur.com/VM1vM3m

@ amigo
Thanks for sharing the rooting methodology. Very interesting, and will keep it for future reference.

User avatar
nubc
Posts: 2062
Joined: Tue 23 Jan 2007, 18:41
Location: USA

#22 Post by nubc »

I have a hypothesis about acoustics and perception, specifically as relates to stereo and the illusion of two dimensions. My contention is that physical space away from the ears is required to achieve this illusion. When earbuds are inserted close to 1 cm away from the eardrum, that is not sufficient space for the brain to perceive spatial effects. In particular, the brain cannot perceive spatial sound effects between the eardrums, inside the head. On the other hand, stereo headphones provide about an inch of space away from the eardrum, and this is sufficient space for the brain to perceive varying sound as having a spatial quality, including the illusion that sound is located in the center of the head. It might be interesting to test this out with a music track that emphasizes back and forth. left-right sound effects, to see the difference between earbuds and headphones.

User avatar
nubc
Posts: 2062
Joined: Tue 23 Jan 2007, 18:41
Location: USA

#23 Post by nubc »

@ amigo
I might still root this phone, but I don't see any point to it at present since there is no software solution for the mono audio switch in the wild. However, once Android N rolls out, there will be a solution to mono audio available to devs, and I might have a reason to root the phone at that point. I have to say this phone is really a great device because of the front-firing loudspeaker, which really makes a difference. Battery life has been somewhat reduced since I upgraded from Lollipop to Marshmallow, but other than that, I can't complain, except for the lack of mono audio. I think that Android users are going to have a similar struggle getting Google coders to include a Left-Right Channel Balance, a standard feature on iPhone, LG, and Samsung smartphones. After all, it took an act of the California legislature to get Google to finally include the mono switch, but only after a year-long wait. I mean, what's the rush, it's only a usability feature. Speaking of knuckleheads, the CTO at Motorola who, as a matter of policy, refused to make any mod to stock Android on Motorola phones, has jumped ship and now is in executive position at Google. As I recall from my reading, the Google exec [not the former Motorola CTO] who was standing in the way of Mono Audio on stock Android has moved on up, in accordance with the Peter Principle, replaced by a younger exec with some field experience.
Last edited by nubc on Fri 17 Jun 2016, 05:02, edited 5 times in total.

User avatar
Pete
Posts: 660
Joined: Sun 02 Mar 2014, 18:36

#24 Post by Pete »

Hi nubc

I assume what you are trying to achieve, due to local laws, is you want your phone
to play mono but your source material is in stereo.
Also when you answer calls, you want to be sure that you can indeed hear the other person.

You are indeed a brave person trying to mess around with Android.
I would go the hardware route.
Had a quick google around and most phones seem to use the same connections
for headphones which includes a small in-line control housing with some buttons (to play music and answer calls) and a microphone.
These are normally stereo (see first attached diagram).

Since it is stereo, we could use two series resistors of 10 ohms each (couple of cents) and combine the left and right channels to form mono.
The resistors not only do the combining, but also act as a "load" to both channels so that they are not simply shorted together.

Speakers/earbuds normally used on phones, have an impedance of around 32 ohms so the 10 ohm resistors would only reduce the volume a tad, plus you can always turn up the volume a bit higher than normal.

The mod is outlined in the second attached diagram.
Attachments
HeadsetWiringOriginalStereo.jpg
(27.27 KiB) Downloaded 210 times
HeadsetWiringMonoMod.jpg
(27.41 KiB) Downloaded 217 times

User avatar
nubc
Posts: 2062
Joined: Tue 23 Jan 2007, 18:41
Location: USA

#25 Post by nubc »

For the immediate future, the Moto G 3rd gen smartphone will not be getting the update to Android Nougat 7.0. There may have been a hardware issue causing freezing, some apps did not work, and some handsets even crashed, according to rumors. By not providing a second version upgrade for the Moto G3, Motorola is breaking with a tradition of extended support (currently 18 months and 2 Android version upgrades) for its mobile devices. Moto G3 owners have started a petition to get Motorola/Lenovo to provide the update to Nougat 7.0. So far the petition has gathered almost 10,000 signatures.

User avatar
nubc
Posts: 2062
Joined: Tue 23 Jan 2007, 18:41
Location: USA

#26 Post by nubc »

Nexus 5 mod to change stereo to mono. Make the following substitution of the "headphones" section of mixer_paths.xml file located at /system/etc

stereo

Code: Select all

          <path name="headphones">
        <ctl name="SLIM RX1 MUX" value="AIF1_PB" />
        <ctl name="SLIM RX2 MUX" value="AIF1_PB" />
        <ctl name="SLIM_0_RX Channels" value="Two" />
        <ctl name="RX1 MIX1 INP1" value="RX1" />
        <ctl name="RX2 MIX1 INP1" value="RX2" />
        <ctl name="CLASS_H_DSM MUX" value="DSM_HPHL_RX1" />
        <ctl name="HPHL DAC Switch" value="1" />
        <ctl name="RX1 Digital Volume" value="83" />
        <ctl name="RX2 Digital Volume" value="83" />
        <ctl name="HPHL Volume" value="15" />
        <ctl name="HPHR Volume" value="15" />
    </path>
mono

Code: Select all

   <path name="headphones">
        <ctl name="SLIM RX1 MUX" value="AIF1_PB" />
        <ctl name="SLIM RX2 MUX" value="AIF1_PB" />
        <ctl name="SLIM_0_RX Channels" value="Two" />
        <ctl name="RX1 MIX1 INP1" value="RX1" />
        <!-- the following line adds the cross mix from the second channel to the first one -->
        <ctl name="RX1 MIX1 INP2" value="RX2" />
        <ctl name="RX2 MIX1 INP1" value="RX2" />
        <!-- the following line adds the cross mix from the first channel to the second one -->
        <ctl name="RX2 MIX1 INP2" value="RX1" />
        <ctl name="CLASS_H_DSM MUX" value="DSM_HPHL_RX1" />
        <ctl name="HPHL DAC Switch" value="1" />
        <ctl name="RX1 Digital Volume" value="83" />
        <ctl name="RX2 Digital Volume" value="83" />
        <ctl name="HPHL Volume" value="15" />
        <ctl name="HPHR Volume" value="15" />
    </path>
https://forum.xda-developers.com/google ... p-t3038469

Moto G3 code (stereo)

Code: Select all

<path name="headphones">
            <ctl name="MI2S_RX Channels" value="Two" />
            <ctl name="RX1 MIX1 INP1" value="RX1" />
            <ctl name="RX2 MIX1 INP1" value="RX2" />
            <ctl name="RDAC2 MUX" value="RX2" />
            <ctl name="HPHL" value="Switch" />
            <ctl name="HPHR" value="Switch" />
         <path>

Post Reply