Superpowered SDK - monitor microphone input
I downloaded and tested CrossExample android app from Superpowered SDK and here is my question: How can I listen in real time to my phone microphone? I need some code examples ... My goal is to apply some filters to the audio input (microphone) and hear the result instantly.
Thank you so much!
Really quietly receive audio input. You just need to enable input in the SuperpoweredAndroidAudioIO constructor. To do this, set the third parameter to true as follows:
audioSystem = new SuperpoweredAndroidAudioIO(
samplerate, buffersize, true, true, audioProcessing, this, -1, SL_ANDROID_STREAM_MEDIA, buffersize * 2);
You now get the audio input supplied in the process
example method . This means that in
bool SuperpoweredExample::process(short int *output, unsigned int numberOfSamples)
the same buffer is used for input and output. The input is recorded in short int *output
, and you can capture the length from unsigned int numberOfSamples
. You might want to rename short int *output
to short int *inputoutput
for clarification.
Make sure you process the input before overwriting it with output. If you want to apply any effects, just do it in the I / O buffer in the process method.
Also make sure you have permission RECORD_AUDIO
in AndroidManifest.xml
:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
CrossExample will simply demonstrate mixing two predefined audio clips (from the project source folder) using different effects. The team hasn't posted an example yet that will demonstrate the functionality you're looking for. This is not trivial (but rather difficult), so I recommend that you understand a few of the existing examples deeper until they post more codes / tutorials, so you can work around these issues later.