Increase volume of speakerphone over the limit Android - android

I use this code to set the maximum volume of the speaker.
AudioManager audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),0);
audioManager.setSpeakerphoneOn(false);
I would increase more this volume, but how can i do? I tried to use this:
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,2,0);
But nothing, the volume remain set to the same level.
An app as this: https://play.google.com/store/apps/details?id=com.mxtech.videoplayer.ad, for example, allow you to increase the volume to the 300%.
Any help?
Thank you.

What this app probably does is increase the volume of the file it is playing like for example the vlc player does when you increase the volume beyond 100%. It has nothing to do with the volume you set to the phone, it just compensates for files which have a more quiet audio track.
EDIT:
Of the top of my head I don't know of an easy solution, I imagine it would be very difficult to write such a functionality yourself. That's why I suggest you look for a library such as this:
https://code.google.com/p/musicg/
Or you can look at open source projects which implement this functionality or at least something similar such as this:
https://code.google.com/p/ringdroid/
But I fear even if you use musicg or find some bits of code in ringdroid which help you it's probably still not going to be easy.

Related

How to adjust microphone volume in Android programmatically

Is there a way to increase/decrease the input volume of the Android microphone. I did some research on Google as well as StackOverflow but didn't find a suitable answer.
Here are some links:
How to adjust microphone volume in android?
Adjust Microphone Recording Volume
Is Android capable of managing microphone/input volume?.
Please provide any help/reference.
I had a certain problem where I had to increase the volume (gain) of the sound and also filter out some frequencies I used TarsosDSP library for android it has a particular class called GainProcessor where you can adjust the sound accordingly. Hope it helps.

Android, control the volume of a background sound

How can I control the volume of a background sound?
I'm making a game, and in some states I want to increase or decrease the background sound.
I have tried some things with MediaPlayer and SoundPool, but it did't do what I wanted.
I dont want to change the phone volume, but the volume of the sound. Is this possible? If yes how?
Cheers
You haven't told use what "some things with MediaPlayer and SoundPool" means, or shown us any code, so it's hard to say exactly what the problem might be.
If you want to make the volume keys modify the volume of your app's music rather than the voice call volume, you might be missing a call to setVolumeControlStream (e.g. setVolumeControlStream(AudioManager.STREAM_MUSIC);).
Refer to "Controlling Your App’s Volume and Playback" in the Android developer documentation for more information.
If you're using the MediaPlayer setVolume method, then keep in mind that the maximum volume you can set is 1.0 (i.e. the original volume of the audio data you're playing).

Is Android capable of managing microphone/input volume?

I've searched everywhere, including the RootTools source. I can't find anything that manages the microphone, apart from muting it altogether. And there are no hints inside the AudioRecorder.setMicrophoneMute(bool) method either...
There are a few posts about this issue, but none of them ever go anywhere (through no fault of OPs'). Is it (legally) possible to override the OS and get to the mic hardware directly or something?
Thanks,
-tre
You can't directly set the recording volume, but you can change what you do with the byte data you get from AudioRecord (look at the AudioTrack class for reducing the volume of the track)
Edit: I forgot to mention that if you're having trouble with volume spikes you can look at automatic gain control. Some devices activate it automatically, but you can manually enable it.
On occasion, I get a phone or tablet with poorly chosen microphone input volume. Android 4 had it adjustable but not the newer versions. It makes it impossible to use VOIP. It's not just for fancy audio recordings.

Change the pitch of the sound but not changing its playback speed unity3d

I am just developing a sample app in unity (as a beginner) so i am stuck at a point, i need to change the sound which is recorded (like in Talking Tom app).
i am done with recording the audio but when i increase the pitch of the sound the speed of the playback is also changed. i need the playback speed is normal only pitch must be changed.
so can anyone help me on this issue.
Thanks in advance
After a bit of researching, I found that what you're trying to do is called "pitch shifting". It involves a lot of math and mucking about with sound packets apparently because changing the pitch of a sound, automatically changes it's playback speed. Getting it back to the speed you want while still keeping the audio at something considered "normal" is no walk in the park.
In any case, since Unity3D uses C#, you might (and I stress the word might) be able to use this open source library to get the sound effect you need. It's based on NAudio (also open source, and C#) so you should theoretically be able to use it, or parts of it in your project.

Audio Playback Rate in Android

So, I know that this has been done with a few Android apps before, but I cannot for the life of me figure out how, since it's not currently possible through the API.
How does one adjust the playback rate of a sound played through MediaPlayer; either with or without adjusting the pitch is fine for now, though the latter is definitely preferred. If someone can point me in the direction of an open source app that I can use as guidance, that would also be fine.
Thanks in advance.
Looks like AudioTrack.setPlaybackRate should do the trick.
Setting it to half the sample rate of
the content will cause the playback to
last twice as long, but will also
result in a negative pitch shift.
Not sure if you can get a AudioTrack from MediaPlayer...
ExoPlayer from version 2.4 has support playback speed adjustment back to Android Jelly Bean (API level 16). I am using it in my app with another very useful feature - seamlessly loop audio.

Categories

Resources