dkim0419 / SoundRecorder

A simple sound recording app implementing Material Design
GNU General Public License v3.0
1.49k stars 807 forks source link

add settings or not? #58

Closed fbnrst closed 7 years ago

fbnrst commented 7 years ago

Hey @dkim0419,

thanks for the current update of SoundRecorder. I highly appreciate this!

There's a number of open PR that request for new features (#35, #3, #57 ) that call for adding corresponding settings (which is even requested in #8). I'm wondering what the future direction of the app would be. Would you aim for adding settings or would you prefer that there is only one standard setting. In #37 you pointed out you would rather keep it single. If that's the case, wouldn't it make sense to document this plan, e.g. in the README.md and to close the related issues?

gaul commented 7 years ago

I would also like to include a settings panel or to increase the default sampling rate and encoding bitrate.

avipars commented 7 years ago

Also to change the file format.

github-user-1 commented 7 years ago

+1 for changing the sampling rate - depending on what I want to record it would be great to set it to e.g. 64 or 128 kbps as well (or a few other rates).

ChristophHaag commented 7 years ago

Not only does it record with 8000 Hz, the default is also to record with 12 kbit/s on my smartphone.

There isn't really a good FLOSS sound recorder I could find and this app looks pretty good except for small missing features like a quality setting, so I added one: https://github.com/ChristophHaag/SoundRecorder/commit/e7fed62cf14662025f3fe175964ae6fec483f998 In the spirit of the app there's only one simple check box for high quality (that sets it to 192kbit/s @44100Hz) instead of more intricate settings.

I also looked at the file formats and it's a bit more difficult there. The app uses android's MediaRecorder and that supports those OutputFormats:

        public static final int AAC_ADTS = 6;
        public static final int AMR_NB = 3;
        public static final int AMR_WB = 4;
        public static final int DEFAULT = 0;
        public static final int MPEG_4 = 2;
        /** @deprecated */
        @Deprecated
        public static final int RAW_AMR = 3;
        public static final int THREE_GPP = 1;
        public static final int WEBM = 9;

And these AudioEncoders:

        public static final int AAC = 3;
        public static final int AAC_ELD = 5;
        public static final int AMR_NB = 1;
        public static final int AMR_WB = 2;
        public static final int DEFAULT = 0;
        public static final int HE_AAC = 4;
        public static final int VORBIS = 6;

I tried the WEBM audio format with the VORBIS encoder but it fails to record with an IllegalStateException... It also doesn't like VORBIS in the MPEG-4 format (wikipedia says that is could be possible with some extensions of the mp4 format). MPEG-4 with AAC seems to be the only sensible option for now.

ChristophHaag commented 7 years ago

Made a pull request #69.

Here's an apk, signed with a new key I just generated: https://haagch.frickel.club/files/fdroid/repo/com.danielkim.soundrecorder.apk

dkim0419 commented 7 years ago

thanks for this! am merging it into the main branch.

dkim0419 commented 7 years ago

i've just pushed a new version with settings activity, refactored some of your code @ChristophHaag. should be easy to add new settings in the future as well, using preferences.xml, MySharedPreferences, and SettingsFragment :)

will push out a new release if it looks good to you guys

rbrito commented 7 years ago

Hi.

On Mon, May 22, 2017 at 7:20 AM, Christoph Haag notifications@github.com wrote:

Not only does it record with 8000 Hz, the default is also to record with 12 kbit/s on my smartphone.

Yes, that's what MediaInfo says when I feed the files that were recorded with SoundRecorder here too.

There isn't really a good FLOSS sound recorder I could find

The problem isn't the absence of such a recorder, but that people don't communicate very well this. I just discovered this problem after I spent a lot of time working on a fork of a program that I started using for my necessities:

I intend to simplify the program above, but its code is very, very old and many things in Android have changed, which means that I have to learn quite a lot of things before actually writing features.

Anyway, I intend to only use built-in android features that work with as many android versions as possible on the project that I forked above, but I just saw a nice project on F-Droid that is worth to be pointed out as a full-featured alternative with support for many formats and with a pleasant interface:

https://f-droid.org/repository/browse/?fdid=com.github.axet.audiorecorder

and this app looks pretty good except for small missing features like a quality setting, so I added one: ChristophHaag/SoundRecorder@e7fed62 In the spirit of the app there's only one simple check box for high quality (that sets it to 192kbit/s @44100hz) instead of more intricate settings.

For voice, that's really usually overkill (and be careful that some odd-ball devices may not support that sampling rate) but I spent some time looking to balance availability of codecs (and their compatibility with popular apps like WhatsApp and Telegram) with quality and containers and the requirements as a user and I decided that a slider from "very low quality/bitrate" to "very high quality/bitrate" would be nice to have.

In particular, I intend to use the following somehow in my project above (but would appreciate if it were implemented here in SoundRecorder as I am using this before using my own version of RehearsalAssistant):

int [] bitrates = {16, 20, 24, 32, 40, 48, 56, 64, 80, 96, 112,

128, 160, 192, 224, 256, 320};

That's for AAC, which is supported since Android's API 1. Yes, that list is quite probably overkill also. Those are, BTW, the bitrates that LAME (of which I participate upstream) uses for encoding MP3 frames. Changing the sample rate together with the bitrates is something that I am thinking of doing, since 44.1kHz at 16kbps sucks way too much.

From my experience and from what well established apps like WhatsApp and Telegram use for voice notes, 16kHz of sampling rate, mono at about 12kbps with Opus (only available in native Android with API 21 and later, but they use an external jni library to make it available to other versions) is the way to go: https://twitter.com/rtdbrito/status/826896358737063937

Given the not-so-state-of-the-art AAC-LC encoder that may be present in all Android versions (see, for instance, http://git.videolan.org/?p=ffmpeg.git;a=commit;h=e07e88cd82f78644ddcb10d7d3e0dd624fffe274) and the fact that that AAC-LC is not really well suited to very low bitrates (thus HE-AAC v1 and v2, only available with relatively "new" versions of Android, ruling out some of my own devices), to make things suitable for as many versions of Android as possible with only stock codecs, upping the bitrate a bit relative to Opus may be a good compromise (I tested some combinations with my own speech) and I will implement what I find to be usable.

I also looked at the file formats and it's a bit more difficult there. The app uses android's MediaRecorder and that supports those OutputFormats: (...) I tried the WEBM audio format with the VORBIS encoder but it fails to record with an IllegalStateException...

That's only supported in "new" versions of android...

It also doesn't like VORBIS in the MPEG-4 format (wikipedia says that is could be possible with some extensions of the mp4 format).

Vorbis in an MP4 is a really odd thing. :-)

MPEG-4 with AAC seems to be the only sensible option for now.

Make that the only "feasible" option for now... ;-)

But to reinforce with respect to SoundRecorer, a quality slider would be a great addition...

Regards,

Rogério.

-- Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA http://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito DebianQA: http://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

rbrito commented 7 years ago

Hi @dkim0419.

On Mon, May 22, 2017 at 4:41 PM, Daniel Kim (Yehun) notifications@github.com wrote:

i've just pushed a new version with settings activity, refactored some of your code @ChristophHaag. should be easy to add new settings in the future as well, using preferences.xml, MySharedPreferences, and SettingsFragment :)

Please, in the next commits, make the commits more fine-grained, with one commit for just one purpose. That makes following the code much easier, since only what is necessary is described in the commit message.

The git add -p option makes selecting the appropriate hunks very easy, even if you have multiple semantically different changes in place.

will push out a new release if it looks good to you guys

That would be great to have either on F-Droid or on the Play Store.

Thanks,

Rogério Brito.

-- Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA http://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito DebianQA: http://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

ChristophHaag commented 7 years ago

I looked for Opus, but not finding it was probably due to an old minSDK/targetSDK setting. Don't want to restrict the app to very new android versions... Maybe it wouldn't be the worst idea to use an external library for recording and encoding. Maybe https://github.com/lostromb/concentus?

I did try RehearsalAssistant and as far as I could see it doesn't have quality settings either and the UI is somewhat cumbersome with their "project management". If you can de-clutter it a bit, that's great too.

gaul commented 7 years ago

That would be great to have either on F-Droid or on the Play Store.

I submitted an F-Droid pull request for 1.3.0:

https://gitlab.com/fdroid/fdroiddata/merge_requests/2267

dkim0419 commented 7 years ago

thanks!