Audio input signal path - minimizing phase distortion/HPF - Android Q&A, Help & Troubleshooting

After digging into the kernel code for the Qualcomm WCD audio codecs on a few phones (Hammerhead, Pixel, Nexus 6P) I'm having some trouble figuring out how to access the DC blocking/high-pass filter being applied to a signal coming in through the headset mic line (ADC2 on some phones). Looking at the spectrum on all of these phones shows a definite high-pass filter shape with a cutoff between 50-100 Hz depending on the phone. What is more problematic is the phase distortion that the DC blocker is applying.
Originally I tried modifying the TX HPF Cutoff settings as well as turning it on in cases where it was still off during recording, just to see if it would have an effect. These values don't seem to affect the signal at all, whether it's set to 3 Hz, the default of 75, or the max of 150. I believe the TX HPF is only part of the signal chain during telephony modes and not during normal recording. There are also IIR filters available with these Qualcomm codecs but looking at the datasheet for the WCD9311 (the only one publicly available) shows that these are for sidetone processing and not the direct ACD headset mic path, so again it seems these are only applicable in telephony modes.
For my application the raw signal is desired - so minimal HPF effects, no ANC, no Compander, and no automatic gain control. Basically what the new UNPROCESSED config in Nougat is supposed to provide, but testing so far on the Pixel has shown that this HPF+phase distortion are still happening even when running a clean square wave or similar signal in through the headset mic line. I'm using TinyMixer to check exposed mixer path values over adb in real-time while recording (and comparing the values to what they are before recording).
In the past on the Nexus S this problem could be overcome with root by modifying a register (the enum was something like ADC High Pass Filter Switch), but the mixer paths for these WCD9xxx codecs are a little more complex with no signs of a single HPF switch for this ADC line that exists outside of the TX one. This doesn't seem to be a problem that many people face but I was hoping for any insight anyone here may have, and also hoping that anyone who needs to use this line in without distorting their signals will be able to find a solution in the future, at least before USB C over and the 3.5mm jack becomes obsolete.

Related

[Q] System-wide Default Microphone?

Apologies in advance for posting in the Dev thread, but this didn't get too much attention in Q/A.
So, some apps that record audio (like Tape Machine) offer a configuration option that allows you to select which microphone to use. Consistently, on the Atrix, the hardware entry "Front mic" only captures loud static (like what you get with Skype), but "Rear mic" works like a champ.
I can't find any configuration option in Skype to use the rear microphone (not even when on speakerphone), and don't expect to. However, I do have hope for finding a system-side setting for default mic somewhere. Hell, I'd even settle for the option for swapping the hardware table IDs for the front and rear mics (in the mindset that I can mislead Skype into accessing the rear mic). I know it'd have repercussions elsewhere, but I'm still curious.
I've fiddled with /etc/asound.conf quite a bit, shooting in the dark, adding all sorts of hw and card entries, to no avail (probably because I'm doing it wrong, or not everything uses ALSA, or both). Does anyone have any idea of other places to look?
Moved to proper forum

[Q] Optimus One(P-500) "Clear voice" function?

I am having a strange problem with incoming calls.
The voice quality is very bad with the other persons voice being "metallic".
However, no such problems in outgoing calls, and other people can hear my voice fine.
I called up my network operator, and they tell me I need to switch off "Clear voice" setting in my phone.
However, I went through all settings, and there is actually nothing with this name.
So is there such a setting?
If not, can I try upgrading to latest firmware. Actually, I have not updated my froyo (I am still on 10b), as I do not want to loose capability of rooting.
I think latest is 2.2.2 (10e). I am not sure if its rootable.
Any ideas?
I don't think there is such option in optimus one, try to switch to 3g network if you use 2g, but compared with other phones my optimus one output sound quality is bad. I don't think that you can do anything but if you find a way to improve sound quality let me know.
do you experience background static noise? because I cand hear a background buzzing noise everytime the sound is on.
tsk1979 said:
I called up my network operator, and they tell me I need to switch off "Clear voice" setting in my phone.
However, I went through all settings, and there is actually nothing with this name.
So is there such a setting?
Click to expand...
Click to collapse
Ask to talk to someone technically savvy who knows WTH are they talking about next time. There is no such thing anywhere and frankly I do not recall any mobile phone that would have such thing like "clear voice".
2g and 3g have nothing to do with voice quality... oh, and the background static is a bug of all O1s, unfortunately.
Voice quality is dependent on the price of the device, so a budget phone generally means poorer quality... only Nokia had perfect reception on their low-end models... just my 2 cents.
Maybe that operator got his features mixed-up and he was referring to HD Voice - I know Orange launched it in a few countries, but that's a whole other thing.
Sent from my LG-P500 using XDA Premium App
sholimar said:
2g and 3g have nothing to do with voice quality... oh, and the background static is a bug of all O1s, unfortunately.
Voice quality is dependent on the price of the device, so a budget phone generally means poorer quality... only Nokia had perfect reception on their low-end models... just my 2 cents.
Maybe that operator got his features mixed-up and he was referring to HD Voice - I know Orange launched it in a few countries, but that's a whole other thing.
Sent from my LG-P500 using XDA Premium App
Click to expand...
Click to collapse
Ah, speaking of HD Voice, do you think devices NOT bought from Orange could use it?
Also, have you noticed that, during calls, there seems to be some form of noise reduction going on? If the person you are talking to is in a quiet(er) environment, and they stop talking, the speaker goes completely silent, whereas when they are talking you can hear the normal (IMO) GSM background noises.
metalboy94 said:
Ah, speaking of HD Voice, do you think devices NOT bought from Orange could use it?
Click to expand...
Click to collapse
Actually, many devices support it at this time, since it's a codec-related thing and not a hardware one (and it's not proprietary to Orange, it's a standard that will be implemented in time)... It's rather tricky to make an assumption about your O1, since I really have no clue if the appropriate codecs are included on our phones, if they are activated etc.; just ask someone from Orange (although I'm sure that most will not know the answer).
Here's a very interesting article detailing HD voice tech, written by Eldar Murtazin: http://www.mobile-review.com/articles/2010/hd-voice-en.shtml.
metalboy94 said:
Also, have you noticed that, during calls, there seems to be some form of noise reduction going on? If the person you are talking to is in a quiet(er) environment, and they stop talking, the speaker goes completely silent, whereas when they are talking you can hear the normal (IMO) GSM background noises.
Click to expand...
Click to collapse
Yeah, that's normal, I have encountered it on many phones... it's probably related to the passive noise cancellation algorithms our devices use (where they try to make out what part of the sound received in the mic is the voice and which one is the ambient background). It's a really long discussion, since when the mic receives a sound lower than X dB it cuts it out, then as soon as it detects a more powerful sound it applies a kind of gain (hence the static) and so on.
Oh, note that these are all more like educated guesses, but I think they're pretty correct.
Now, with active noise cancellation... well, that's just another world! (I had the pleasure of a few conversations with a phone that supported it)
There is no static.
Its just that, from some networks(not all) when I get incoming call, the voice is "metallic" and keeps breaking, even when signal is full.
So its impossible to have a conversation.
I guess its a problem with my network operator then.
In Hidden Menu (3845#*500#), under
DEVICE TEST->SOUND TEST-> VOCODER are the settings that affect noise reduction and bad call quality but I do not know what parameter disables sound processing on calls.
Also on page no.55 in service manual, there is this text and I hope that it can be useful to someone with greater knowledge to change parameters and turn off noise suppression, and that stupid hiiiisss sound during call.
3.13.2. Audio signal processing & interface
3.13.2.1 MSM7227 audio interface
The MSM7227A audio front end comprises the stereo wideband codec, PCM interface, and additional DSP
audio processing. The stereo wideband codec allows the MSM7227 device to support stereo music/ringer
melody applications in addition to the 8 kHz voice band applications on the forward link.
In the audio transmit path, the device operates as 13-bit linear converter with software, selectable 8 kHz and
16 kHz sampling rate. In the audio receive path, the device operates as a software-selectable 13-bit or 16-bit
linear converter with software selectable 8 kHz,16 kHz, 22.05 kHz, 24 kHz, 32 kHz, 44.1 kHz, or 48 kHz
sampling rate. Through software, the Rx path can be configured as either a mono or stereo output. New to
the MSM7227 device is a transmit (Tx) ADC path that now supports stereo wideband sampling. The
integrated codec contains all of the required conversion and amplification stages for the audio front end. Th
codec operates as a 13-bit linear codec with the transmit (Tx) and receive (Rx) filters designed to meet ITU-T
G.712 requirements.
The codec includes a programmable side tone path for summing a portion of the Tx audio into the Rx path.
An on-chip voltage/current reference is provided to generate the precise voltages and currents required by
the codec. This circuit requires a single capacitor of 0.1 μF to be connected between the CCOMP and GND
pins. The on-chip voltage reference also provides a microphone bias voltage required for electret condenser
microphones typically used in handset applications. The MICBIAS output pin is designed to provide 1.8 V DC
while delivering as much as 1 mA of current.
Click to expand...
Click to collapse

Microphone volume adjusting automatically & not scaling properly...

I am developing a sound level meter app for Android. (I use standard AudioRecord and then process the buffers with JTransforms FFT to get the amplitudes and eventually calculate the dBA value)
My app is currently working very well (I have compared it to a real SLM, and I have tested various devices)
Currently I am having the following device specific issues: (Take note that I am recording with an external (AUX) microphone)
- Samsung J2 (J200H): The dB does not step correctly.. In a certain range, if I step the noise down 5dB it goes down 5dB, but in some ranges it steps 10dB when I step down 5dB. I have recorded the audio and by measuring the recording I can see it not stepping correctly, which means that the fault is happening on the device level, and not my app. I have two other J2 models (J200G & J200F), on both of these it is working perfectly. Any ideas what could be causing this? Where should I look?
- On Xiaomi devices (Redmi Note 4 & Redmi 4A) it seems like there is some kind of Automatic Gain Control enabled. (getEnabled() for AGC returns false). When presenting a tone the dB reading goes very high, and then after about a second lowers by 10-20dB. If anything in the audio changes it "jumps" again and then lowers again. Once again, I can hear the effect when recording a tone - the tone starts high and then lowers, even though there is no change in the source.
Any help would be greatly appreciated as I have no idea how to move forward...

Music Volume Leveling / Normalization

Completely subjective of course, though I've found the V30 music playing capability to be sub-par relative to leveling sound volume...well there isn't any at all. By leveling/normalization, I mean minimizing/reducing the volume level between tracks - maintain a consistent volume. My previous Xperia Z2 did fantastic job of keeping the volume disparity to a minimum. Maybe 1 or 2 volume steps max if I needed to adjust. The V30 requires 6+ in some instances.
I've tried Black and Pulsar Players as well as some equalizer apps that purported to perform some degree of leveling. No joy.
Has anyone else found this to be true? Have you found a solution?
Messing around with foobar2000 and ReplayGain. Preliminary results seemed positive. Using the tags vs re-encoding - keeps file quality intact.

Question Bad Microphone quality speech intelligibility in messaging apps eg WhatsApp, Duo, Telegram

Hello
Since I have my Pixel 6 all of my messaging partners (WhatsApp, Duo, Signal, Telegram etc) are telling me audio problems including bad quality, low volume, and not last poor speech intelligibility.
The problem happens in live call/video as well audio messages too. Since I own the phone I have received 3 updates, but non of them are fixed or changed anything on this issue.
I have started to investigate the problem and I discovered two major things. Signal loss, and hardly limited frequency range, which happens if the message gets recorded with any messaging application (including Google Duo too)
To test it I record the same audio source with the built-in recorder or WhatsApp.
The audio in the Whatsapp message gets -6dB less loud, and 6kHz above with a hard cut no Audio transmitted.
That has a significant impact on the end result of the audio and definitely doesn't help to improve the speech intelligibility.
The built-in recorder records the same source perfectly which confirms that the phone physically working well. The problem is related to the messaging applications...
It could be eg down sampling problem too.
It is obviously more difficult to understand the speech recorded with eg WhatsApp using Pixel 6 phone then any other phone.
By searching about sample rate related topics, I found an interesting statement which explains why the speech intelligibility bad on the device as in my recordings the frequency range is very narrow as higher than 5kHz starts to drop and above 6kHz no audio recorded.
"For audio, the minimum number of samples per second to unambiguously represent English speech is 8000 Hz. Using less than that would result in speech that might not be comprehensible due to a variety of reasons, one of which is how similar utterances will not be distinguishable from one another. Lower sampling rates confound phonemes, or sounds in a language, which have significant high-frequency energy; for example, with 5000 Hz, it is difficult to distinguish /s/ from /sh/ or /f/."
Listen the samples below:
Wow, honestly I didn't think before that I'd be the only one here getting annoyed that there's a bug that degrades a theoretically higher-class phone in one of the main things: Communication and no one else is complaining about it.
The audio is for some reason converted to a quality that doesn't even reach the theoretical minimum of 8kHz that was very common in analogue telephony in the early 19xx years
And now....
Digital made it worse back then
The issue also occurs on the Pixel 6 and Pixel 6 Pro and I have not seen this issue on any other phone before.
Is there anyone here who can run the same test on any custom ROM to verify the phone is able to send audio in a voice message e.g. WhatsApp, Telegram, Signal etc. with more than 6 kHz?
Just play this audio on your home audio system and record it with the Messenger app, play back the message...
Do you hear audio above 6kHz?
I have a second Pixel 6 (the first one was sent under warranty to Google), and both have a quiet voice recording. The interlocutors complain, but I can’t do anything about it. Google is not responding to these massive complaints.

Categories

Resources