We are telco company and want to evaluate Perceptual voice quality. so as part of our product, we have implemented PSEQ in ARM v7 optimized assembly module. The module is C callable. we used the ARM emulator and GSM phone Audio In/out port to make automated calls to test our PSEQ. It works fine Now we want to implement it in smartphone, so our engineers can fix this on go
By browsing the code I came to /devices/libaudio/AudioHardware.cpp.
There is a thread on xda for two way call recording.
http://forum.xda-developers.com/archive/index.php/t-1648313.html
unfortunately it uses modem AT-commands to read file descriptors to open audio device and route it to voice recorder application, I want to use ALSA buffer to compare test vector response with actual received voice in buffer
ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t bytes)
ssize_t AudioHardware::AudioStreamInALSA::read(void* buffer, ssize_t bytes)
The documentation is too generic in android. I tried to change above functions, but no effect on telephony, how do i get RIL hook on that .
Related
Hi,
I found this reg tweak which looks good however, I have a couple of questions before I go ahead with it.
I already have a "bitpool" value of 30. Can I just change this too say 48? Or do I have to add another dword?
What exactly does this tweak improve.....is it the quality of sound that I will hear from my handfree in my car???
Improve BT A2DP sound quality
[HKLM/Software/Microsoft/Bluetooth/A2DP/Settings]
Add new dword, Value name=BitPool; Value data=48 (Decimal)
Modify, Value name=UseJointStereo; Value data=0 (Decimal, Originally 1)
For BitPool:
Microsoft suggests the following bitpool values for optimal buffer sizes.
30 - Low audio quality
40 - Medium audio quality
48 - High audio quality
58 - Excellent audio quality
Chose one you like. I think 48 is good enough.
For UseJointStereo: use 0 instead of 1, then you got the real stereo.
Show Network Operator Name in today screen.
Rob.
you change the current dword. it willl assign more memory / processing power to the application... why are you changing it?
in music apps there is a buffer size which is a happy medium between quality of sound vs latency...
you can probably push it to the max, but you may find that your phone degrades in usability / the amount of time it actually takes to hear / respond.
change it, soft reset and test... if you notice no problems then great, if you get glitches then change it back. i doubt you will get any problems you cant get out of, but its good practice to run a backup of the registry before you do any changes just in case!
better to be safe than sorry!!!
Hi all,
i read many thread on that but nothing really clear so...
All you need is an unlocked wp7 device with some register editor or provxml, Schaps's advanced conf seems to deal with it too (i prefer typing my registry modifs).
I suggest trying to listen a real stereo with 48000hz sample rate...have to be a professional musician to hear differences when setting that rate higher.
HKLM\Software\Microsoft\Bluetooth\A2DP\Settings
BitPool : Dword = 51
UseJointStereo : Dword = 0
------------------------------------
(what's next could be linked with the kind of BTheadphone u use)
HKLM\Software\Microsoft\Bluetooth\Device\........\Services\..........(then u should see u're in stereo sound settings)
enabled : Dword = 1
------------------------------------
I tried many others entries and those are the most stable. No cliks, bips, stops or distortions...sound is wide and heavy as it should be, if not, try some others headphones.
While the audio quality is fine (Quite a bit better with your tweek for sure), do you notice a lag in the audio when viewing video on your device? On my Newly flashed Arrive, it is a noticible lag that sort of destroys the viewing experience.
the lag appears when watching a video with audio over bluetooth or just simply watching a video (audio over device's speaker)?
I won't help you very much because i don't watch videos on my phone...
sometimes i open a youtube link to see a clip but never noticed any issues.
Only when having a video's audio go through Bluetooth. There has never been a lag with the speaker.
Tinkering with some settings and taking a few notes from some old WM 5-6.1 threads which share the exact same reg entries has made the audio sound great, but I'm not sure if the lag is gone or not yet. Some YouTube videos seem to be in sync, others not so much. Netflix is my prime concern as well but I need to test it a bit more before I can say for sure.
Once the devs get their hands on the new touchwiz ice cream rom will we be able to use one of those roms to record video and take pics and the same time on our SGSII (touch4g) or will it be some hardware limitations? Thanks
colourfuze said:
Once the devs get their hands on the new touchwiz ice cream rom will we be able to use one of those roms to record video and take pics and the same time or will it be some hardware limitations? Thanks
Click to expand...
Click to collapse
How they have it implemented on the SGSIII is a good question. But to pull a still from video unencoded and save it as an image while shooting is all a software matter, assuming the following. Having the spare room in the buffer to NOT dump the frame after its been encoded to the video, the processing power to be able to encode the image to a jpeg (etc) while encoding the video and the spare speed on the flash storage to write that file while flushing the encoded video from buffer to flash, would be the areas of concern.
I believe the video encoder is in hardware so as long as we can duplicate or hold a particular frame in buffer to save it as an encoded image I dont see the inability to do it somehow. I mean maybe not Samsung's application but if there was a non stock application to add the feature to.
Light hits the sensor and generates a signal and that signal is read line by line and fed through a analog to digital signal converter. Each frame is stored in a buffer waiting to be encoded and then written to a file. That feature just grabs one of those frames and also saves it to an image. There is a minor amount of headroom needed to do the operation but its not huge.
Hello folks,
I tried to record decent 1080p video on my SGSII. Turned out that really gets a problem.
My device runs on Android 4.0.3 (IML74.XXLPQ) in combination with the Siyah kernel (3.0.32-Siyah-v3.2.5.2+ [email protected] #113). Secondrom is some CM9 ROM.
First, I just tried the stock Samsung camera app, but I can't work with the refocusing. Seems impossible to turn off the autofocus.
Besides that, the automatic white balance is crap. When I run through, wearing an orange shirt, it fu**s up the white balance and the picture gets a blue tint for a few seconds. Presets aren't the best, too.
I tried the ICS camera (while using CM9 secondrom). Same problems, but video stops recording after 16 minutes or so, and it doesn't proceed. I mean, what the f**k?
At this point, I'm looking for a camera app that:
- (optionally) has manual white balance (for me to set it using a white sheet of paper).
- can set the focus to fixed.
- records as long as I want it to, until the memory is full or I interrupt it. (When hitting 4GB, it will have to split, but it should automatically continue recording).
That was when I started looking for good camera apps. I tried some, and the best I could find until now was lgCamera. I used the free variant.
It works mostly like I want it to, though I have to set the white balance to some fixed setting. Focuses and fixes it. Everything seems to be okay.
Then it continuously stopped recording, after 4:17 minutes (@30Mbit/s), or after 1:32 minutes (@100Mbit/s). Looking at the files, it only uses 765 MB before stopping. Remember, it has to run as long as I don't stop it and there's memory left!
Of course, I used the free version, but the Play Store says:
Free version limitations:
-sometimes program shows BUYME dialog.
-program icon with red label FREE.
Click to expand...
Click to collapse
I tried the Pro version, but it keeps stopping.
BUT not enough with stopping recording! lgCamera also freezes some times. Especially while recording at 100Mbit/s (usind only 65) when stopping, it just freezes to death, leaving the phone unusable and I have to reboot. Yup, I waited whole 15 minutes, before I rebooted. I also saw how it worked like it should. Very slow when stopped, but hey, no freezes.
At this point, the app also should:
- never freeze! (Can't be that hard to find for an ex-mainstream phone...)
In addition to all that what I mentioned above, the phone loses battery like hell, of course. So I also look for a ROM which is very stable (!) and also very battery-saving while not limiting power used by the video recording app.
Aaand... And this one is a huge bummer... Absolutely every app with which I recorded produces unbelievable crappy framerates!
I set it to 30fps and I get random sh*t between 25 and 32 fps. This is a big downside, because I really get problems working with it in Adobe Premiere/After Effects and also encoding it. Even if I encode it to a “real” framerate, which all editing programs understand, it's still async!
So after I collected hours and hours of material, I don't really want to encode (assuming it would work) every single video (of whose every single one has a different framerate!), because it would take ages (and, of course, the encoding will cost a little quality)!
At this point, it has to:
- have conform fps output (29.970 or 30.000) or at least another fps which stays the same in every video!
- run on a stable, battery-saving ROM.
I don't need any other apps besides the recording one, because I will edit the video on my computer.
If you have read all this, I hope you also help me out.
Which ROM should I use as a pure video recording ROM?
Which app is a stable one for use on the SGSII and has the features I mentioned above?
Do you have any tips for me, how to get the perfect video?
I really hope anyone will help me with this.
Thanks in advance!
Great post.
I will be recording a conference using my SGS2 but, its a long video and I wanted to recorded without crashing the app after I stop the record as it happen using the deffault camera with ICS 4.0.3
Nice post.
I'm looking for exactly what you had written especially a camera application that can automatically resume recording after it reach 4Gb file limit.
I tried several program such as IgCamera and others application but it won't work.
After googling around and spend about a few hours, I found some methods that might workaround this issue.
A. Month External_sd card to NTFS.
This method might workaround 4Gb limit problem for FAT file system and with this I think that Camera application may not automatically stop when recording video file reach their limit.
From camera behavior , It seem that camera application can record video at maximum size upon maximum size of current file system.
Then , I suggest that if event "Reach max file size" occurred , android system whose monitor events will send some signal and command to stop camera application.
So if I can month external_sd card with NTFS file system , I can workaround this issue.
Unfortunately , After I read several topic and spend a few hours to find out how to month NTFS on my android device.
I'm still no luck . I got "fuse device is missing try modprobe fuse as root" and I read somewhere on internet,
someone said that this message may telling me that my kernel won't support the NTFS month.
Now I'm going to move forward to another kernel that have capable of month NTFS as native and trying to month external_sd in NTFS format in a few day.
B. Modify Camera.apk
This method can workaround 4Gb limit problem for FAT file system If you could modify camera.apk.
by modifying method that will be called when recording file reach 4Gb file limit, adding a few line of code to start a new record automatically. I think that this might work.
Some of xda member (Potatoman and rafalense), had successfully modified bitrate and audio sampling rate of camera application
(http://forum.xda-developers.com/showthread.php?t=1104051)
They grab some camera application for their phone , decompile binary source into .class to locate a sample rate of video. After they found an integer that represent a sample rate of video, they made another decompile binary source into a file called ".smali" with a lot less understandable than a class file then edit it and recompile the program.
But, This method won't only just modify a sample rate of video, we needed to modify some part of method.
Since modify Camera application won't easy like sample rate, you needed to grab your camera application from your phone, decompile a binary source, unsign , sign , compile and etc and it is a long story. So I decided to move to another method.
C. Automatic touch simulate program by period.
This workaround work without modify any of your file format , kernel or anything.
If you could find some application to trig the record button after some period of time. So file size limit event won't occur anymore.
Only concern about this method is automatic touch simulate program may not survive long enough to trig the record button for all day.
I'm finding these kind of application and if anyone whose read this topic and know these kind of application , please let me know.
D. Compile your Camera application from Opensource
This is a last method I will ever choose. This is a really hard method but really easy to explain.
This method is about download sourcecode of your rom , edit camera application at the first place then complie it yourself. Since I din't complete reading a guide for compile a rom , I suggest that inorder to make modified camera application work , you may need to compile all of rom.
From my phone manufacturer(samsung), they had released some sourcecode of for Galaxy S2 ICS ROM
For anyone whose interest please find it in the link below.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Update
Hi , all
I just successfully found a workaround for video file size limit issue.
This workaround is based on approach C. Automatic touch simulate program by period and it also need a root access.
All credit goes to Yahor Paulavets from
http://softteco.blogspot.com/2011/03/android-low-level-shell-click-on-screen.html
To complete this workaround , I write some shell script that send a low-level script via Scripting Layer for Android (SL4A) to stop video recording then send the same command again to start new record before its size reach 4 Gb. After finished writing shell script, I use terminal editor (with root access) to run this script when I start recording video.
That sound easy, but in fact, you need to capture a "touch event" with have difference signature based on the device.
Yahor Paulavets write some great article which explain how to capture this signature in the link below
http://softteco.blogspot.com/2011/03/android-clickonscreenxy-shell-script.html
____________________________________________________________________________________
Below are list of related topic that might help you
[1] Is there anyway around the 4GB video recording limit?
http://forum.xda-developers.com/showthread.php?t=1140483
[2] How to mount NTFS or EXT4 format microSD to tab
http://forum.xda-developers.com/showthread.php?t=1552674
[3] [MOD] Hacked Camera.APK for better audio quality, usage with any battery life & MORE!
http://forum.xda-developers.com/showthread.php?t=1104051
[4] App for long video recording
http://forum.xda-developers.com/showthread.php?t=1471449
[5] How can I bypass the 4gb limit on filesizes for HD Recording?
http://forum.xda-developers.com/showthread.php?t=1130973
[6] Month ExternalSD Card to NTFS for Android
http://forum.xda-developers.com/showpost.php?p=15167790&postcount=41
[7] Samsung opensource
http://opensource.samsung.com
Project Purposes: Optimize sound quality of Pixel/XL 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(full implementation pending). Integration of the Biquad equalization/filter mod by @chdloc as a parametric equalizer(full implementation pending). The equalizer is capable of 5 bands, different left and right parameters and clipping protection.
This is a derivative of my Gain control app. Please see that post and following comments to better understand what follows.
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: Rooted Pixel or XL, custom kernel supporting sound control(only tested with Elementalx-thanks to @flar2), custom mixerpaths if using biquads (thanks to @chdloc).
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. In order to detect when music is playing a “helper” app needs to be installed.
Setup:
Unzip both sets of files(just an xda upload thing-would not take them singly)
Install the Pixel audio control app, and the app "Intent Trigger".
Place mixer_paths in system/etc (not in su/etc). You may want to rename the original to ....old.
Place audio_effects.conf and audio_policy_configuration in system/etc---if you are interested in using the visualizer engine to look at accurate Spl and dynamic range of your tracks. You may want to rename the originals to ....old
In addition for the USB Dac control to work, ALSA needs to be installed. A folder "USR" containing the ALSA files needs to be placed inside of the su folder, and alsa_amixer placed inside of su/bin and su/xbin
Note-if you want to just control gains and not biquads, the mixerpaths should not be needed
Reboot.
Open the main app(not playing music), no setup is required for basic operation, as you can see just move the sliders to change android vol, analog and digital gain. The purpose of the app is to keep analog gain low and digital as close to 0 as possible (to attain the given net output you want). The program will try to keep android vol at 15 (0 dB), analog at 0 and gradually boost by 1 dB another digital register (RX digital volume). Decreasing net output is in reverse. At this point you may want to confirm that analog vol is set to 0 and Digital to perhaps -15.
Note, adjusting the main android vol slider without the headset in will adjust the speaker vol, not the headset vol.
Close the screen-either menu close, or back button
Next, put in a headset, and play music-keep the headset out of your ears just in case .
A notification bar should pop up.
{
"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"
}
There are choices on the bar if you pull it down further, up, down or sliders to control the volume. It should remember the last setting on play, pause and reboots.
Pressing the Bar Name-Gain should bring up a menu of other screens
This is the sliders choice
The 3 dot option brings up the main menu:
Setup option:
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--only use this if you must.
“Say text” on or off to verbally read text messages or not during music play.
In the setup screen is a spinner controlling the RX digital gain "cut off" point when using the up and down buttons. Both @chdloc and I have noted that the audio codec introduced some distortion when the RX digital gain reaches about -15 dB+- and worsens as it nears 0. Interestingly, the default mixerpath setting places a maximun of -7 dB on this value and if you add in the normal digital headroom in a tracks mix, this distortion is avoided. Some music apps, Neutron in particular, allow you to normalize tracks to the EBU128 standard, which is between 14 and 20 dB down. So even if your setting is at 0 dB digital gain, the music app is playing lower than this (due to it's own attenuation).
For people who would like to avoid this range however, I placed a way to bypass it. So if you choose 10 dB in the setting and started to ramp up the volume by the gain buttons, once you hit -10dB, analog gain would start increasing-leaving you always at -10 dB RX digital. The slider controls ignore this.
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. In addition, the Pixel can sense headset impedance so we can use that info as a way to individualize equalization filters for each headset you own, or external amp.
Biquads app by @chdloc, has been ported over but I put in some pre defined “bands” and 4 complete “final filters” that I use. Disabled, SE846(7.5 Khz cut with a midrange boost), Oriolus(7.5 Khz cut with a bass boost) and low pass(no high freq passed so you can test the usage out).
What my app will do is capture the numeric band codes from the Biquad app scripts, and take a screenshot of the frequency curve. @chdloc has done all the hard work.
A new twist on choosing a given equalizer filter for a particular headphone is the Pixels’s ability to sense the impedance of the inserted device.
The number is not totally correct but it does give a rough idea and a “signature” of sorts to identify it. If you enable biquads and insert a headset, a screen pops up asking for headset name, sensitivity(leave blank if don’t know), published impedance (leave blank if not sure-the app will use the sensed value), and which biquad composite to use. Enter to close. If you insert the headset again, the app should know the previous choices. If the entry screen opens again, look to see what the impedance is sensed as-if 0, just remove it and wait a couple of secs and try again. If a close number to the initial, just enter it again as above. I have noted a variation in sensed impedance and for now let's just duplicate the entry.
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.
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” (INP0) by whatever the max boost was in your filters. So if you are boosting low bass by 8 dB, INP0 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.
USB Dac control:
On DAC 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.
Note- On rare cases there is a bug that leads to failure to sense when the USB Dac is pulled. As a work around, there is a "Quit" command in the main menu. Pull the Dac, Quit the app, then just restart it from the app tray and the app will be re initialized and ready to go.
If you do not want to have the Usb Dac control anymore, there is a Disable button on the control screen.
Spl monitoring:
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.
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 Headphone Entry screen, if biquads are enable, it will pop up on any new headset insertion. The visualizer can also be enable in the SPL menu choice
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.
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.
Additional information
The Spl visualizer is now working with all(?) music apps but the effects and policy files above must replace the stock ones. If not, only google music will be picked up by the visualizer. In Neutron make sure you choose "generic" driver in the apps settings (it in no way alters the SQ). I have not tested Poweramp. Spotify is working fine.
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"(not yet for the pixel) or Button remapper. It works well but only with screen on. 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).
Many thanks as usual to @chdloc for all the help, guidance and for creating Biquads app. The mixer_paths and ALSA driver are his.
Also to @flar2 for the kernel.
Measurements done to confirm the logic behind the above gain choices (as well as mixerpath DAC options)
Update done:
Full Biquads support
Full USB Dac support (thanks to @chdloc for the ALSA lib)
Spl monitoring options (still WIP)
Better gain optimizations
Bug fixes
This is awesome. Thanks
? --->
Update:
Bug fixes
Visualizer now working with most music apps. You will need to replace the audio_effects. conf and audio_policy_configuration files in system/etc. (Thanks to @Mentalmuso for the files-they are from viper mod).
Android 7.1.1 caused some good and bad. The usb removal bug is gone, but biquads are affected. Mixerpaths needs to be in system/etc (no more bind mount) and there may be a fraction of a second where the left channel is quiet when you start play. See @chdloc thread for details.
The app is finally back to what it was pre Pixel.