Piasy / RxAndroidAudio

Maybe the most robust Android Audio encapsulation library, with partial Rx support.
http://blog.piasy.com/2016/02/24/Robust-Android-Audio-encapsulation/
MIT License
1.57k stars 235 forks source link

Poor quality in FileActivity #5

Closed BackPackerDz closed 8 years ago

BackPackerDz commented 8 years ago

Hi, thank you for this library but when I tested the demo, the sound quality is very poor in FileActivity compared to StreamActivity, it's normal ?

Piasy commented 8 years ago

Maybe it's due to the difference of audio record config, I'll give some investigation into it.

Piasy commented 8 years ago

@BackPackerDz Hi, after several test, I find out that if I use high sample rate and encoding bit rate when I use MediaRecorder to record the audio (FileActivity), the sound quality will be improved a lot, and it's nearly the same as the audio recorded using AudioRecord (StreamActivity).

Try the updated demo.

BackPackerDz commented 8 years ago

@Piasy I tested and it's AMAZING, now it's better than Stream Mode ! thank you !

qadirsuh commented 7 years ago

Code?

I have used this.

mAudioRecorder = AudioRecorder.getInstance();
mAudioFile = new File(
        Environment.getExternalStorageDirectory().getAbsolutePath() +
                File.separator + System.nanoTime() + ".file.m4a");
mAudioRecorder.prepareRecord(MediaRecorder.AudioSource.MIC,
        MediaRecorder.OutputFormat.MPEG_4, MediaRecorder.AudioEncoder.AAC,
        mAudioFile);
mAudioRecorder.startRecord();

audio quality is very poor.

What to change here in my code.

Piasy commented 7 years ago

use high sample rate and encoding bit rate

qadirsuh commented 7 years ago

@Piasy yes but how? I don't know how to do that

Piasy commented 7 years ago

Please RTFSC :)