2

Is there any way by which we can record audio in FLAC or WAV format using AudioRecorder of MediaRecorder in Android Studio. If not, is there any other way?

According to this link, these types of file formats are supported on Android Studio but I can't seem to find the appropriate output format and audio encoder.

https://developer.android.com/guide/topics/media/media-formats.html

  • https://github.com/midnightskinhead/audioboo-android/blob/master/src/fm/audioboo/application/BooRecorder.java old android proj. with integrated flac recorder and codecs - and integrated assets for legacy JNI/NDK builds using android.mk – Robert Rowntree Aug 24 '17 at 07:01
  • https://github.com/midnightskinhead/audioboo-android/blob/master/jni/flac/examples/cpp/encode/file/main.cpp#L60 FLAC encoder from same project . – Robert Rowntree Aug 24 '17 at 13:08
  • https://github.com/wariotx/flac-app/blob/master/jni/Android.mk same project makefile for the flac packages .. note the 2 cpp files at bottom because they would be important in the jni interface. Android API for media will decode FLAC. It would be the encoder , or jni/FLACStreamEncoder.cpp from the make , that you REALLY need to have. – Robert Rowntree Aug 24 '17 at 13:31

2 Answers2

2

Android's MediaFormat and MediaCodec supports FLAC natively: Supported media formats

This simple implementation does not even use JNI at all and does not implement additional dependencies:

There is no advantage in FLAC format if recording in lossy like 3GP, AAC, OGG, or OPUS.

Patryk Mis
  • 36
  • 4
-3

According to the link you gave us you can't record in FLAC with an android device, you can't record in WAV. What you can do is to record 3GPP (audio format for mobiles) and then convert it to WAV. Here is a nice piece of code for the conversion.