Qualcomm Audio/Usb DAC Optimization, Spl monitor, Biquad Helper - Android Software Development

Project Purposes: 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. In addition, real time Spl monitoring on any device has been added for hearing protection, curiosity and viewing the dynamic range of music tracks. Integration of the Biquad equalization/filter mod by @chdloc as a parametric equalizer. The equalizer is capable of 5 bands, different left and right parameters and clipping protection.
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. Ability to make custom equalization filters for anything that plays through the headset jack.
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.
Usb DAC-you need to be rooted but any brand codec, Usb audio must work already, Not compatible with 3rd party Usb sound apps/drivers. You will also need ALSAmixer and thanks to the developer for making this tool. Use version 251.
This app supports Neutron, Poweramp, Spotify and Google play music. Other music play apps should work using a “polling” method to detect if they are playing
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.
The Spl monitoring is covered below in more detail. 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.
The Biquad integration provides a way to both design custom filters (equalization) that will work for all music apps playing through the headset jack. The filters can be asymmetric--left different from right.
Setup--
0- Backup/Nandroid everything.
1- place "tinymix" in system/bin, permission to execute. Tinymix is used in the initial codec query/calibration. Make the appropriate changes to mixer_paths.xml (see below).
2- make sure you have busybox installed(most custom Roms already have this, if you are stock rooted get it from playstore)
3- Install the Gainctrl apk. This is the main app to control gains, logically raise and lower the gain to achieve the desired listening volume. The app will ask for permissions dealing with starting on boot, root functions, reading sms since it can read back messages.
4- Put a set of headphones in the jack
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
5- Open the app Gainctrl----
You will presented with three choices. If you want the usual install press the top button.
(The second button will install Spl monitoring software only for non root.
The third option is for codec tools which will be used for future debugging and I will skip it.)
For Usb Dac control just press the choice and the screen will close.
When you plug in a Usb Dac, the program will detect this and will be discussed below.
Then a setup screen will open
There is an auto calibration step that needs to be done once-press the button on the lower part of the screen that says calibrate.
The app will find the range and location of the analog gains that your codec supports. This is where tinymix is used to determine the HPH levels your codec supports. The app will use Google play music to play a track(whatever you were last listening to, so make sure that app is installed), go through some measuring and then let you know when it’s done. It will then quit.
Quick start usage--just start playing Google music again and the notification controls will appear up top. Press the up/down buttons to raise /lower volume or use the 3rd triple line icon to open the gain slider screen.
Here are sliders for Android volume (each tick is 3 dB), Digital gain and Analog gain. Analog goes from 0 to 20 (usually, sometimes 12). Digital is the RX1 and RX2 (L,R side and each tick is 1 dB) from mixerpaths and incidentally also corresponds to what Faux sound modifies. We should initially keep Analog at zero, Android at max 15 and then use the Digital to get a comfortable level. If you have maxed out digital to 84 (0 dB) then start raising Analog (each tick is 1.5 dB).
6- Setup Screen Usage---Choosing which music app you will use(Poweramp and Google are the same button). Each music app will fire "broadcast intents" when playing or not-these are used to rerun the codec scripts for gain changes on music play-so choose carefully. The calibration above uses Google music so that is what is chosen as default. As mentioned above the gain settings/biquads usually don't stick after the music stops so the app needs to know when tracks play/pause/change.. “Say text” on or off to verbally read text messages or not. In addition I have added a switch to enable automatic reapplication of the "Biquad" mod on each pause/play. This is a brilliant piece of work done by my friend @chdloc that creates a 5 band parametric equalizer on the qualcomm platform. His post has the details of how to implement the feature and further instructions are below.
Music polling-certain music apps don’t broadcast play pause info that this app can catch(Pandora). By choosing the polling method a loop will be set up on headset insertion that “listens” for music playing every 4 secs. It should not be used with the defined player options above it and if it is chosen the others become inactive, and visa versa.
Summary:
- The notification bar is where you increase or decrease the volume. The far right icon next to the arrows goes to the gain slider screen as an alternate adjustment.
- If you restart the phone/tablet you will not need to restart the app--it should auto start.
- If you get a call, the music will stop and on resume the volume will go back to the last chosen levels.
- If you get a text, music will pause and it will be "read" over the music channel so no volume shifting occurs. However, the text reading can be disabled by the button in the settings screen.
From any of the screens there is a master menu, 3 dots on the top left, it will go to all relevant screens. It can be activated by pressing the notification icon of the app, the Home button on the "Biquad" bar, opening the app from the app drawer if no notifications are present.
Help- will bring you to this post:
There are also 2 mini apps--"Up" and "Down". These can serve in place as up or down clicks on the notification bar. They are good as "shortcuts" to put on the home screen, or even mapping the volume up/down keys using "xposed additions". A single launch/click of the Up/Down app will change the gains by 1 dB according to the logical algorithm (keeping android vol/digital at or near 0 dB and analog gain as low as possible).
Spl control-
Preface-One of my fears in many long years of listening, is what damage is being done in regards to permanent hearing loss. There are studies and recommendations as to time and volume levels that are safe. The SPL calc is an attempt to provide a rough estimate of the Spl(sound pressure level) coming out of the headphone using the following assumptions.
The full output of the codec is 1 V, the published headphone stats(sensitivity and impedance) and measured/published phone amplifier impedance are correct. The software will compute the Spl using the above and the gains selected. So you need the headphone’s published sensitivity( my Shure SE846 is 114 dB SPL/mW), some are published in dB/V so be careful with the entry box. The Spl window uses these units so be reasonably certain. The headphone out impedance is usually about 1 to10 Ohm (Note 4 is 1.4) but you should be able to find the value on the net or measure it yourself(here). The headphones impedance at 1 Khz is usually published but can be also taken from Goldenears.net reviews( again my SE846 is about 9 Ohm)
You should be able to raise/lower gain by 1 dB, monitor the Spl from the notification bar. If you are curious and have the right gear you can also use this in bench testing to easily compare different settings(high analog vs digital attenuation) but at the same Spl(gain). I have measured the actual Spl using a handheld meter, using a full-scale 1 kHz sine wave and the matching is very close. Actual music will be less but varies depending on what you are listening to. Informal observations show average music to be 5-6 dB down from the 1 kHz sine. Please consult published guidelines for safe listening.
Spl and Visualizer
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:
Spl Monitoring Mode Only- Any device, any onboard DAC- 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).
The new Spl measurement process gets peak and RMS levels every 1.5 seconds and put these values in an array of 8 values. At the end of the 8th measurement, the array is averaged and saved to a text file on your root storage(about every 15 sec). The two files contain the peak values and RMS in dB. So let's say the track has a peak value at 1 minute into the song of 0 dB, and an RMS level of -7 dB. The dynamic range would be 7 and if the calculated Spl was 90 by the original OP formula, the new net Spl would be 83 dB. A very quiet track may have a peak of -3 dB and RMS -16 resulting in a dynamic range of 13 and corrected Spl (90-16) of 74. More info on dynamic range calculations
The “visualizer” is enabled in the Spl Ctrl screen.
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 engine does take considerable CPU resources and battery use. If you don’t want/need it, keep it disabled. On my Note 4, there is no lag and minimal battery compromise but devices may vary. The following screenshot shows the effect on my Note 4, about an extra 5-7%.
[/IMG]
The values are in a separate notification bar, with the last 8 array members over the previous 15 seconds.
The graph icon will show a graph of the Spl and dynamic range over time. It uses google graph api, so an internet connection is needed. The graph is scrollable by dragging it. Every time the headphone is pulled a separate “session” begins and the graph zeros out. But the last session can still be seen by pressing the button noted. Very long sessions won’t function with the google graph api that is used so the data gets automatically resized to every other value. Pause/play stays in the same session.
The left side of the graph has units for Spl in dB, the right(which may need to be scrolled since it is off screen) has the legend for dynamic range. Most tracks will have a dynamic range of between 8-15 (corresponds to the DR album database of 5-12 values). Parts of a track may have more range than others and certainly will have different Spl values. I have placed a yellow caution line at about 78 dB and a red at 85.
I have enclosed a couple of papers from recent literature regarding safe/prolonged listening levels and hearing loss. This software does not “A” weight the Spl, which is what is seen in the literature, but it is not far off, based on my A vs C weighted Spl meter comparing the levels.
Additional information
Neutron users must enable generic driver in settings.
Poweramp working with gains and Spl, use the google music toggle in setup, make sure direct volume control off and MusicFx is on in settings
Biquad Control:
One of the most significant accomplishments in regards to the qualcomm codec platform was the development of the Biquad filter/equalization system by @chdloc. This give us either a hard coded fixed equalizer(see his post for the mixerpath mods) or (with a bit of work) an on demand custom 5 band parametric equalizer that you can totally control. What my app will do is capture the numeric band codes from the Biquad app scripts, and take a screenshot of the frequency curve.
Step 1 is to install Biquads app, make the required mixerpath mods and probably make an extreme filter(bad sounding) to make sure it actually works when we test it out.
Step 2- From this apps main menu open Biquad Bar.
Another notification bar will appear up top, back arrow or close the main menu for now.
Step 3- Open @chdloc’s Biquad app, design your filter and press “Design Biquad”.
It will calculate the filter and put up a nice graphic--do not close this! Go to the notification bar opened above and press the “Capture” button. A screenshot is taken and you are presented with a screen to name the filter. Call it something descriptive, ie +2 dB 4 Khz Q 2 lets say, then hit save. You can now go back to chdloc Biquad app, hit ok to put away the graphic and then design another. Note--all captures are done on biquad #1--so do not design on the others.
Step 4- Design “Multi filter”- from the main menu, choose that entry and a screen opens showing left, right channels and the previously added individual biquads are in the drop down positions in a grid form. By default, they are all disabled. Just pick one at a time. A few comments. After measuring my Shure 846 freq response I noted a bit of a channel imbalance. So I made a 2 dB boost at 4K in the R and 4 dB boost in the L. So each band does not need to have the same gaines L or R. Each line can also have just a unilateral change. So if you need a boost or cut in just one side, leave the other disabled.
To prevent clipping it is very important to cut the “preamp” (INP1) by whatever the max boost was in your filters. So if you are boosting low bass by 8 dB, INP1 reduction needs to be 8. The net Spl calculation will reflect this as well.
Step 5- Go back to Setup from the main menu and enable Biquads.
Step 6- From the Main menu click “Active Filter” or the “Biquads bar” in notifications(click on the icon-not the Home) will open the same window. You will see a list of all the filter composites you have made, including a disabled choice. Just click on the entry you want to be active and it will run some tinymix commands to implement it. The details of the “mix” will show below the choice list in case you forgot what you picked. Long clicking will delete any entry.
Step 7-optional-Biquad library- from the main menu again, this lists all the single filters we took from the Biquad app, with screenshots(not scaled) to get an idea of what each looks like. Long clicking will delete.
Once this is done, the overall filter/equalization will occur automatically on playing.
Mixerpath mods:
As noted above, if the music stops or something interrupts the music stream, the default gain settings kick back in, potentially leading to a loud music blast as the track resumes, before the scripts have a chance to fire. To prevent this I highly recommend changing a few values in the mixer_paths.xml file that control HPH, which are the headphone analog gains and RX1, RX2 which are digital gains. Important: as above, the setup screen choice of what music app you are using is key for the scripts to run on playing, if they are not chosen the app will not know when to run the scripts.
In system/etc resides mixer_paths.xml. Use an appropriate file explorer and text editor to make the changes. There is one mixer_path change that is needed (at least on my device). That change involves turning off the "compander". The purpose of the compander is to reduce noise but I have seen no such improvement in testing. Unfortunately, having this on will prevent the analog gains from reliably changing so it needs to be off. So open mixer_paths.xml and under the "Headset" path change the "COMP1 Switch"=1 to "COMP1 Switch"=0.
Open and "find" occurrences of "HPHL" and "HPHR" in the path "Headset". Replace values with something low-- (2 to 4 range). That is to assure that analog gain does not get out of hand on audio stream type change(default is 20 on the Note 4 which is 30 dB higher than the 0 some people will use). Especially change the HPHL/R values of 0 in the beginning of the file, also to 2 to 4.
If your Digital gains are usually 65-75 in the control screen, I would also change the RX1 and RX2 values at the beginning of the file to whatever you generally use as well as the values under the "Headset" path(both usually 80-84). (NOTE- the path is under “headphones” on the Nexus 5 so again be careful). Save the file. If the formatting is not proper, audio may not work and/or the phone may not even boot.
Do not forget to change the COMP1 switch to 0.
Finally, if you use the “Up” and “Down” miniapps, they will trigger the above actions without pulling down the notification bar. They can also be mapped to the volume buttons using xposed additions(free version works fine). If you do this and media is not playing, the buttons should still control incall volume. However if no media is playing and not in a call, volume button (Up and Down miniapps) will trigger a volume screen below(since it does not know what you would like to adjust). Note--if tasker is running as a freestanding app, a broadcast error may flash-it is of no consequence.:
Usb Dac control;
On insertion you may see:
You must check the "always" box and hit OK.
First time use you will see:
The top box will populate with sound card devices and the Usb Dac will usually be device 1.
So enter 1 in "Device ID" field as shown.
Then the next scroll box will show the details of that sound card. We are interested in "PCM playback volume". Notice that the Numid is 3. That is entered in the next line as Numid.
Now, I have defaulted some boxes with my Dragonfly Red data but as shown, the Soundblaster E3 has markedly different values. The next part is critical. The "Range" must be put in (if not 64)--so in this case it's 12560. Then a Start Gain, this will trigger every time the Usb Dac is plugged--pick 5-10 percent of max, but this can be altered later. If you are interested in Spl levels, the voltage, impedance data etc must be put in. It is useful not only for ear protection but can help in loudness matching between headphone jack and Usb. The visualizer is explained above. The default player is Google music but the 3 dot menu can take you to "Setup" to change that.
When the Usb Dac is plugged, the notification bar will have a control similar to the qualcomm one. The up and down arrows will boost or decrease the Usb Dac gain by 1 dB (if the Range is 64) and the 3 lines on the right will take you to sliders that do the same.
If you do not want to have the Usb Dac control anymore, there is a Disable button on the control screen.
Finally, many thanks again to @chdloc for direction, knowledge, encouragement, friendship and the brilliant Biquad app. And for helping with the Usb Dac, Alsa particulars.
I would also like to thank the makers of Tasker, one of the most useful coding tools I have used in my many years of amateur programming. This app was created solely in Tasker including android java api usage.

Scope shots and etc..
A couple of oscilloscope shots of the difference between keeping analog gain low (so digital attenuation is minimal)
This is stock:
This is the same voltage/spl but analog at 0 and digital near max(this is at the highest level I listen to, about 40 dB down from the max possible with my shure se 846 and Note4). Improved noise floor and band spiking. Test chain is Note 4 to asus xonar u7, unloaded, scope software Visual analyzer

Great work @bjrmd !
I've been using this mod for about a week without a problem.

Great mod

pvnsai73 said:
Great mod
Click to expand...
Click to collapse
Thanks--
I made a major advance in Spl measurement that will be in the next version soon. As stated above, the Spl is based on the analog/digital gains plus amp/headphone specs. This gives a worse case figure for playing a full scale 1 khz sine wave. But we don't listen to full scale sine waves, and music levels vary tremendously depending on many factors (type of genre, dynamic range compression-loudness wars, the way it was mastered etc). Using the "visualizer class" in android, I have been able to get the peak/RMS levels in real time as the track is played. So, based on what that shows, we will have a much more accurate net Spl. I am very interested in maintaining/protecting hearing and this will be a major focus in the next version.

bjrmd said:
Thanks--
I made a major advance in Spl measurement that will be in the next version soon. As stated above, the Spl is based on the analog/digital gains plus amp/headphone specs. This gives a worse case figure for playing a full scale 1 khz sine wave. But we don't listen to full scale sine waves, and music levels vary tremendously depending on many factors (type of genre, dynamic range compression-loudness wars, the way it was mastered etc). Using the "visualizer class" in android, I have been able to get the peak/RMS levels in real time as the track is played. So, based on what that shows, we will have a much more accurate net Spl. I am very interested in maintaining/protecting hearing and this will be a major focus in the next version.
Click to expand...
Click to collapse
Bro I have a doubt
Wt is the main purpose of this mod and how it can be used wisely
I have changed my mixerpath value like below
Are they right?.. like mentioned in install instructions

pvnsai73 said:
Bro I have a doubt
Wt is the main purpose of this mod and how it can be used wisely
I have changed my mixerpath value like below
Are they right?.. like mentioned in install instructions
Click to expand...
Click to collapse
The changes look correct.
The mod has 2 main purposes:
First, was originally intended as a kind of "voodoo sound" app like @supercurio did for the wolfson codec. Keep analog gain to a minimum so digital gain stays near 0dB, minimizing loss of signal information(see above for full explanation and presentation by ESS).
Second, it became possible (because we now know the contribution of all gain parameters, ie digital, analog, android volume) to estimate the projected Spl if we also can get the specs for headphone sensitivity, impedance and phone headphone jack impedance. This will be even better estimated by the visualizer correction noted above.
And yes the key: to use wisely!
There are plenty of studies and sites on music induced hearing loss -you can do some reading-there is plenty out there. So a major objective is to know when to back off on the volume

bjrmd said:
The changes look correct.
The mod has 2 main purposes:
First, was originally intended as a kind of "voodoo sound" app like @supercurio did for the wolfson codec. Keep analog gain to a minimum so digital gain stays near 0dB, minimizing loss of signal information(see above for full explanation and presentation by ESS).
Second, it became possible (because we now know the contribution of all gain parameters, ie digital, analog, android volume) to estimate the projected Spl if we also can get the specs for headphone sensitivity, impedance and phone headphone jack impedance. This will be even better estimated by the visualizer correction noted above.
And yes the key: to use wisely!
There are plenty of studies and sites on music induced hearing loss -you can do some reading-there is plenty out there. So a major objective is to know when to back off on the volume
Click to expand...
Click to collapse
Thanks for replying and all the help yu done to me

Thanks for info and tutorial

kevinnol said:
Thanks for info and tutorial
Click to expand...
Click to collapse
You are very welcome
There is a bit of a "bug" if you use google music and have a device that "offloads" the signal to the DSP. The mixerpaths are reapplied on track change(not all devices--yes to Nexus 5, Note 4, no to the Sony tablet) so we lose our current settings. Will have a fix out the next day or 3. Neutron/Spotify should be fine even now.

Spl and Visualizer
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).
The new Spl measurement process gets peak and RMS levels every 1.5 seconds and put these values in an array of 8 values. At the end of the 8th measurement, the array is averaged and saved to a text file on your root storage(about every 15 sec). The two files contain the peak values and RMS in dB. So lets say the track has a peak value at 1 minute into the song of 0 dB, and an RMS level of -7 dB. The dynamic range would be 7 and if the calculated Spl was 90 by the original OP formula, the new net Spl would be 83 dB. A very quite track may have a peak of -3 dB and RMS -16 resulting in a dynamic range of 13 and corrected Spl (90-16) of 74. More info on dynamic range calculations
The “visualizer” is enabled in the Spl setup screen.
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 engine does take considerable CPU resources and battery use. If you don’t want/need it, keep it disabled. On my Note 4, there is no lag and minimal battery compromise but devices may vary. The following screenshot shows the effect on my Note 4, about an extra 5-7%.
[/IMG]
The values are in a separate notification bar, with the last 8 array members over the previous 15 seconds.
The graph icon will show a graph of the Spl and dynamic range over time. It uses google graph api, so an internet connection is needed. The graph is scrollable by dragging it. Every time the headphone is pulled a separate “session” begins and the graph zeros out. But the last session can still be seen by pressing the button noted. Very long sessions won’t function with the google graph api that is used so the data gets automatically resized to every other value. Pause/play stays in the same session.
The left side of the graph has units for Spl in dB, the right(which may need to be scrolled since it is off screen) has the legend for dynamic range. Most tracks will have a dynamic range of between 8-15 (corresponds to the DR album database of 5-12 values). Parts of a track may have more range than others and certainly will have different Spl values. I have placed a yellow caution line at about 78 dB and a red at 85.
I have enclosed a couple of papers from recent literature regarding safe/prolonged listening levels and hearing loss. This software does not “A” weight the Spl, which is what is seen in the literature, but it is not far off, based on my A vs C weight Spl meter comparing the levels.
Again, many thanks to @chdloc for helping me make this possible.
Additional information
Neutron users must enable generic driver in settings.
Poweramp working with gains and Spl, use the google music toggle in setup, make sure direct volume control off and MusicFx is on in settings
A word about the effect of equalization:
If you apply cuts using the equalizer, they will reflect accurately in the Spl (the visualizer responds depending on the amount of cut). But if you significantly apply gain, depending on the amount of clipping, the Spl will be underestimated. So in general apply boost sparingly and mainly cut the frequency bands you don't like(or to make the others sound louder). The brilliant codec mod by @chdloc is not reflected in the Spl either, so try to keep the boost/cuts equivalent to keep the Spl accurate (and the signal without clipping).

interesting MOD, great work mate.

Update:
Version 2.1: Now has Spl monitoring for any device running android 4.4+, no root needed, but you will need to measure maximum output voltage from the headset jack. This is an "observer" feature only-it will not affect the output in any way.

for exynos mode ? ty

Borfas said:
for exynos mode ? ty
Click to expand...
Click to collapse
Sure, works on the S6
But Spl mode only

Hi do you think that we can hardcode these settings into the system?

tetsuo55 said:
Hi do you think that we can hardcode these settings into the system?
Click to expand...
Click to collapse
What do you want to "hard code"?
If it's the analog gain, then yes--just change your mixerpaths as I suggested and your regular volume key will still work but you will need near max to drive your headphones(this is the desirable condition--digital gains at or near max--analog gain low to allow this)

bjrmd said:
What do you want to "hard code"?
If it's the analog gain, then yes--just change your mixerpaths as I suggested and your regular volume key will still work but you will need near max to drive your headphones(this is the desirable condition--digital gains at or near max--analog gain low to allow this)
Click to expand...
Click to collapse
Yes perfect.
Does it make sense to do the same for the built in speaker?

tetsuo55 said:
Yes perfect.
Does it make sense to do the same for the built in speaker?
Click to expand...
Click to collapse
Not really, you would never hear the improvement in quality listening to the external speaker.

bjrmd said:
Not really, you would never hear the improvement in quality listening to the external speaker.
Click to expand...
Click to collapse
Ok so it would improve the sound quality just the same, but since the speaker are generally crap you won't hear the difference.
Thanks and keep up the great work
EDIT: it turns out my device does not have the mixer path xml, so i will have to figure that out first.

Related

Ringtones and media Volume more LOUD

does anyone know how can get the volume more loud for ringtones and media player? thanks
I want to know this too, as well how to get the vibrate to be more noticable. lol
a device cant play louder then it was ment to do
so the only path would be to use a audio editor on a
computer to inc the vol on the file itself
of cause inc vol have a limit as inc higher then
the bit res would just result in overload and poor degration
of the sound
There are several .csv files in /windows, these dictate the sound model used on the phone.
I've been playing with one, but can't get any boost that sounds okay, you can try changing the reg key from the operator assigned one (if europe then theres a 100db limit imposed I think) to the standard HTC one.
Have a look to HKLM\Drivers\BuiltIn\WaveDev\AcousticFile in the registry
mine comes as AudioPara3-XC-Vodafone_V5.csv
The standard HTC is AudioPara3.csv but theres also a AudioPara3-XC.csv in windows.
Try them out if you really want to, but don't blame me if it makes things worse, blows your speakers or causes pixies to come around and eat your brickwork!
you may have to hard_reset..
teomito said:
does anyone know how can get the volume more loud for ringtones and media player? thanks
Click to expand...
Click to collapse
I wonder if you're having the same problem that i'm having...
Whilst the phone lying open on a desk seems quite loud, the moment you put it into your pocket you keep missing calls as you don't hear it ring.
I couldn't figure it out until i accidently put my thumb over the bottom left side of the phone where the speaker hole is. if you do this it loses all of it's volume and becomes barely audible.
Now with my old K800 the sound kinda 'leaked' out. and was fine when in my pocket, but with the X1 it's becoming annoying that i keep missing phone calls
I know for playing media if you use core player or tcpmp it will amplify ur volume but it will most likely get more distorted as u increase the amplification
Any idea to get loud the volume?
Would this help with the volume issue...???
http://forum.xda-developers.com/showthread.php?p=2879456#post2879456
Cheers
I've tried them, they mess up the sound, the csv aren't right for the x1, the internal speaker gets dominated by far too much reverb.
see my post above
I've tried all three csv files that came with my VF X1 and the VF one is the best sounding, so I'll try and tweak the gain levels some more to get a bit more volume out of it.
OK all values in HEX.
Music playback through the speaker is virtually full strength in the VF csv, at FEC9 so there's no way that can go louder.
Audio during call using earpiece and through headset* is at 4000, changing it to 4800 gives very slight boost without distortion, anymore and I found I've turned the volume down during a call.
Same with music playback through headset * and standard system volume.
* I'm presuming headset is wired headset as it makes a difference when you try it!
vodafone csv attached.
If you dont have a VF X1 then you'll need to extract and rename this to what ever you registry points to at HKLM\Drivers\BuiltIn\WaveDev\AcousticFile in the registry
PLEASE BACK UP THE ORIGINAL FILE IN WINDOWS FIRST!
i've tried the diamond tweak, but it doesn't work, someone can write a registry key to upload? thanks
fards said:
OK all values in HEX.
Music playback through the speaker is virtually full strength in the VF csv, at FEC9 so there's no way that can go louder.
Audio during call using earpiece and through headset* is at 4000, changing it to 4800 gives very slight boost without distortion, anymore and I found I've turned the volume down during a call.
Same with music playback through headset * and standard system volume.
* I'm presuming headset is wired headset as it makes a difference when you try it!
vodafone csv attached.
If you dont have a VF X1 then you'll need to extract and rename this to what ever you registry points to at HKLM\Drivers\BuiltIn\WaveDev\AcousticFile in the registry
PLEASE BACK UP THE ORIGINAL FILE IN WINDOWS FIRST!
Click to expand...
Click to collapse
I've done what you told but nothing seems to be changed, is that file to be modified? can you boost it a little more?
I have it!
The base key is
HKCU\ControlPanel\SoundCategories\Attenuation
There are three values below that 0, 1 and 2. General sound is associated with category 2 and this is probably set to 1 at the moment. I have changed the value associated with category 2 to 3 for the moment. I have heard that it can be changed to as high as 5 but I don't want to damage the speaker.
So in short change the HKCU\ControlPanel\SoundCategories\Attenuation\2 registry setting from the default 1 to a higher value (between 1 and 5) and this will factor up the volume for most phone functions. Once you've done that power cycle the phone for the change to take effect.
I do not have this key in my device.
teomito said:
The base key is
HKCU\ControlPanel\SoundCategories\Attenuation
There are three values below that 0, 1 and 2. General sound is associated with category 2 and this is probably set to 1 at the moment. I have changed the value associated with category 2 to 3 for the moment. I have heard that it can be changed to as high as 5 but I don't want to damage the speaker.
So in short change the HKCU\ControlPanel\SoundCategories\Attenuation\2 registry setting from the default 1 to a higher value (between 1 and 5) and this will factor up the volume for most phone functions. Once you've done that power cycle the phone for the change to take effect.
Click to expand...
Click to collapse
Im afraid that made no difference my ringtone when I tried it, went from 1 to all the different values up to 5 with a soft reboot inbetween, but the ringtone remained the same level.
I also tried this one.
http://discussion.wmexperts.com/showpost.php?p=1474659&postcount=252
which caused the ringtone to go silent.
then there's this which explains it a bit.
Audio Categories and Handlers – Source: Microsoft.com and HTC
HKCU\controlpanel\soundcategories\attenuation\
0 =0 Default=0 Muted During Call
1 =1 Default=1 Attenuated During Call – Affected by system volume
2 =2 Default=2 Attenuated During Call – Unaffected by system volume
Add the following to \Attenuation\ (d-word)
3 =3 Create Muted During Call
5 =5 Create NOT Attenuated During Call – Affected by system volume
6 =6 Create NOT Attenuated During Call – Unaffected by system volume
So if those is true all those people claiming it makes their music louder are hearing a placebo effect.
I'm having exactly the same problem.
However when I play the mp3 that I've set as my ringtone in the music player either the system one or the Touchflow 3D one then the music is very loud.
To give you a reference the music is played almost twice as loud at full volume.
So I how do I make the settings that the music player uses work for my ringtone settings.
Ed
I've just checked my settings.
I don't have the HKLM\Drivers\BuiltIn\WaveDev\AcousticFile in the registry.
Under WaveDev I only have the following options:
Dll, Flags, IClass, Index, Order, Prefix, Priority256
On the phone in the Windows directory I have the Audiopara3.csv and Audiopara3_XC.csv files.
Can you tell me if I need to add the AcousticFile key and if so what the value is for the key. If not then which one of the CSV files do I replace.
Will a soft reset be needed afterwards.
Thanks
Ed
try calling it Audiopara3.csv but make sure you back up the original first.
Soft reset to test it, if it makes no difference try calling it the XC one. If sound ringtone disappears then restore the original!
I think this is more a mechanical (acoustic) issue than a digital one.
I've noticed that while just sitting on the desk the volume is quite loud for both music and ringtones. However the speaker's sound is released only through this tiny gap on the lower left side of the housing, which is easily covered when the phone is put into a bag or pocket.
Once that hole is covered the speaker becomes almost inaudible because the sound waves created by the tiny speaker simply have no way of leaving the phone's housing.
It's a bit like sealing the resonance tubes of a subwoofer with a pair of socks, except that a 600W-Subwoofer will most likely punch it's way through the obstacle, while the sound wave generated by a 0.1W phone speaker just flatlines upon impact.
To me this is a fundamental mechanical design flaw, I don't think it can be corrected by software.
The "right" solution would be to drill a larger hole into the housing next to the speaker, so the sound waves can spread more easily, but that's probably not an option for most people.
Of course one can try to increase the software amplification factor limits, but since these limits are generally set according to hardware limitations you will very likely not get the desired results, just blow out the speaker or overload the driving transistor...

[HELP ME] Calibrate an SPL meter app for N4

Can someone with an SPL meter help calibrate the Nexus4 for a sound meter app?
I like Sound Meter Lite but any free app from the Play Store will do.
Thanks in advance!
bump
Anyone? Any recording professionals out here?
This should not take more than 2 min of your time.
- Download a Sound Meter app from the Play Store.
- Play a tone through your speakers. Since phone microphones are mostly flat in the human speech region (300-3k Hz)
it is probably best to use a 1kHz tone.
- Hold an SPL meter aligned with the Nexus4 phone mic (located next to the microUSB port).
Make a note of the dB level on the SPL meter and the app.
- Report the app used and the dB difference between the app and the SPL meter in this thread.
First, are you sure the app is using the mic on the bottom as there is another on the top and it could even be utilizing both and even noise cancellation which would be bad.
Second, the mic on this phone has a very high sensitivity. I would guess the limit would be somewhere around 80db at which point it will start limiting and giving false readings. Pretty useless in and audio environment in that case.
Third, you would want to use pink noise to calibrate a spl meter. A sine wave is generally used to calibrate electrical components of audio (eg. dac).
smacksa said:
First, are you sure the app is using the mic on the bottom as there is another on the top and it could even be utilizing both and even noise cancellation which would be bad.
Second, the mic on this phone has a very high sensitivity. I would guess the limit would be somewhere around 80db at which point it will start limiting and giving false readings. Pretty useless in and audio environment in that case.
Third, you would want to use pink noise to calibrate a spl meter. A sine wave is generally used to calibrate electrical components of audio (eg. dac).
Click to expand...
Click to collapse
1. The Sound Meter Lite app shows a higher dB reading when I point the phone's bottom at the sound source.
Pointing the top (at the same distance) shows a few dB less so I think it's reasonable to assume that the main mic
is indeed at the bottom of the phone.
2. You are right about that. It's a limitation that I'm willing to overlook.
3. Pink noise is ideal.
A tone burst is only useful if one knows the mic's frequency response.
I asked for it because I will attempt to measure the FR on my own and post it here if I succeed.
I will take anything at this point.

Random Actions in Default Music App?

I haven't been using the default music app because randomly it does an action after a while of playback, pretty much every few minutes; back, forward, pause, whatever, it random action just randomly happens. I've wondered if I somehow accidentally used some sort of gesture or touched the screen, but it happens when the screen is off as well and there doesn't seem to be any gesture that would affect the music app anyway. Does anyone have any idea what can be causing this?
I've been using PowerAmp which doesn't seem to support the A7's DAC. I have it set to 24 bit sound in the last Alpha of PowerAmp (which was many months ago, I've given up on any update for PowerAmp ever arriving) but after side by side sample comparisons they do sound different. The problem is I'm not sure if there's a slight volume difference between programs causing that, or if it's some setting, or if it really is due to the output being done on different DACs resulting in the differences. Pocket Now's video stating it only outputs 16 bit downsampled audio has also stuck in my mind, but despite contacting them twice on different social media, they never responded. That's infuriating, making a bold statement like that, then never providing an explanation and leaving it ambiguous, never stating if the downsampling was at software level, firmware level, or anything.
So I basically have no idea what the hell is going on with the audio on this thing in any way, from software to hardware. That's incredibly frustrating considering the DAC is a major reason why I bought this phone instead of something else.
Edit: I forgot to ask, what software should I use to confirm what sort of bit rate depth the Axon 7 is outputting? I have a Sound Blaster ZxR for recording, so I can plug the A7 right into that.
I can't tell you how to test the depth of the audio coming from the cell. If you can't tell the difference is there any real point? It it just a matter of wanting the product you thought you were paying for?
For the other issue, a really simple thing you've probably done already is checking that ZTE's voice software isn't enabled for media control. An old S4 of mine would go "back" any time a sound remotely like a short "a" played.
PiArc said:
I can't tell you how to test the depth of the audio coming from the cell. If you can't tell the difference is there any real point? It it just a matter of wanting the product you thought you were paying for?
For the other issue, a really simple thing you've probably done already is checking that ZTE's voice software isn't enabled for media control. An old S4 of mine would go "back" any time a sound remotely like a short "a" played.
Click to expand...
Click to collapse
I can tell a difference, on the default music player it sounds better, for example instruments sound more crisp and separated from the rest of the audio. The issue is that I can't tell if that perception of more crisp/separated sound is due to a slight difference of volume between programs which is difficult to perceive. Just to add to the confusion, different songs seem to have different volume levels on each player, which aren't consistent. For example song A may be louder on PowerAmp, but song B is louder on the stock player. In those cases where the songs are clearly different volumes (maybe 10% of the time) it makes it extremely difficult to tell which one sounds better to me. This is with all equalizer/Dolby settings disabled.
Humans easily mistake higher volume for "better" quality in various ways. That's really the reason for the "volume wars" or whatever it's called; music was often mastered with levels just blasting instead of balancing the audio properly.
What I was asking is what free program can I use to record audio from my phone to check if it's outputting 24 bit audio? But on that same note, yes, I suppose that would also let me directly measure volume as well.
As for the voice recognition, I'll try disabling that and see if it helps, but isn't that supposed to only work when holding down the back key anyway? Also, often when it did a random command like next or previous song, I was silent.
Ah, I see. Sorry to not be helpful whatsoever.
Hmm y somehow ZTE has volume differences. I also noticed it if i enable/disable Dolby Atmos.
But i also think that ZTE set up some DSP stuff on AK4490/61. I would be happy if there was an app which could change DSP etc settings of this DACs :/
I also noticed the fluctuating volume, for me it's via bluetooth.
It would progressively become quiet and when the next song starts it would scare the crap out of me (much louder), then repeat.
Rarely, it would continue to play randomly after I disconnect from bluetooth (not immediately after).
So it would be nice if someone found a good music player that takes advantage of the DACs and not exhibit random behavior -- alternatively if this was fixed that would also be good.
EDIT: For me, it happens in a certain volume range in the upper end. Anything lower or higher this does not happen.

Viper4Android for cars

I've seen a few posts recently about how to set up Viper4Android on an Android head unit, so thought I would start this thread so that we could share some ideas. The configuration that I posted below is what I came up with in 15 minutes of experimenting yesterday. It's not a definitive or optimum config, it's just what I came up with, but I am very happy with the result. The purpose of this thread is to share ideas and configurations, due to there being a complete lack of this kind of information anywhere else that I could find.
First, a disclaimer: I'm half deaf, have constant ringing in my ears, and I am most definately not an audiophile, so take anything I say below with a grain of salt. Having said that, I do appreciate clarity when listening to music, so that is always my priority.
So I installed an android head unit in my car last week, installed the Hal9k ROM which came with Viper4Android (V4A) pre-installed. I've played around with V4A on my phone before with goods results, it's mainly geared towards phones with earphones, so don't expect too much from it using it in the car. But I played around with it yesterday and came up with a setup that I am really happy with, it gives in my opinion a richer, fuller sound, with no loss of clarity.
So here is what I did:
1) Select the speaker icon down the bottom. The headphone setup certainly has a lot more options available, but I went with the speaker setup as that's what I'm using.
2) Turn on the Master Limiter
3) I turned on Playback Gain control for a specific reason. My head unit has a bit of hiss with no signal at very high volumes. I can't hear it while the engine is running, but it's there. Bumping up the playback gain control let me turn down the gain on the head unit (look in Factory Settings) which reduced the hiss, but without any clipping or distortion that I can hear. I set Strength to 2, Max Gain to 9x, and output threshold to -1db.
4) I turned on the FIR equaliser. I was using the equaliser in the Amplifier app that came with my head unit, but I would rather just have all of these settings in one place, so I set the Amp equaliser to flat, and made all of my adjustments within the FIR equaliser. My setup tends to be a bit bass-heavy to my ears, so I just use the equaliser to gently taper off the bass, and I leave everything else flat. But just adjust it so that it sounds right to you in your car with your choice of music.
5) I turned on Reverberation. I dare say many will scoff at this, but I like the effect. It makes the sound more "full", without any loss of clarity that I can hear. I used fairly minimal settings to achieve this effect. Room size = 25m2, Sound Field = 6m, Damping Factor = 20%, Wet Signal= 20%, Dry Signal = 50%.
And that's what I came up with in 15 minutes. I'm really happy with the result though. Hopefully that will give others a starting point to do some more experimentation. And if you have your own ideas, please share them here
jrobbom5 said:
I've seen a few posts recently about how to set up Viper4Android on an Android head unit, so thought I would start this thread so that we could share some ideas. The configuration that I posted below is what I came up with in 15 minutes of experimenting yesterday. It's not a definitive or optimum config, it's just what I came up with, but I am very happy with the result. The purpose of this thread is to share ideas and configurations, due to there being a complete lack of this kind of information anywhere else that I could find.
First, a disclaimer: I'm half deaf, have constant ringing in my ears, and I am most definately not an audiophile, so take anything I say below with a grain of salt. Having said that, I do appreciate clarity when listening to music, so that is always my priority.
So I installed an android head unit in my car last week, installed the Hal9k ROM which came with Viper4Android (V4A) pre-installed. I've played around with V4A on my phone before with goods results, it's mainly geared towards phones with earphones, so don't expect too much from it using it in the car. But I played around with it yesterday and came up with a setup that I am really happy with, it gives in my opinion a richer, fuller sound, with no loss of clarity.
So here is what I did:
1) Select the speaker icon down the bottom. The headphone setup certainly has a lot more options available, but I went with the speaker setup as that's what I'm using.
2) Turn on the Master Limiter
3) I turned on Playback Gain control for a specific reason. My head unit has a bit of hiss with no signal at very high volumes. I can't hear it while the engine is running, but it's there. Bumping up the playback gain control let me turn down the gain on the head unit (look in Factory Settings) which reduced the hiss, but without any clipping or distortion that I can hear. I set Strength to 2, Max Gain to 9x, and output threshold to -1db.
4) I turned on the FIR equaliser. I was using the equaliser in the Amplifier app that came with my head unit, but I would rather just have all of these settings in one place, so I set the Amp equaliser to flat, and made all of my adjustments within the FIR equaliser. My setup tends to be a bit bass-heavy to my ears, so I just use the equaliser to gently taper off the bass, and I leave everything else flat. But just adjust it so that it sounds right to you in your car with your choice of music.
5) I turned on Reverberation. I dare say many will scoff at this, but I like the effect. It makes the sound more "full", without any loss of clarity that I can hear. I used fairly minimal settings to achieve this effect. Room size = 25m2, Sound Field = 6m, Damping Factor = 20%, Wet Signal= 20%, Dry Signal = 50%.
And that's what I came up with in 15 minutes. I'm really happy with the result though. Hopefully that will give others a starting point to do some more experimentation. And if you have your own ideas, please share them here
Click to expand...
Click to collapse
I downloaded Malay Mod {and got the Full Version}. It also came with V4A but I hear no difference no matter what I've got selected. Mine has "Headset - Phone Speaker - Bluetooth Device - USB/Dock" tried them all ..
My headunit pushes amps via RCAs, so maybe it doesn't work through those channels?
Good ideas on your tuning {I've for tinnitus too}.

audio is only 2 channel - no fade

I recently bought this android head unit and installed it in my 98 suburban. First, I didn't realize this radio was only 2 channel with no fade from front to read.
I also noticed that going from volume level 19 to 20, the volume spikes for a split second then returns to normal. This head unit was not as oud as I thought it was going to be and I wasn't expecting it to shatter the windows or anything...
So my questions are these:
1) is there a way I can enable fade through software? I have 4 wires coming out of the radio for fr fl rr and rl, but fade does absolutely nothing and I would like to enable this somehow. Maybe the channels are bridged inside the amp... But theseller tells me it is 4 ohm per speaker but it is only 2 channel without fade. I am not understanding something here and if someone could explain this to me I would greatly appreciate it.
2) it seems like it is being limited intentionally somehow and installing any audio booster just distorts the audio. Is there a way to increase the overall volume output?
Could they have installed some kind of hardware that limited the fade option and limited the audio levels intentionally (for buying the cheaper version) and could this be reversed somehow?
Any help would be appreciated

Categories

Resources