[Android] Save records to file

Hello,

I am using OpenSL ES for my android app and implemented it already.
I need to record from the microphone what should not be a problem. Then some effect as pitch, rate and reverb should be added to the record.
Instead of playing the record I want to save it on the phone to play it later.

Is this possible? If yes how?

Thanks for your help.

This is possible to some degree. It does depend on which effects the particular device support. Rate and pitch are only available during playback, not recording. Reverb is applied using an output mix in the recording chain. Devices are not required to support an output mix object

I suggest you start by taking a look at the Recording Audio use case in section 4.6.4 of the OpenSL ES 1.0.1 specification, and the sample code in section B.1.2. You will need to add an output mix object in the chain between the recorder and the audio sink to apply the reverb effect.

The problem you run into is that rate is hard to manage when processing input from a microphone. The player and recorder objects process the data at the same speed the microphone inputs it. The rate effect is usually applied by changing the speed at which the data is read from the source.

It will be much easier for you to first record the audio as it comes in from the microphone, and then apply all of the effects during playback.