v17 replaygain doesn't seem to be working
#16
(2017-02-08, 01:34)Hallucyn8 Wrote: Here's my log, just a couple of tracks played to show that it appears to be picking up the correct ReplayGain

I will do some reading up on ReplayGain to improve my understanding and may do some testing with rescanning my files using different software and/or removing the peak tag to see what effect it has. If I find anything that might be useful I will report back otherwise hopefully we can get to the bottom of the sudden change in the new version of Kodi.

Anything more I can provide to help with any investigation let me know.

Maybe do some A/B listening tests with one set of files having RPG tags, and another set the same files but with the volume modified using the same RPG values. Test with Kodi RPG on and off.

scott s.
.
Reply
#17
(2017-02-08, 14:32)tkgafs Wrote: Taking this slightly off topic does anyone know of a free program for batch adding replaygain tags to tracks on a windows platform

You might look at MediaMonkey 4.1 if on windows. I think free version allows you to analyze volume and set RPG as a tag or modify the mp3 stream. You have to create "library" (SQLite db) of your files, but that's fairly fast. Then you can filter the db to select whatever collection of tracks to analyze. (Or you can set a program option to auto-analyze all tracks on adding to the library).

scott s.
.
Reply
#18
(2017-02-09, 00:33)scott967 Wrote:
(2017-02-08, 01:34)Hallucyn8 Wrote: Here's my log, just a couple of tracks played to show that it appears to be picking up the correct ReplayGain

I will do some reading up on ReplayGain to improve my understanding and may do some testing with rescanning my files using different software and/or removing the peak tag to see what effect it has. If I find anything that might be useful I will report back otherwise hopefully we can get to the bottom of the sudden change in the new version of Kodi.

Anything more I can provide to help with any investigation let me know.

Maybe do some A/B listening tests with one set of files having RPG tags, and another set the same files but with the volume modified using the same RPG values. Test with Kodi RPG on and off.

scott s.
.

Ok, I've done some A/B listening tests as suggested and I think my results bear out the fact that ReplayGain settings in the tags are not being applied on playback.

I took the same two tracks from previous test, i.e. the same song but from two different releases, one mastered at a significantly lower level than the other.

One set of tracks I left as they were with the original ReplayGain tags and the second set I applied the ReplayGain settings to the tracks.

With ReplayGain set to album levels in Kodi with the tagged tracks the noticeable difference in volume is still there.
With ReplayGain set to album levels in Kodi the tracks with the ReplayGain settings applied playback at the same volume

I then repeated the above tests with the RepayGain set to off in Kodi and basically got the same results, the tagged tracks played back at a noticeably different volume to each other and the tracks with the ReplayGain settings applied played back at the same volume.

Just to mention, and it may not be significant, but these are FLAC files as most of my collection is in this format.

Really hope that this can be investigated and fixed as although I generally like this new version of Kodi I am seriously considering going back to the previous version. I pretty much solely use Kodi for music playback and this is a bit of a game changer for me unfortunately.
Reply
#19
The PR that changed how the player applied gain in v17 is 10924 (PR)

It fixed the initial issue raised by this thread (gain was ingored unless peak was tagged too), but also changed how clipping was applied. This is player stuff, my only contribution was removing the "avoid clipping" setting that had become redundant.

Discussion refered to this article https://en.wikipedia.org/wiki/Loudness_war, and from that Fernet concluded that "our code for considering clipping is very wrong". He said "ActiveAE has clipping protection when stream amplification is applied. So we should apply replayGain as replayGain if m_peak equals 1.0 and as volume amplification for the other cases. The old setting “avoidClipping” seems useless should imo go away."

I do not know enough to see if this change has produced what you are experiencing, I simply offer up the information that I have.

Edit: but if you can give me access to some test files I will trace through debug and see if I can understand more.
Reply
#20
I can provide the test files that I have been using but I had a look at the PR that you linked to and the actual coding changes that were made. Now I don't pretend to know exactly what the code is doing but I've done a bit of programming in my time and can follow the logic to a certain extent. Having looked through the code, the amendments to xbmc/cores/paplayer/PAPlayer.cpp stuck out to me, in particular the following lines:

Code:
+  if (peak == 1.0)
+    si->m_stream->SetReplayGain(gain);
+  else
+    si->m_stream->SetAmplification(gain);

I read this as if the peak value (in the tags) equals 1.0 then ReplayGain will be applied, if it's not equal to 1 then ReplayGain will not be applied (I'll be honest I'm not really sure what the SetAmplification function does but whatever it is it doesn't appear to honour the ReplayGain settings).

To test my theory I took my two test files, one of which already had the album_peak at 1.000000 and the other which had an album_peak of 0.996613. For the second file I manually edited the album_peak and changed it to 1.000000 so now both files have the album_peak of 1.000000 but with the genuine album_gain settings.

I imported these into my library and verified that "Volume adjustments" was set to "Use album levels". I created a playlist with these two files and the files from my previous test where the ReplayGain settings had been applied to the file and all 4 tracks played back at the same volume.

So in summary, my findings are that if the album_peak is equal to 1.0 you will get the playback normalised as per the ReplayGain tags if not I think you just get the standard amplification (preamp level) as set in the volume adjustments settings.

Hopefully that all makes sense and may be helpful.

As always anything I can do to assist further let me know.
Reply
#21
Yes the code is doing what FernetMenta intended it too (and I am not in a position to argue with that). The audio engine in v17 has clipping protection when stream amplification is applied, hence if album_peak is not 1.0, the gain is applied as a volume amplification. But it seems that you don't hear that effect, and I guess we could ask why.

It seems that we are pretty much where we started with this thread: in order for ReplayGain tags to have a effect that you can hear you also need to set a peak tag of 1.0. I have no idea if that is reasonable or not.
Reply
#22
Just to be clear I'm also not arguing that the code is not doing what it was intended to Blush

The ReplayGain "standard" and how it's implemented is something, I will be honest, that I struggle to get my head round. In the previous version of Kodi it "just worked" as I thought it should and the changes in this version have highlighted something... I'm just not sure exactly what!! Smile

Ultimately if the implementation in this version is how it should be and a peak tag of 1.0 is required then I guess it's a case of updating all the tracks in my music library with that tag for it to work, although my test with just two tracks is statistically insignificant albeit consistent with what we seem to have uncovered between us on this thread.

(2017-02-11, 17:45)DaveBlake Wrote: But it seems that you don't hear that effect, and I guess we could ask why.

Is this something that you can ask of the relevant people or do I need to be raising this elsewhere?

At this point just wanted to say thank you for the responses and input so far, it's greatly appreciated Smile
Reply
#23
(2017-02-11, 18:01)Hallucyn8 Wrote:
(2017-02-11, 17:45)DaveBlake Wrote: But it seems that you don't hear that effect, and I guess we could ask why.
Is this something that you can ask of the relevant people or do I need to be raising this elsewhere?
Here in music is fine for an audio question, but Fernet is not always looking at the forum so I will raise it internally. But the player guys are very busy at the moment, so we may need to pick the best moment. It also helps to be exact with the facts. But I don't really know what replay gain is meant to sound like in relation to settings, although I do get the idea of making mixed playlists playback more in a more even way.
Reply
#24
(2017-02-11, 17:45)DaveBlake Wrote: It seems that we are pretty much where we started with this thread: in order for ReplayGain tags to have a effect that you can hear you also need to set a peak tag of 1.0. I have no idea if that is reasonable or not.

At the risk of bumping this thread unnecessarily I just wanted to make a further comment based on some more testing that I have been doing. My conclusions are that for the ReplayGain settings to apply correctly the songs either need to be tagged with a peak of 1.0 or have no peak tag at all (as the code will assume a peak of 1.0 if there is no tag for this).

This may have been what you meant anyway but just wanted to clarify as it may help in any future fix.

For reference in order to work around this issue at the moment I have taken a backup of the existing album peak tags on all my tracks by copying the value to an unused tag and then removed the existing album peak tag completely. All playback tests since updating my library now playback, to my ear, correctly and at a consistent volume. Should the issue be fixed I can copy the tags back to their original location to put things back how they were. I did this using some custom actions in MP3Tag from my Windows laptop if anyone is interested.

One additional thing that I think may be worth mentioning, and is something I've picked up on while trying to educate myself more on the science behind ReplayGain, is that if Kodi now has a built in way of stopping clipping (as I think was mentioned elsewhere on the thread) then I think the peak tag is irrelevant as from what I've read it's only use is to alter the gain if applying the ReplayGain settings would cause a track to clip. If Kodi is handling clipping outside of this calculation then presumably it doesn't need to worry about whether the tag is or isn't there or indeed what it's value might be.
Reply
#25
Good work on the investigation Hallucyn8.

My understanding of replaygain is the peak value is all about clipping, whereas the gain value is all about normalising audio to a common level. Judging by your suggest the removal of the clipping test has also removed the gain change.Regardless of what the logs tell me, I can hear the audible difference when there is a vast replaygain gain difference.
Reply
#26
Just a quick bump with some minor insights.

I don't understand why the code doesn't use replaygain when peak is less than 1. I mean if the entire point was to use kodi's clipping code, well a peak of less than 1 shouldn't clip anyway.

If SetAmplification(gain) is a function that merely adjusts the output stream by "gain", leaving the clipping detection to the audio engine, then clearly it isn't working correctly, or it's getting "gain" from somewhere that isn't the replaygain gain tags in the files.

Removing or adjusting peak tags to 1 is not a good idea. Other players do make use of these values for their clipping prevention.

Couldn't both implementations of gain adjustment be included in the options with a toggle in expert mode? I mean the main purpose of replaygain isn't to prevent clipping, it's to get all tracks to a reference volume.
Reply
#27
(2017-02-06, 20:03)DaveBlake Wrote: My very vague understanding is that how the player handles gain adjustments has changed. Hence no need for the clipping setting, but the levels should be working.
I'm not sure about "...no need for the clipping setting..."

My tracks are replaying as if "prevent clipping according to peak" is applied by default in v17. The effect is albums sold containing deliberately destructive clipping in their tracks now sound far too attenuated, which means I'm back to manually adjusting the volume again.

While having source modes of "off," "use track levels," and "use album levels," don't we also need processing choices of "none," "apply gain," "apply gain and prevent clipping according to peak," and "prevent clipping according to peak?"
Reply
#28
(2017-03-14, 15:43)John R Leddy Wrote:
(2017-02-06, 20:03)DaveBlake Wrote: My very vague understanding is that how the player handles gain adjustments has changed. Hence no need for the clipping setting, but the levels should be working.
I'm not sure about "...no need for the clipping setting..."

My tracks are replaying as if "prevent clipping according to peak" is applied by default in v17. The effect is albums sold containing deliberately destructive clipping in their tracks now sound far too attenuated, which means I'm back to manually adjusting the volume again.

While having source modes of "off," "use track levels," and "use album levels," don't we also need processing choices of "none," "apply gain," "apply gain and prevent clipping according to peak," and "prevent clipping according to peak?"

I concur
Reply
#29
As far as I know, replay gain never seems to work in kodi 17 and does not seem to work in kodi 18

Yes, you will see the replay gain value in the log but it's as far as it seems to go. It seems like kodi read the gain and peak value but never apply them

I tag all my flac in a way that allow all songs to be played at the same volume if replay gain is applied correctly

Guess what: never works in kodi! (works in foobar and even in groove app from windows)

Have to change volume each time a song start to be sure that my neighbours do not come to knock at my door (or simply use another player for music)
Moanbag is in da place!
Reply
#30
(2017-03-15, 14:39)Gracus Wrote: As far as I know, replay gain never seems to work in kodi 17 and does not seem to work in kodi 18.
That's a shame, and sounds a bit disappointing for a music player application. In my opinion, Kodi could only be enhanced by accommodating properly executed ReplayGain processing options.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
replaygain doesn't seem to be working00