Wednesday, April 11, 2012

[Android x86] Streaming audio PCM from Server Android x86 to Android Mobile phone using Socket

So far, i have eventually completed streaming audio on Android x86. The principles look easy and simple: Android x86 records the audio PCM and then dispatches the recorded buffers to the client through Socket(for the easiest way), the client receives the files and plays them by using AudioTrack. However, the difficulty comes from the fully unsupported Android x86 like normal Android, such as AudioRecord. This new system does not provide the way to record audio while playing music. Luckily, i found one blog that showed hacking Android x86 to save buffer of audio mixer (From BY: XZPETER - 20TH, 2011). Following those steps, i finally built the new kernel with the modified AudioFlinger module. The buffer is alternately saved to file (path "/data/") within 500 output files. Due to the continuous of audio, we create such many files instead of only few output files. Then, build kernel into ISO file.

Now, i have the audio PCM files which i want to dispatch to client(android phone). Alternately, i wrote the server app for android x-86 and the client app for android phone by using Socket as the network communication.