I have implemented my custom audio interface which is derived from AudioHardwareBase, and I have initialized it in AudioFlinger constructor class. This class will stream the audio through network.
This work fine when I play sound from a file, but not when make phone call.
The problem is due probably because the audio of phone call come from hardware unlike audio file (which come from software).
I'm willing to modify basic android library/driver in order to get this work.
Any idea how can I overcome this issue?
Thanks
Related
I've made an app in Android Studio which is essentially a parametric EQ with some additional features.
The app takes signal from the microphone source (whether the built-in mic or external mic). The signal is then passed through biquad filters and out to the speakers/earphones. I used LibPb to handle the signal processing.
Now, I want all the audio that would be coming out the speakers to be routed through the app.
In other words, any music playing or calls, I want the audio to also be passed through the filters in my app.
I have tried to find articles/resources on this topic but haven't found much.
I'm guessing that it can be done via Audio Focus or Media Router or something along those lines, but I cant figure it out!!
Firstly, is this possible?
Secondly, any code or hints as to how to go about it?
Any help is much appreciated!!
I am newbie in android developing, I have searched for this question but i didn't find my answer.
I want to know is there any ability to edit the sound calls in android?
I mean i want to add noise or change sounds of caller, Is it possible to change the sound in calls or adding a new sound to it?
TL DR : The answer is not yet.
And it's not like we've been waiting. The first entry i can find is from July 31 of 2009, the issue #3434 and, as of today (May 13 of 2015) it's still has not been assigned.
It's really hard to actually work on low-latency project, audio recording and of course, voices changers when you can't do low latency.
Not to say there's hasn't been any workarounds, you could emulate yourself the call, and add the voice effect sure (build your own dialer, and work with that), but let me warn you : you probably won't have any good perfs when it comes to real-time appliucations. No low-latency means no efficiency when it comes to audio recording.
You'll have to wait then.
Your question can be resolved partially depending your using model. the premises are :
you just want to eject some noise into your outgoing audio stream,
not into the incoming audio stream.
you may use a third-party VoIP application to make the phone call.
or simply say, you just want the peer to hear some modified voice. it is feasible.
Normal a native phone application on Android platform uses "Android audio system module" in the framework, the vendor provided audio libraries and Linux ALSA audio libraries to transmit/receive the audio data. These .so and .a files are under the read-only mode normally and could not be overwritten by user, so you can not inject data into this data chain.
But you have more capability to manipulate the data if you use a VoIP application to make the phone call, some VoIP applications can give a real phone number, like Fongo, you can receive a phone call to that number, the caller does not know you are using a VoIP application to speak.
So if I was assigned to do this project, here are my steps:
find a usable and open sourced VoIP client on Android.
find the code to sample the audio data from microphone ,add the code
to manipulate the raw PCM data and send the result to audio encoder.
build and run it on Android
register or apply a phone number for this VoIP client.
done.
Hope it help
Well, i want to call from my code and when the other persons answered my call send a audio clip in the audio streaming, i was ready is possible but also that isnt, help please.-
So, multiple questions in one. I'll answer all of them, mostly so you can get the keywords you can search for.
Setting up a call programatically, perfectly possible and quite easy
Playing an audio file into the call, not so trivial. Using the Java API for Android, you just can't do it. Anyhow, you can create a C application which can play an audio file, use it in your Android app (NKD and JNI required here), and give it control of the microphone.
If you are comfortable using C and think you can learn how to use NDK and JNI, you can do it. If you're gonna need it to be done using Java... right now you will just not be able to do it.
pd: if you are thinking about playing a file in the speaker and hope it to get into the microphone, it won't work on most of the devices out there. There are quite good echo cancellation chips out there.
I have searched, but can not find the answer I'm looking for.
I want to create a service and be able to call a function to play an audio file.
I have 5 different intents that will be using the service to play 5 different audio files (one each) and I have a stop button in each one. Whichever stop button is pressed I want it to stop all audio that has been called from the service.
Does any one have an example code which I can use? (Something close to what I'm looking for.)
I'm building a media player to understand how Android works, and I have a service that queues audio files to play them. You can get the full source code from github.
The service is in /src/com/augusto/mymediaplayer/services
I'm not using Intens, but binding the service to the Activities that use it, but changing it to receive intents shouldn't be that hard. Just in case, this service runs ok on Android 1.6+.
I think that to change it to receive intents, you'll need to change onStart() and do a switch on the intent.
I know that this doesn't answer your question 100% but it's a place to start :).
I'm looking for a way to control the default Android media player from my own service. I'm NOT interested in playing media from my service or activity; I want to control the existing application, which consists of an activity (MediaPlaybackActivity.java) and more importantly a service (MediaPlaybackService.java) located in packages/apps/Music/src/com/android/music/. Ideally, I would like a solution that is independent of the version of Android.
I have figured out how to do pause/play/stop/next/previous operations using Intents. I can intercept track change events using a broadcast receiver. I can also get a list of playlists and the contents of each playlist. What I would like to be able to do is instruct the MediaPlaybackService to play a specific file/song. Again, I don't want to play this song in my application; I want the Android default media player to play it.
I have tried two approaches so far:
I imported the IMediaPlaybackService.aidl file from packages/apps/Music/src/com/android/music into my own application, and used this to bind to the MediaPlaybackService. On Froyo, this works great; I can pass a path to the openFile method, and the service will play the file. However, on Gingerbread, I get an error: Permission Denial: Accessing service ComponentInfo{com.google.android.music/com.android.music.MediaPlaybackService} from
pid=17721, uid=10058 requires null. Finding a workaround to this error would be a good temporary solution, but it's not future-proof. This service may well change again in future versions of Android.
Starting the media player via an ACTION_VIEW Intent. This also works; however, as expected, the media player UI is brought to the front, which is not ideal.
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(someUri, "audio/mp3");
startActivity(intent);
Is there any other way to accomplish this? Is there an Intent I missed that would instruct the media player to play a specific song? Or alternatively, is there away to start an activity in the background, or to start an activity and immediately switch back to the previous one?
Sorry, there is no supported way to do this. All of the stuff you are describing is using private implementation details, and as you have seen is not robust. If you want to play music, you should do it in your own app.
I'm looking for a way to control the default Android media player from my own service.
There is no "default Android media player". The application you are referring to may exist on some devices and will not exist on others. AFAICT, few devices will have what you think is the "default Android media player" going forward -- those not already running proprietary media players from device manufacturers may have the new proprietary Google Music app.