waterzhang0423 / AMRAudioRecorder

Record amr audio on Android, support pause and resume.
MIT License
13 stars 5 forks source link

Library Still Maintained? #1

Closed rayliverified closed 7 years ago

rayliverified commented 7 years ago

Hi, I would like to upgrade this library but first I want to make sure that this library is still maintained to make sure any PRs I submit will be merged. Please let me know!

waterzhang0423 commented 7 years ago

Hi, any PRs would be welcome. You improved the example that how to manage permissions above Android 6.0, great job!

Record an amr file on Android is simple. I coded an app that supports recording audios, I found amr is small and with good quality. But Android does not support pause when recording amr, so I wrote this code snippet. Just a little trick, merge every single amr files and skip header bytes except the first, then we get a whole new amr file.

If you have any idea that can improve this lib, welcome send a PR. ^_^

rayliverified commented 7 years ago

:green_heart: :green_heart: :green_heart: Yay, thanks for the fast merge! I'm glad to have helped update this repo; your code is helping me so I wanted to contribute back! The Permissions Dialogue helper I added is one I coded from scratch and I use in my apps. Despite there being 5-6 permissions libraries with over 100 stars, NONE of them look good and handle ALL usage scenarios. I'll be publishing it as a library when I have some time ;)

AMR was designed for voice recording and it works great for that purpose. Since you are using the MediaRecorder library to record, there is no pause functionality when recording in AMR. I believe it is possible to pause when recording to MP3; where would I find that information? I am completely unfamiliar with audio recording and codecs...

The one thing I know is that people say MP3 is dead and AAC is the future BUT Android's media library does not support seeking AAC which means you must load the entire AAC file into memory and simulate seeking.

waterzhang0423 commented 7 years ago

I'm looking forward to your Permission Manager library. ^_^ That would be very useful, cause every app now should adapt dynamic permissions.

I'm also unfamiliar with audio codecs thing, but I think there are many libs can do this. It's hard to record AMR on iOS, if app needs run both on Android & iOS, AMR may be not the best way. MP3 seems like a good way. To record MP3, one way that I know is recording PCM, which supported on Android & iOS, then encode to MP3.

There are also two methods to "convert" PCM to MP3:

  1. Real-time way: get audio data from system microphone or other audio sources, then encode data to MP3 real-time.
  2. Encode after stop recording: just record PCM, then encode the whole PCM to MP3.

LAME is a nice library to do the encoding thing, it is a cross-platform lib. We can use it on Android and iOS, even on Windows, but need compile for each platform. But GitHub is an amazing place, we can find a specific platform based LAME lib which already compiled on GitHub.

TAndroidLame and AndroidMp3Recorder may be helpful. I used TAndroidLame in an app before. AndroidMp3Recorder does not provide a "pause" function at this moment, but I think maybe it's not that hard to add one.