[Q] How does Android handle audio and ALSA? - Android Q&A, Help & Troubleshooting

Hello to all,
I recently purchased the Galaxy S2 and flashed CM7 on to it only to find that there is a bug that causes the media volume slider to not behave properly when a headset is plugged in. It has nothing to do with the overall volume (as that is currently a hardware limitation) but rather it has to do with the way the media volume slider works with input from the volume keys.
When a headset is plugged in, the volume keys only respond up to 6/15 and after that there is no increase or decrease within the 6-15/15 range. This is a major inconvenience as you have to bring the volume all the way down to get any control.
Furthermore, the bug isn't only found when input is received from the volume keys but rather any input from the system is non-responsive.
I have been informed that the bug doesn't affect every user and so it makes me think whether or not the bug is caused by a hardware issue.
I ran a logcat and didn't see anything out of the ordinary when volume was being changed and that's where I am stumped!
Correct me if I am wrong but since Android is based off of the Linux Kernel, I assume it has ALSA built-in for audio management? If so, I wanted to see if ALSA has anything that can let me set how the ALSA mixer should scale the volume depending on the keys pressed.
I am new when it comes to development for Android and thought I would take a whack at fixing this issue since I don't want to bother major devs who are right now working on CM9.
So my question to all the developers here is: How does Android handle its audio when receiving commands to scale volume up and down through both hardware keys and software input?
Any help would be appreciated!

Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A

If you can, try reflashing your ROM.
ANDROID does use a version of ALSA. Try installing MixGet. It accesses ALSA instead of the android mixer.
Cheers!
-M
XDA member since 2007

Related

[Q] HD2 Volume Step too big - Changeable?

Hallo,
everytime one adjusts the volume of the HD2 with the devices hardware buttons, the step is very high.
I have been searching the forum, but I didn't find any solution, how to decrease the stepwidth - only have seen, that some other people have the same issue (but no solution).
Is there any possibility to manipulate the stepwitdh????
I have checked the registry and I am wondering if in one of the following reg.keys the stepwidth might be coded:
HKLM\Software\HTC\VolumeOverlay
=> I guess this is the HTC Volume control screen, which appears when you press the hardware buttons. But I have no clue if one of the entries defines the stepwitdh.
The other possibility I see here:
HKCU\ControlPanel\Volume
I would like to have some feedback, before trying to mess in the registry.
Hugo the JungleDyret
I do remember there being a fix for this, as far as I can remember it was an image that you drop and dragged into your windows folder and that some how fixes it.
I do think it's quite annoying, it's also really laggy when I hold down my volume key as opposed to tap it per each jump in volume level.
Anyway I don't know where it is but hopefully someone can post it cause I'm after it aswell
maybe you already know, but you can adjust the slider onscreen with your finger and achieve smaller steps of adjustment than can be achieved using the hardware buttons.....
@rumpleforeskin
I know that via touchscreen the volume can be adjusted finer. The issue is...
well try this, while you have your mobile in the beltpocket, listening to music.
I just want to adjust the volume in this situation with the hardwarekeys.
Hugo the JungleDyret
I don't understand why there isn't a fix for this, volumex is a commercial program that does it. But the normal volume control app is perfect, only the steps are indeed way to big...
yeah, i have the same problem i usually listen to max -1 or -2 bars (trance music) and everytime i have to resort to using fingers to slide the volume to max-1/-2. is there a way to adjust each button press = 1 bar?
Anyone know a registry fix for this?
try this, maybe it'll help

[BRAINSTORM] iPhone Headphone Control Keymaps...getting them recognized.

Hi, all.
DISCLAIMER: I'm a newbie to developing native code, but have intermediate skills with C, C++ and some basic assembly.
When I bought my headphones, I had a strong possibility that the VOL UP/DOWN keys would not be recognized by Android...and I was right. Clockworkmod Recovery doesn't report any keymaps when trying them and nothing pops up from dmesg. However, the middle button is recognized as a standard headset button and plays/pauses/goes to next track as expected.
I'm thinking that this is the case because there is no driver that can recognize and, hence, map the other buttons to the keymap used by the kernel. Thus, where do I start with developing such a driver? I know I can measure voltage differences sent by the headphones, but I'm not sure where to go from there. I'm pretty sure I can get a few throwaway headphones with the Apple controls.
This can be an interesting and really, really useful hobby project.
Thanks!
Great idea!
I hate buying stuff thats "Made for iPhone/iPod"!! I almost bought Klipsch s4 instead of s4i in protest. But I needed the mic soo...
I'd really love to controll the volume with my remote, so a i really like the idea.
But i'm sorry i can't do anything to help you <.<
hmmm
I am not a developer nor do I know what I am talking about however just an idea... If you are able to measure the voltage when each button is pressed could you not use that as a signature on what button is being pressed. With that information you would be able to write an application to change the volume based on receiving that information. I know there are applications out there to manage your volume settings so I don't think it would be too much out of the question to have the driver be able to change volume based on the voltage information.
Once again I am not a developer so take whatever I say lightly.
Something likethis? or did I read your post wrong..
I'd love to see this for my Beats by Dre >.> Been waiting a long time for someone to get the volume buttons to work. Hopefully someone out there is willing to take on this project
So what I'm reading is this. What we need is an app that will measure the input of a button, and then be able to map that to a function, preferably like the stock android phones.
Because I think this should be expanded past just iphone.
I'm rather new to Android development (and development in general), so please forgive me if I'm way off here.
Android handles inputs as KeyEvents. These KeyEvents can then be mapped to actions in applications. I found an article detailing how to make custom key maps but I don't have much free time, so I've really only skimmed it.
Using the input reader found here (thanks Forge94) we can see that the center button of the iPhone controller is mapped to key 226; however, the up and down keys are not mapped to anything.
From what I can tell, we can resolve this by doing the following steps (sorry for restating your original post cnunez1987):
1. Read input from iPhone controller
2. Map input to KeyEvent
3. Process KeyEvent with an application
I would gladly do all of this, but as I said, I have almost no development experience whatsoever (a high school CS course I took last year) so I have no idea where to begin. Please let me know if I can help do this in any way.
Sounds Interesting
I have some Beats by dre and can only use the center button i would pay a few bucks to help this development!
I'm with you ejdam206 and the rest of you....this would be so awesome. I was somewhat looking into this since I use (and please don't hate) apple earbuds with mic. The problem is the volume rocker on the earbuds don't do anything but I am able to play/pause and skip/previous tracks. I would prefer to use the controls on the headset rather than turning up the volume on the phone.
Just decided to throw that in. I'm also willing to contribute to a brave dev......
linux kernel doesn't have the real control on the headset keys, in qualcomm msm series device (all htc phone), it just receive notify for key press from modem cpu (there's another os running here), it's not possible to handle new keys by just change linux kernel, even need hard ware change. you can image that it just a matrix key pad, but the line for volume up/down is not connected, so that's impossible.:-(
Sent from my Nexus One using XDA App
pengu1n said:
linux kernel doesn't have the real control on the headset keys, in qualcomm msm series device (all htc phone), it just receive notify for key press from modem cpu (there's another os running here), it's not possible to handle new keys by just change linux kernel, even need hard ware change. you can image that it just a matrix key pad, but the line for volume up/down is not connected, so that's impossible.:-(
Sent from my Nexus One using XDA App
Click to expand...
Click to collapse
Wow; that's a bummer. Thanks for the tip.
pengu1n said:
linux kernel doesn't have the real control on the headset keys, in qualcomm msm series device (all htc phone), it just receive notify for key press from modem cpu (there's another os running here), it's not possible to handle new keys by just change linux kernel, even need hard ware change. you can image that it just a matrix key pad, but the line for volume up/down is not connected, so that's impossible.:-(
Sent from my Nexus One using XDA App
Click to expand...
Click to collapse
I'm on an HTC Incredible. You're saying it's possible there? Thanks.
impossible IMHO
Sent from my Nexus One using XDA App
pengu1n said:
linux kernel doesn't have the real control on the headset keys, in qualcomm msm series device (all htc phone), it just receive notify for key press from modem cpu (there's another os running here), it's not possible to handle new keys by just change linux kernel, even need hard ware change. you can image that it just a matrix key pad, but the line for volume up/down is not connected, so that's impossible.:-(
Sent from my Nexus One using XDA App
Click to expand...
Click to collapse
Too bad... just got the Dre Beats.. but hey, how far are the controls on the phone vs. the headset controls? Exactly...

[Q] Odd unstable volume problem

Hi,
I searched for this and can't find anything on it. Was wondering if anyone else has experienced a similar problem.
When using the FM radio the range of volume that the volume slider/buttons controls isn't always the same. Sometime when a message comes in and a notification plays the volume will jump up. I've tried to use the sound controls in settings to replicate this but it won't do it.
Co-incidentally, receiving messages while the radio is on also sometimes results in the tuned frequency to change :-S
tome_1 said:
Hi,
I searched for this and can't find anything on it. Was wondering if anyone else has experienced a similar problem.
When using the FM radio the range of volume that the volume slider/buttons controls isn't always the same. Sometime when a message comes in and a notification plays the volume will jump up. I've tried to use the sound controls in settings to replicate this but it won't do it.
Co-incidentally, receiving messages while the radio is on also sometimes results in the tuned frequency to change :-S
Click to expand...
Click to collapse
This sounds like a software conflict seen this on the mini pro many times.
some apps or rom features change the volume when notifications come in... this screws with other settings put into place by other apps.
There should be "hopefully" a setting to disable this volume change in the rom.
Also please post in Q&A for future questions. Thanks

Bluetooth Car Stereo Volume Control Work Around

So I don't know if many or any other people are having or have had this problem(could be related specifically to my car, but unlikely as you'll see later), but I feel like I've heard others mention it. I've now had this issue on multiple roms, from saurom 7.1 GB to now PA cm10 2.0 with flapps OC kernel.
The problem:
When connected to the car stereo via Bluetooth, I'd lose volume control on the dash and only have its control on the phone.
Why does this suck?
Well having to do this to adjust volume can be very annoying for several reasons, like:
1. Having to grab the phone every time you want to adjust the volume
2. Slower volume increases and decreases
3. Depreciating the phone hardware faster
4. Scaling the volume in much bigger, less precise(sometimes it will be either too loud/soft) increments
5. Potentially much lower overall loudness (depending on where the car's own volume was at when it lost control)
6. Potentially more distortion (raising the phone's volume to max to compensate increases distortion regardless of where car volume is at).
What I soon began to realize is that it happens from certain apps, like Pandora (which is usually my go to), but not for the system standard music app like Apollo (which is why I don't think the problem source is related to my car).
So, the work around I figured out for myself is loading both, pausing Pandora, playing Apollo to get volume control, then holding down the back button to kill Apollo(make sure this is enabled in developer options in phone settings), then Pandora should start playing again all by itself and still have volume control. Haven't tested it yet on other music apps, but I suspect it should work the same.
Hope this helps if anyone else had this problem.
Sent from the Jelly Way Galaxy
Same Problem...
Afishl1 said:
So I don't know if many or any other people are having or have had this problem(could be related specifically to my car, but unlikely as you'll see later), but I feel like I've heard others mention it. I've now had this issue on multiple roms, from saurom 7.1 GB to now PA cm10 2.0 with flapps OC kernel.
The problem:
When connected to the car stereo via Bluetooth, I'd lose volume control on the dash and only have its control on the phone.
Why does this suck?
Well having to do this to adjust volume can be very annoying for several reasons, like:
1. Having to grab the phone every time you want to adjust the volume
2. Slower volume increases and decreases
3. Depreciating the phone hardware faster
4. Scaling the volume in much bigger, less precise(sometimes it will be either too loud/soft) increments
5. Potentially much lower overall loudness (depending on where the car's own volume was at when it lost control)
6. Potentially more distortion (raising the phone's volume to max to compensate increases distortion regardless of where car volume is at).
What I soon began to realize is that it happens from certain apps, like Pandora (which is usually my go to), but not for the system standard music app like Apollo (which is why I don't think the problem source is related to my car).
So, the work around I figured out for myself is loading both, pausing Pandora, playing Apollo to get volume control, then holding down the back button to kill Apollo(make sure this is enabled in developer options in phone settings), then Pandora should start playing again all by itself and still have volume control. Haven't tested it yet on other music apps, but I suspect it should work the same.
Hope this helps if anyone else had this problem.
Sent from the Jelly Way Galaxy
Click to expand...
Click to collapse
This is my first post so bare with me. I have been wanting to use cm10 but I have the same exact problem. In my 2012 scion xb I have bt audio and use spotify and tune in radio for everything. I was using the same method as you to control volume, but when i used synergy rom for my s3 I had the car controls (dash and steering wheel) back. Although I have to re-link the bt every time I Turn my car off.... didn't have to do that with my tbolt, it stayed lined even after i shut my car on and off. Still love my s3 better though lol

[Q] How many S3 users get low-level background hiss with audio playback?

I bought my Galaxy S3 (UK version) when they first came out, but recently had to have the motherboard replaced under warranty due to the phone suffering from Sudden Death.
Before the repair, the audio output via my earbud headset was perfect, but now I'm getting a persistent and annoying low-level background hiss. This is not affected in the slightest by the volume control - even at the lowest volume setting the hiss is still present at the same level. It lasts for about 4 seconds after audio playback has finished, and then stops with a slight click/pop as the audio circuit shuts down.
You can also hear it from the rear-panel speaker if you put it close to your ear and perform any action which causes a noise to be generated - e.g. keypress clicks or the notification tones when you press the volume rocker (just make sure volume is set low first though, as that speaker can be loud when you've got your ear up against it!)
I've done some checking and it's definitely hardware related - nandroid restoring my old ROM doesn't make any difference. It is really annoying when I'm listening to music at night in bed, usually at the lowest volume setting, as the hiss is much more noticeable without other ambient noises to drown it out.
There were a number of reports of similar issues last year but not everyone seemed to be affected, and the threads all seem to have dried up now. I'm wondering how many 'original' S3 users have this problem, versus more recent purchasers? I've added a poll, just to see how widespread this issue is - please treat any phone where the motherboard has been replaced for Sudden Death issues as a 'recent' phone.
And how do I go about getting it fixed if the current motherboards all seem to have the same fault? Is there any low-level firmware setting to reduce the physical gain of the internal audio amp circuit, as it does seem to be happening in the final stages of audio output rather than in the software-controlled stuff? I'm not worried about losing the top end of the volume range, I use bluetooth for more amplified playback anyway.
Andre
Background hiss / noise no and thats from one of the very first SGS3 .
But a fair number of the sound mods do add noise .
>>>is is not affected in the slightest by the volume control - even at the lowest volume setting the hiss is still present at the same level. It lasts for about 4 seconds after audio playback has finished, and then stops with a slight click/pop as the audio circuit shuts down.<<<<
That has been well posted up on XDA hiss + pop click on shutdown as you said long time ago .|Not seen any user posting really since those threads died . Most are just looking for more loud or more boom boom .
A number of kernels now have sound adaptations .
jje
Yeah, I first put it down to some sort of audio mod in the ROM that I had installed, so I nandroided back to the vanilla JB that was in the phone when I picked it back up from repair, and even back to my older ICS stock ROM (which had no audio mods at all) and they were all exactly the same.
Sound tweaks are all going to effect the source sound digitally, before it hits the analogue amp stage, and I suspect it's the final analogue stage which is generating the interference.
I don't care for lots of volume or boom boom (and anyway, I have amplifiers or car audio for that) but I do want my original lovely hissless audio quality back...
Andre
Do you still get the hissing with a good sound enhancing kernel (such as boeffla)? If you do, sounds like you have a hardware problem
Sent via TCP/IP
Ah, I didn't know some kernels were better than others for noise reduction. Although I'm not so interested in 'enhancing' per se, more reducing! But the problem I'm getting is not effected by the volume controls at all, the hiss remains constant whatever any of the level sliders are set to, just as long as the audio circuits are enabled.
The ROM I'm currently running is Omega AOKP v7.0, which is based on AOKP JB 4.2.2 milestone-1 and stock kernel. Is there a suitable kernel compatible with that which might help me does anyone know? (boeffla isn't as far as I can tell)
Andre
andrewilley said:
Before the repair, the audio output via my earbud headset was perfect, but now I'm getting a persistent and annoying low-level background hiss. This is not affected in the slightest by the volume control - even at the lowest volume setting the hiss is still present at the same level. It lasts for about 4 seconds after audio playback has finished, and then stops with a slight click/pop as the audio circuit shuts down.
You can also hear it from the rear-panel speaker if you put it close to your ear and perform any action which causes a noise to be generated - e.g. keypress clicks or the notification tones when you press the volume rocker (just make sure volume is set low first though, as that speaker can be loud when you've got your ear up against it!)
Click to expand...
Click to collapse
My SGS3 is about 9 months old, and I have this too. However, in my case the background hiss is at an extremely low level - to all practical intents it's inaudible. Certainly not enough to be annoying, even in the quietest of environments.

Categories

Resources