[Nexus 6P Android Development] LarryChendragon2099:
I think I've found you on Facebook too. We have mutual friends, and I post a lot, so that's entirely a possibility that you've seen my username xD

Ahh that makes a lot of sense and would explain the change in functionality. Personally though, I find that the previous one just performs so much better. In general, if you're not using an app like ViPER4Android, you're most likely not going to realize a lot of the benefits of the previous mod, but in my testing I've found that the faux123 mod's HPM really made a huge difference.

Longform:

---------------------

A couple months ago, a friend @[Brad331] did a couple of calibration measurements of the speaker system of the Nexus 6P and we used that to generate a equalization profile to 'flatten' the frequency response output of the hardware.

Without getting into too many scientific details, a phone's speaker, or any speaker, for that matter, has a couple parts to it, namely the speaker amplifier, speaker driver (part with magnet and coil and diaphragm that moves in and out to produce sound waves), and a sound chamber. that acoustically amplifies the sound. On the Nexus 6P hardware, there are two sets of these components. Quite luckily, Huawei has designed very large sound chambers into the device.

Creating low-frequency sounds inherently requires more energy input, as more air needs to move for them to be audible. Especially because the speaker diaphragm and sound chamber are small (comparatively to even a notebook computer,), it's hard for them to move enough air to produce low frequencies effectively. Thus, they perform very well with mid-and high frequencies, which is why you hear lots of vocals and high pitched sounds on the phone, but it lacks a lot of depth. This creates unbalanced sound.

A lot of small audio hardwares nowadays come with power-limited amplifiers, such as the case with most notebook computers, thus further causing the imbalance. Once again, fortunately, this is not the case with the Nexus 6P. The device's audio amplifier can output up to 7 W or so (per speaker!) from a fairly high internal voltage of 8.5v (from the chip datasheet/inspection of the values in /system/etc/mixer_paths.xml. I doubt the output is really 7W continuously, but the speaker enclosures do become fairly warm to the touch (50C+) during normal playback with the back cover of the phone removed. I'd say we're getting something like 2-5W in total, taking into account both temperature, thermal mass, and the measured increased electrical current drain on the battery (not particularly accurate).

We can attempt to correct for this imbalance by using equalization, a feature enabled by audio toolkits such as ViPER4Android. The premise is that in software, we calibrate the output by lowering the volume of sounds that the speaker is inherently biased towards, and increase the volume of the sounds it's not good at producing.

However, this is where we run into a problem. Android attempts to fight this correction because it applies something called Dynamic Range Compression to the audio signal. The idea is that using this, the speaker can play louder without distorting in some cases, as all the power is redirected to producing sounds that the speaker is good at producing. In practice while this makes the sound objectively louder perhaps, it also make it sound quite thin, cheap, and annoying.

Dynamic range compression works by turning down the volume on the sounds that the speakers are not great at producing. In Android, the implementation actually just turns down the volume period. This volume reduction is dynamic, such that if we boost the bass, all it does is turn the volume down so that the bass is only very slightly audible, and the rest is just quiet. Obviously this doesn't make for very nice audio.

There appears to be two layers of this compression. One is in the kernel, presumably and another is controlled by the DRC_Enabled value in /system/etc/audio_policy.xml.

I have tried to disable the one in that file with success. However, the second layer still fights the equalization.

The previous implementation of sound control by faux123 allows the user to disable the in-kernel sound compression by using the HPM option. I'm not sure about the specific implementation and would have to look into it further but it does indeed work and the desired result is produced. Careful tuning following this can yield some fairly nice sound that is much more balanced, not much quieter, and actually listenable for those times when you need to actually hear your ringtone outside or want to listen to music randomly somewhere on the phone speakers. Combined with the ability to boost output power using the gain up to 30dB, The device actually feels quite powerful in terms of audio, and the headphone jack gain allows it to drive a portable $3 eBay speaker beyond clipping which is very loud.

Now, with this said, on a stock hardware, I'm not entirely sure whether the old mod had such a great benefit for really really extreme EQ as as there was a lot of distortion/noise coming from the velocity of the airflow through the speaker openings. I was able to partially mitigate this by making some changes to the speaker enclosures, namely optimizing the size and routing of the air as it left the diaphragm. This had the effect of allowing the driver to operate at a higher power level without distortion. I was trying to acquire a stock device a while ago to test this again, but wasn't able to do so. My friend has had luck with the stock hardware, however so this is indeed a possibility.

---------------------------------

Either way, I do realize that after all, this is a mobile phone, and the use cases for a "better" mobile phone speaker are often limited, but even just for ringtones, the +28dB boost that was enabled by the faux123 implementation really did make a difference. As such, I think it would be amazing if this could be a possibility to add to the kernel.

Just as an addon, I really really love the way this kernel allows you to hotplug the CPUs. With multi-window mode and Firefox streaming video from a desktop site, and the lower window displaying Instagram feed, leaving all the CPUs on results in almost 10 watts of power use from the battery in total. This is okay when plugged into the quick charger, since that's 15W, but sitting in class using this on battery, that battery will run out in about 1 hour. Not to mention, the CPU runs at 95 degrees C and teh top of the display quickly exceeds 55C (hot enough that you would drop it reflexively if you didn't expect it to be that hot.) Using 3 Little cores at 480MHz results in a very usable (yes a little laggy though) experience, but with a power drain of just 250-500mA on average (2W or so) for the whole phone. That's some impressive battery life improvements there xD

And yes, this is a rather extreme use case, but I thought I'd leave it here for the fun of it xD