25

I would like to be able to play an audio recording over an open phone conversation. I.e., while the phone is connected (an outgoing call) a prerecorded audio file is played over the open phone connection. How can I do this?

2
  • I believe what you're looking for is a voice mail?
    – Lie Ryan
    Oct 10, 2011 at 2:33
  • 1
    @LieRyan Could be for putting someone on hold or something as well. Feb 9, 2012 at 18:08

5 Answers 5

5

No, the best that you would be able to accomplish is playing a sound through the speaker so the microphone can pick it up. There are no api's that can accomplish that.

1
  • There is no need to use any api, you can play the sound over phone's speaker so that microphone will pick it up. I guess I am just repeating the same answer but with emphasis that there is no need for any API here. Also see my answer below. Nov 3, 2018 at 20:24
3

@jim, Try using AudioTrack API in Stream mode. see below code snippet

            AudioTrack track = new AudioTrack(AudioManager.STREAM_VOICE_CALL, mySampleRate, 
            AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, 
            myBuffersize, AudioTrack.MODE_STREAM);

This should work

4
  • 1
    Android Enthusiasts is designed for end-user questions about the Android operating system. This may well be an answer for a programmer, but it is almost certainly not an answer for a user. Feb 10, 2012 at 14:46
  • 1
    Are there any apps that do this? If not, perhaps there's an opportunity here. Feb 10, 2012 at 17:43
  • 1
    @MatthewRead, are there any such apps now?
    – kagali-san
    Nov 17, 2013 at 1:10
  • I should comment that this is also not possible.. You simply end up with no audio playing or it only plays on the phone that has the application installed. Would suggest testing before posting.
    – Angry 84
    Feb 11, 2015 at 7:38
2

When i need to play something recorded over the phone, i usually turn on the phone speaker and press up the volume to max. Then people on the other end can hear it, but it works best on HD voice carriers (the audio sounds much better on the other end) :)

2

If you have a phone or secondary device that you can play the audio file on and both devices have auxillary ports, simply buy a cheap aux cable, cut it open, and plug both wires in the other way, so the phone thinks that the other device is a microphone. This works better that simply playing it through a speaker because there is much more clarity and no background noise.

0

As per my experience, you can play your recorded audio in a music player app. Though the app stops playing when phone is connected, for most music apps, if you restart playback, it continues to play.

If you want the audio to be played automatically, may be you can use voicemail.

1
  • I agree - auto play would be cool. Google are you listening or do we need a pull request? Jul 1 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .