Leonidius20 / RecordingStudio

Audio recorder app for Android
GNU General Public License v3.0
35 stars 2 forks source link

Add sample rate and bit rate settings at least for opus codec #3

Open pvagner opened 1 week ago

pvagner commented 1 week ago

The default opus encoder setup on Android is not taylored for storing recorded data. It's more suitable for low bandwidth. It's configured in narrow band with the default sample rate of 8000 Hz. In order to record an appropriate sounding opus recordings it should be possible to configure sample rate and bit rate. I am suggesting setting it to atleast 48000 Hz and 32 kbps as the default. Please have a look into the Opus FAQ to see which sampling rates are supported. I think the encoder as shipped on Android already does the resampling we just need an ability to configure the sampling rate correctly. Additionally opus files as recorded with this app are not yet playable when switching to the recordings tab.

Here is an output of running opusinfo on an opus recording recorded on my phone to illustrate what I am reffering to.

Processing file "2024-09-08-19-13-14.oga"...

New logical stream (#1, serial: 643c9869): type opus
WARNING: Implausibly low preskip in Opus stream (1)
Encoded with libopus
WARNING: EOS not set on stream 1 (normal for live streams)
Opus stream 1:
    Pre-skip: 52
    Playback gain: 0 dB
    Channels: 1
    Original sample rate: 8000 Hz
    Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
    Page duration:     20.0ms (max),   20.0ms (avg),   20.0ms (min)
    Total data length: 20475 bytes (overhead: 51.4%)
    Playback length: 0m:07.438s
    Average bitrate: 22.02 kbit/s, w/o overhead: 10.71 kbit/s
Leonidius20 commented 1 week ago

Thank you for the feedback. I am planning to add sample rate and bit rate settings for all codecs in a future version. Can't predict when it will be released though, hopefully sooner than later