Qualcomm Sound Optimization and Spl display
Dec 21, 2015 at 1:57 PM Thread Starter Post #1 of 4

Bjrmd

Head-Fier
Joined
Dec 26, 2011
Posts
74
Likes
55
Project Purposes: Real Time measurement of Headset Spl levels on any device and optimize sound quality of snapdragon audio codec devices when played through the headset port at moderate to low volumes, especially using low impedance, high sensitivity in ear monitors. The optimization will mainly affect signal to noise ratio, noise floor, perhaps THD. This is not a "sound effect" mod--the audio should be as close to originally intended as possible. In addition, real time Spl monitoring on any device has been added for hearing protection, curiosity and viewing the dynamic range of music tracks.

Potential Users: Listen to music with high efficiency headphones/IEM and music volume generally below 2/3 max. Low distortion, noise important. Will also provide a finer granularity to the volume heard, about 1 dB increment change vs 3 dB through android volume control.
Please see comments below and on page 2 about Spl measurements and hearing protection.

Requirements:
For Gain Control:
Rooted, snapdragon based sound codec device (tested on galaxy S3, Note 4, Sony Tablet Z, Nexus 5). Totally stock ROM and kernel is fine. AOSP and custom kernels should work, even Faux audio kernels.
For Spl measurement only:
Non rooted, stock android 4.4 and beyond.


Background
You may have heard various reviewers say that the codec/DAC of a device is of high quality but the software has not been designed to take advantage of said hardware. Well, that seems to be unfortunately true. The situation is that most if not all headphone audio is not designed to maximize signal to noise ratio, distortion and noise floor. The volume output of the device is dependant on "gain" from both analog and digital controls. Unless you are playing back at max levels, volume attenuation using the digital control results in data truncation and potentially loss of information. Therefore the use of analog gain to control the volume(with digital gain near 0) should provide the most optimal signal. Measurements done by myself show about a 10 dB noise floor improvement at low gain levels using an analog method of gain level optimization . But at near max output this difference should disappear.
Reference is zipped below from a presentation from ESS, a company that makes high quality DAC chips.

Is there a way to do this? Yes, by keeping the digital gains near or at 0 dB and using analog gain control. There are 3 different gains that we can adjust, RX digital gain(in /system/etc/mixer_paths.xml with value 84 generally zero dB), Android volume(0-15---15 being 0 dB) and analog control(HPHL and HPHR-also in mixer_paths). The problem is that each time you adjust mixer_paths you need to restart your phone--not a very good solution unless you listen at one fixed volume. There is a utility called tinymix that will adjust these as well but in my experience(Note 4) it's not very reliable/fast.
In the process of working on some other sound mods with my friend @chdloc) we stumbled on a specific file that is a codec debug tool. It shows the codec register values(the ones above as well as a plethora of other data) but more importantly--it can be written to! So we have a way to smoothly and quickly read and adjust digital and analog gains. There is a catch though. If the audio path changes (listening to music then a text notification comes in, or alarm goes off, or you get a phone call) the audio gain will revert to whatever was default in the mixerpaths.xml file(kind of a master control file for audio). We have been able to compensate somewhat for this as will be seen below and is a main feature of this mod.
 
Although it was not my initial goal for this project, I believe the Spl monitoring offers a unique glimpse into the actual sound pressure level coming out of the headset as well as the dynamic range of your music. As far as I have seen, there is not another mod that does this and it was something I have always wanted to do. My hearing has already been degraded by rock concerts, noisy subways, loud weddings etc and I wanted a way to protect against any further damage (but at the same time I do like to listen at a relatively high volume). This feature is helpful in that compromise.
As noted above, one of the purposes of this app/mod is to try to inform the listener about excess sound levels which will cause hearing loss. It does not limit or change the sound in any way but based on the gains(voltage put out by the phone), the headphone/amplifier output impedance and headphone sensitivity, calculates what a 1 kHz sine wave Spl would be. Depending on what you are listening to (silence, over compressed rock music, everything in between) the sound coming out of the headphone will be quite different. There is a class available in android that measures the peak and RMS audio levels on a real time basis. By using this measurement we can then compensate for whatever the played signal is for a much more accurate determination of Spl. Unfortunately there is a bug in the measurement process that makes levels only accurate at maximum android volume levels. With this app, we keep them there anyway so it is not an issue. However, if you do not do so the numbers put out will not be accurate.
Additional Feature:
On any android 4.4 or later device it is now possible to monitor the real time Spl/Dynamic Range as above. No root needed, the volume keys will provide the gain parameters. Of course, you still need to input the amplifier, headphone specs. In addition, the maximum output voltage will need to be measured(to figure out the maximum volume possible). A male to male headset connector, voltmeter and a 1 kHz full scale sine wave is needed(below). Play the sine wave at max volume(do not attach headphone), measure the voltage and that is used in the input screen. My Galaxy S6 only puts out .525 V so it's max Spl will be quite a bit different than the Note 4 (1 V).
 
 
If anyone is interested please see the main thread at XDA
Please forgive the cross posting, this is a free app/mod and is put here in the spirit of sharing.
 
Dec 21, 2015 at 2:35 PM Post #2 of 4
I cannot stress enough how useful this tool is to keep an eye (ear) out for potentially hearing damage inducing playback levels. Plus it offers much better gain control than stock Android devices do. Great work @Bjrmd !
 
May 5, 2018 at 1:02 PM Post #3 of 4
Project Purposes: Real Time measurement of Headset Spl levels on any device and optimize sound quality of snapdragon audio codec devices when played through the headset port at moderate to low volumes, especially using low impedance, high sensitivity in ear monitors. The optimization will mainly affect signal to noise ratio, noise floor, perhaps THD. This is not a "sound effect" mod--the audio should be as close to originally intended as possible. In addition, real time Spl monitoring on any device has been added for hearing protection, curiosity and viewing the dynamic range of music tracks.

Potential Users: Listen to music with high efficiency headphones/IEM and music volume generally below 2/3 max. Low distortion, noise important. Will also provide a finer granularity to the volume heard, about 1 dB increment change vs 3 dB through android volume control.
Please see comments below and on page 2 about Spl measurements and hearing protection.

Requirements:
For Gain Control:
Rooted, snapdragon based sound codec device (tested on galaxy S3, Note 4, Sony Tablet Z, Nexus 5). Totally stock ROM and kernel is fine. AOSP and custom kernels should work, even Faux audio kernels.
For Spl measurement only:
Non rooted, stock android 4.4 and beyond.


Background
You may have heard various reviewers say that the codec/DAC of a device is of high quality but the software has not been designed to take advantage of said hardware. Well, that seems to be unfortunately true. The situation is that most if not all headphone audio is not designed to maximize signal to noise ratio, distortion and noise floor. The volume output of the device is dependant on "gain" from both analog and digital controls. Unless you are playing back at max levels, volume attenuation using the digital control results in data truncation and potentially loss of information. Therefore the use of analog gain to control the volume(with digital gain near 0) should provide the most optimal signal. Measurements done by myself show about a 10 dB noise floor improvement at low gain levels using an analog method of gain level optimization . But at near max output this difference should disappear.
Reference is zipped below from a presentation from ESS, a company that makes high quality DAC chips.

Is there a way to do this? Yes, by keeping the digital gains near or at 0 dB and using analog gain control. There are 3 different gains that we can adjust, RX digital gain(in /system/etc/mixer_paths.xml with value 84 generally zero dB), Android volume(0-15---15 being 0 dB) and analog control(HPHL and HPHR-also in mixer_paths). The problem is that each time you adjust mixer_paths you need to restart your phone--not a very good solution unless you listen at one fixed volume. There is a utility called tinymix that will adjust these as well but in my experience(Note 4) it's not very reliable/fast.
In the process of working on some other sound mods with my friend @chdloc) we stumbled on a specific file that is a codec debug tool. It shows the codec register values(the ones above as well as a plethora of other data) but more importantly--it can be written to! So we have a way to smoothly and quickly read and adjust digital and analog gains. There is a catch though. If the audio path changes (listening to music then a text notification comes in, or alarm goes off, or you get a phone call) the audio gain will revert to whatever was default in the mixerpaths.xml file(kind of a master control file for audio). We have been able to compensate somewhat for this as will be seen below and is a main feature of this mod.

Although it was not my initial goal for this project, I believe the Spl monitoring offers a unique glimpse into the actual sound pressure level coming out of the headset as well as the dynamic range of your music. As far as I have seen, there is not another mod that does this and it was something I have always wanted to do. My hearing has already been degraded by rock concerts, noisy subways, loud weddings etc and I wanted a way to protect against any further damage (but at the same time I do like to listen at a relatively high volume). This feature is helpful in that compromise.
As noted above, one of the purposes of this app/mod is to try to inform the listener about excess sound levels which will cause hearing loss. It does not limit or change the sound in any way but based on the gains(voltage put out by the phone), the headphone/amplifier output impedance and headphone sensitivity, calculates what a 1 kHz sine wave Spl would be. Depending on what you are listening to (silence, over compressed rock music, everything in between) the sound coming out of the headphone will be quite different. There is a class available in android that measures the peak and RMS audio levels on a real time basis. By using this measurement we can then compensate for whatever the played signal is for a much more accurate determination of Spl. Unfortunately there is a bug in the measurement process that makes levels only accurate at maximum android volume levels. With this app, we keep them there anyway so it is not an issue. However, if you do not do so the numbers put out will not be accurate.
Additional Feature:
On any android 4.4 or later device it is now possible to monitor the real time Spl/Dynamic Range as above. No root needed, the volume keys will provide the gain parameters. Of course, you still need to input the amplifier, headphone specs. In addition, the maximum output voltage will need to be measured(to figure out the maximum volume possible). A male to male headset connector, voltmeter and a 1 kHz full scale sine wave is needed(below). Play the sine wave at max volume(do not attach headphone), measure the voltage and that is used in the input screen. My Galaxy S6 only puts out .525 V so it's max Spl will be quite a bit different than the Note 4 (1 V).


If anyone is interested please see the main thread at XDA
Please forgive the cross posting, this is a free app/mod and is put here in the spirit of sharing.
I might be years late to this topic, but I have a question. Do I need a RMS multimeter to measure the maximum output voltage or plain multimeter? Also, do I need to set the multimeter to DC or AC?
 

Users who are viewing this thread

Back
Top