Jump to content

Replay Gain doesn't work correctly with OPUS media.


Kupper Ichiba

Recommended Posts

  • Poweramp build number: build-945-bundle-play [945004-3d535bbf] Full Version
  • your device model: LG G7 ThinQ (but affects other devices like Nexus Tablets)
  • your Android version: Android 13 (but affects other versions like android 10-12)
  • your custom ROM name/version: (if you're on custom ROM): All ROMs are affected, LG stock ROMs, LineageOS, SparkOS, PixelExperience, AOSP, Nexus, etc.
  • steps to reproduce: Just open Poweramp and play an OPUS file. Unless the rg preamp setting has been adjusted while playing an OPUS file, replay gain will not be applied to any OPUS file. Turning off Replay Gain will also trigger this behavior, as well as closing Poweramp by killing it or restarting the phone, or, strangely, requesting Poweramp to play a song with Google Assistant. Volume ducking or focus changes don't appear to trigger this. Seems as though the app may be ignoring replay gain and using the OPUS header gain until rg preamp is adjusted, then it starts to work again?
Link to comment
Share on other sites

Sent.

E: Also, despite having a pretty negative replay gain, they actually get louder when replay gain is turned on with 0.0 rg preamp gain (once I've twiddled the knob a bit to make it start working)???? I guess this might make sense if it's just switching between the OPUS and replay gain, but other players like foobar sum them instead which feels like a more logical result (and I guess what the spec specifies if I'm reading it correctly).

E:E: And just to be clear, the OPUS header and replay gains were set in Foobar2000 with it's included scanners, and work as they should in foobar and every other music player that supports them.

Link to comment
Share on other sites

Okay I gave 948 a shot and it seems to have the same problem. However I have also noticed something I didn't before, and may have pinpointed the problem. This only seems to happen when the RG Preamp gain is set higher than +11. If it's set to +11, then changing Replay Gain between Don't Apply, Apply, or Apply and prevent clipping all apply immediately and consistently. If it's even +11.1, then Replay Gain remains non-functional after activation until the level is reduced below +11. I think this is related to where you previously mentioned "modified opus replay gain handling so it adjusts RG by 5dB" forcing RG up over the maximum of at least the dial's +16, because I also don't seem to notice any amplitude difference between +11 and +16 even without clipping prevention.

I'm also still curious on your input on "If a player chooses to make use of the TRACK_GAIN, it MUST be applied in addition to the OpusHead output gain." because it's clearly not doing so, as I mentioned previously how turning on replay gain with 0.0 preamp and negative track gain actually gets louder than playing with just the header gain alone.

Link to comment
Share on other sites

@Kupper Ichiba I tested 948 with your file and 5dB applied (only track gain exists).

 set_slot_rg_volume rg_type=1 rg_source=1  type=2 album_gain=0.000000 track_gain=5.000000 album_peak=0.000000 track_peak=0.000000  rg_preamp_mb=0.000000 rg_default_mb=0.000000
 set_slot_rg_volume applied track gain=500.000000 as source=track
 set_slot_rg_volume DONE setting PA_TRACK_REPLAY_GAIN_MB=500.000000 ix=0

As this may also depend on settings, could you please make a screenshot of your Replay Gain settings or alternatively make a backup of settings and send via email? Thanks!
 

Link to comment
Share on other sites

Okay I just tried uninstalling and reinstalling 948 with no altered settings at all, just the way it comes right out of the box, not even activated to the full version, just to be sure it wasn't any of my settings. With that particular file, if you set RG preamp to > +11 and mess with the "Replay Gain" setting, you will see that it quickly becomes non-functional, staying at the same gain whether replay gain is turned on or off. < +11 works fine. The level this starts to happen at with other files seems to vary depending on some combination of track gain, OPUS header gain, and RG preamp that's more complex than just being a total of > 16 that I'm sick of trying to pick out by ear depending on the file, and quantify without any debug output.

For FLAC and MP3 files I've always just scanned for replay gain with Foobar, and then set Poweramp to Apply Gain + prevent clipping. With the rg preamp all the way up it fixed the issue of the scanner wanting to normalize everything to like -12db , without ending up clipping or needing a huge gain overlap elsewhere in the signal chain. I guess I can't do the same thing with OPUS anyways because it doesn't support a peak tag, but the scanner seems to take clipping into account for OPUS headers. I don't actively mess with the rg preamp setting, so I can just have the scanner put the gain I want in the OPUS header, and remove their track gains completely. That way all my old MP3s will get normalized by replay gain, and the OPUS files by the header gain. The way Poweramp handles OPUS + RG doesn't seem right regardless, but I guess it doesn't really matter if I can work around it. Otherwise, I still haven't found another Android player that I like as much, except for this issue, and it remains damn near the only Android app I have ever liked enough to pay for. Thanks for all the hard work.

Edited by Kupper Ichiba
Link to comment
Share on other sites

1 hour ago, Kupper Ichiba said:

With that particular file, if you set RG preamp to > +11 and mess with the "Replay Gain" setting, you will see that it quickly becomes non-functional, staying at the same gain whether replay gain is turned on or off. < +11 works fine.

It kind of defeats the purpose to have your files volume optimized with Replaygain information, but then to apply such a huge boost to the RG main level in Poweramp. Effectively, you could be experiencing the maximum levels close to or even into clipping, which is why you aren't hearing any perceivable differences. Try reducing the RG level in Poweramp to 0dB and then see if you can detect the differences you expect.

To adjust the overall volume level itself, use the main volume control, or perhaps even the preamp levels. But note that even there you will see a limit kick in if these levels exceed clipping.

Link to comment
Share on other sites

55 minutes ago, Shubham Studio DJ Remix said:

my mind is cliping and overloading to 999+ db and it has been blasted and my face got damaged give suggestions for making my mind optimal to 0.00-6.0db

This does tend to happen with all the dials set to 11. Sorry about your face.

Link to comment
Share on other sites

Maybe the main issue wasn't clear and to the point enough. Replay gain just stops doing anything at all. With an MP3 or a FLAC, it doesn't matter what I have the rg preamp dial set to, replay gain will instantly and consistently apply the appropriate level of gain to the output, whether it's nothing, the replay gain + preamp, or the replay gain + preamp + reduction to prevent clipping. With an OPUS file, if the rg preamp dial is set above some level and the app is restarted or Google Assistant requests a song (E: or you turn replay gain off and back on again), replay gain does not get applied at all and none of the modes do anything, it's always stuck as if it was turned off until the rg preamp is reduced below some particular level. Everything else I said kind of doesn't matter, as it shouldn't behave this way under any circumstance, regardless of if I'm "doing it wrong" or not.

Edited by Kupper Ichiba
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...