[Google Pixel 2 XL Themes, Apps, and Mods] bjrmd:
Purpose: To reduce the distortion and better control the audio DAC of the Pixel 2 XL.

Edit 11/25/18

Please see this post for the version supporting the Apple Dac. In addition the new version incorporates a mod for 50 steps of volume rocker control. I redid the volume limits in the app to 50, so you will have issues using the new app with 25 steps only.

Introduction: The new Pixel 2 differs from the original Pixel in a major way. The lack of a headset jack offloads the headset out capability to a USB Dac in the supplied dongle (or any USB Dac you are using). Although at first glace this is a disappointment to most, on further thought it has some advantages. No longer will you need to upgrade a phone because the audio is better on a newer model, just upgrade the dongle instead. Or, have a range of dongles to suit your purpose (power, low distortion, impedance, form factor, etc). But, unfortunately, the folks who designed the software, did not (IMO), properly adjust the digital gain of the dongle Dac or aftermarket devices like the Dragonfly red. So the Dragonfly can put out 2.1 V, but the stock Pixel 2 will only max out at 55 mV. Worse, the supplied dongle (which has very nice electrical/audio specs), is set to have maximal Dac digital gain, resulting in higher distortion. Now you may say, what about the good Gsmarena tests. They test all devices at max output, so the distortion bands will not appear so significant. But, you listen at perhaps one hundredth of that voltage, making the comparison invalid. By cutting the digital gain of the dongle, we can approach Dragonfly red specs in regards to distortion. The dongle has very low impedance, excellent crosstalk and power is there, if needed.

The goal of this project is to enable Dac digital gain adjustment, report the gain numbers and if so desired, track listening Spl to help protect your hearing. It is not an equalizer, effects module and the goal is audio quality/accuracy.

It does need root.

Requirements: Root with Magisk, Tested on stock 8.0. At this time the only dongles working are the supplied Google unit, and the Dragonfly red. More to follow. Each needs to be set in the software backend. App will work with Spotify, Google music, Neutron player, maybe others.

Download the tinymix file, unpack tinymix and place it in your sdcard/Download. If using the the tinymix32 file make sure you rename it to just tinymix, no extension.

Note, the version of tinymix for the U11 must be the 32 bit one.

Unzip the tinymix32, rename it to tinymix and place in the Download folder, then reboot the phone.

The version for the Pixel 2 XL is the 64 bit version posted as just "tinymix.rar"

Download and install the apk.

Open the apk, it will ask for root permission, say yes.

Reboot your phone.

The app will automatically copy tinymix to sbin.

Insert the dongle with headphones attached-- the phone does not register the dongle properly unless the headset is plugged into it. The Dragonfly does not have this issue.

The app will automatically open and the following screen appears:

For now do nothing, it will go away in 10 secs.

Start playing music and the following notifications should appear:

Lets look at USB Gain first. Pull down the notification and the Dac Up, Dac Down, Sliders appear. The Up/Down will increment the digital gain by about 1 dB per click. The sliders will bring up the following:

The left controls the android volume, the right side control the Dac. You generally want the android vol near max and the Dac gain low. Since you can still adjust the android volume with the standard volume rocker (2.4dB per click), I would find a comfortable net volume out with the android Vol about 22 with a Dac gain to fill up the difference. The initial settings are some safe defaults I put in and we can change that as noted below. The gain numbers on the slider go from 1 to 64(Dragonfly defaults- 1 dB per tick), but the Google dongle has a range of 1 to 175 (don't ask me why). I have converted this so the spinner reads 1 to 64, but below it is the actual file output.

The 3 dot menu on the top right will bring you back here:

The headphones screen transfers to form entry to set up various headphones you may own. If you know the specs, the app will calculate the Spl (but there is an issue with the Google dongle calculation, it's off by a few dB, Dragonfly is spot on). More importantly the initial Dac gain (in percent) and android volume can be entered, so when you replug, the app will start with those settings. It remembers the last applied headset setting on reboot. So if you liked a dongle gain of 32 of 64 (same as 87 of 175), that's 50 percent. Sorry about the lack of uniformity, but the dongles all have different gain numbers.

The list of headphone entries lies below. A single click chooses the parameters for the listening session(start vol, gain, etc) and will remain for the next Usb insertion as well. To delete an entry, long press on it.

The headphone sensitivity numbers published are either dB/V or dB/mw. The program uses dB/V, but will autoconvert if dB/mw is entered. Be extra careful which headphone sensitivity units are used--either dB/V or dB/mw. Enter either one but not both. The website of the manufacturer should have the specs. Note: Shure is in dB/mw and Sennheiser is dB/V.

The visualizer button will engage the java android visualizer that actually calculates RMS and Peak signal, making the Spl more accurate. Some details from my old app.

Lastly, the Spl Graph option will allow you to view the current session of dongle use or previous, it use the Google Chart api.

To be extra cautious initially-Make sure you do not put the headset on and play - keep it off the ear then insert--a high sound volume can damage your hearing.

Many thanks to [MENTION=2760454]chdloc[/MENTION] for continued help in android audio, acoustics and of course friendship.