Question

I am streaming audio data (music) to AudioTrack with track.write(..)

While doing this and making user listen to audio through device's speakers(etc..) can I also have that audio recorded by using Android's own audio system? (Android 4.0+) Is it capable of doing this?

Was it helpful?

Solution

If you're using AudioTrack.write(), thehn you must be writing from a byte stream. If you have the bytes, you can save them anywhere you'd like. Just write them to a file as well, and you'll have it recorded.

Now, it'll be in raw PCM format, mind you. If you want to convert it to WAV, MP3, OGG, etc, you'll have to do that yourself. There are different ways of doing that, but a search should turn something up.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top