you-apps / RecordYou

Privacy focused recorder app built with MD3
https://you-apps.net
GNU General Public License v3.0
750 stars 34 forks source link

Reconsider configuring audio recording and audio device parameters in order to allow high quality recordings #63

Closed pvagner closed 1 year ago

pvagner commented 1 year ago

Describe your suggested feature

Currently when sample rate is configured to auto default sample rate and default encoding bitrate is used for the actual recording. When disabling auto and entering sample rate value manually it may not fully respect that configuration.

On my device Xiaomi Redmi 9 with Android 12 AOSP it's working like this: When configuring recording format to opus, sample rate to auto, the resulting recording is samplet at 48 kHz with audio bitrate about 32 kbps. When configuring recording format to opus, sample rate to 44100, resulting recording is sampled at 48 kHz with audio bitrate about 280 kbps. The system encoder won't apparently accept any value for opus codec than the default. I have tried 44100 and 16000 so far. The bitrate 280 for 48 kHz recording is an overkill I think. The opus codec is tuned for low bitrates and I'd prefer 32 kbps or 40 kbps bitrate for casual recordings, up to 128 kbps for high quality recordings. When configuring recording format to AAC, sample rate to 16000, the resulting AAC file is sampled at 16000 Hz with audio bitrate 96 kbps thus it's not accepting very high bitrate of 16000 32 2 at all.

Most likelly the best way to move forward would be to add an ability to configure bitrate and number of audio channels too so we would be able to make stereo recordings. Now many devices do support stereo recording.

Consider using HE_AAC encoder as it supports higher quality recording than AAC.

Also for stereo recordings without applying the default compression and limiter processing it would be nice to configure recording source. This is device specific but I think at least these should be selectable: MediaRecorder.AudioSource.DEFAULT, MediaRecorder.AudioSource.MIC, MediaRecorder.AudioSource.CAMCORDER, MediaRecorder.AudioSource.UNPROCESSED,

Since API 29 there are some new microphone related settings. I haven't seen a device which I might be able to make some good use out of with but that might become important in the future as well.

Other details

I might be able to work on this however I'd like to know your opinion on this first.

Acknowledgements

Bnyro commented 1 year ago
  1. I think allowing users to choose the audio bitrate is a good idea, unfortunately I already started working on it before I saw that you're willing to work on it so the option is already present now.
  2. Allowing mono and stereo seems like a good idea to me, I think most other audio recorders have the same option too.
  3. HE_AAC didn't seem to work in my tests unfortunately, so that's why it's currently not being used.
  4. I agree, choosing different audio sources might be helpful in some scenarios, UNPROCESSED is very interesting for example and MIC can be used to use the device microphone while having wired headphones plugged in for example.

So all in all these seem to be good ideas, I've already added some strings for it accidentally and added 1., but I'd be happy if you wanted to finish the rest of it :)

pvagner commented 1 year ago

Okay, thank you for acknowledging. I will try in the upcoming days, most likelly on weekend.

Greetings

Peter