vanilla-music / vanilla

Vanilla Music Player for Android
GNU General Public License v3.0
1.15k stars 291 forks source link

ReplayGain is hit and miss #392

Closed thatHguy closed 7 years ago

thatHguy commented 8 years ago

My entire music library is ReplayGain tagged, but Vanilla Music seems to selectively apply the ReplayGain tags whenever it feels like it. Different albums will have varying volume levels from one another, even though they are all in Vorbis format (with only a few in MP3) and tagged correctly.

I know this is the case because when I move the slider for "adjustment for music without ReplayGain tags" it sometimes applies that adjustment even though it should not, and the ReplayGain global amplifier does not function for those specific albums.

adrian-bl commented 8 years ago

Is Vanilla even able to read the tags? We only support IDv2 and LAME style tags in MP3 files.

To verify this: Long-press on the track info in the 'now playing' screen: The panel will expand and you'll see the replay-gain values parsed by us.

thatHguy commented 8 years ago

I'm not sure what format my music is tagged in, but here's an example of a Vorbis file that should be tagged around -8dB.

screenshot_2016-07-08-14-39-09

adrian-bl commented 8 years ago

So the replay gain tags were not parsed.

What does

vorbiscomment $filename

show? What kind of software did you use to tag the file?

thatHguy commented 8 years ago

It was tagged with soundKonverter.

$ vorbiscomment 01.\ Invader.ogg
ALBUM=Near Dark
ALBUMARTIST=Dance With The Dead
ARTIST=Dance With The Dead
DATE=2014
DESCRIPTION=http://dancewiththedead.bandcamp.com/
GENRE=New Retro Wave
TITLE=Invader
TRACKNUMBER=1
REPLAYGAIN_TRACK_PEAK=1.15236998
REPLAYGAIN_TRACK_GAIN=-9.09 dB
REPLAYGAIN_ALBUM_PEAK=1.28213513
REPLAYGAIN_ALBUM_GAIN=-8.65 dB

I left out the "METADATA_BLOCK_PICTURE" tag in the above, as it just returned a big wall of characters.

adrian-bl commented 8 years ago

Ah, ok: if there is embedded artwork, we (well: the parsing library) might abort because it only parses a few KB of data, so this would explain why Vanilla Music doesn't know about the replay gain values.

I created a bug about this in the tag-reading library repo: https://github.com/adrian-bl/bastp/issues/1

thatHguy commented 8 years ago

I see, that makes sense. Album art files can vary from a few KB to a few MB.

Ofunniku commented 7 years ago

See, I've always wondered about this; in my tests, the only format that will consistently get RG values applied is MP3, I've yet to actually see replaygain values read properly in other formats, but they ARE there. (I copy them back to the PC to make sure they're there)

I've even tried making files with ONLY replaygain written to them (I've tried writing them with Winamp, Foobar2k, AIMP Tag editor, dbpoweramp) but only MP3 RG values are getting parsed... though it tends to pickup every other tag in the files and seems to handle large album art just as well no art at all.

hboetes commented 7 years ago

Here is the replaygain output of bs1770gain, which has the latest specs in replaygain calculations and supports multiple file formats. AFAICT VanillaMusic supports these tags, and if not I hope they do get implemented since I just rescanned my whole music collection with this tagger.

% bs1770gain -l *01*
Input #0, flac, from 'Ozzy Osbourne - Black Rain - 01 - Not Going Away.flac':
  Metadata:
    ALBUM           : Black Rain
    TITLE           : Not Going Away
    ARTIST          : Ozzy Osbourne
    GENRE           : Rock
    DATE            : 2007
    track           : 01
    REPLAYGAIN_ALGORITHM: ITU-R BS.1770
    REPLAYGAIN_REFERENCE_LOUDNESS: -23.00
    REPLAYGAIN_TRACK_GAIN: -16.54 LU
    REPLAYGAIN_ALBUM_GAIN: -16.21 LU
    ENCODER         : Lavf57.41.100
  Duration: 00:04:32.43, start: 0.000000, bitrate: 1025 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Side data:
      replaygain: track gain - -16.540001, track peak - unknown, album gain - -16.209999, album peak - unknown, 
% metaflac --export-tags-to=- *01*                                                           
ALBUM=Black Rain
TITLE=Not Going Away
ARTIST=Ozzy Osbourne
GENRE=Rock
DATE=2007
TRACKNUMBER=01
REPLAYGAIN_ALGORITHM=ITU-R BS.1770
REPLAYGAIN_REFERENCE_LOUDNESS=-23.00
REPLAYGAIN_TRACK_GAIN=-16.54 LU
REPLAYGAIN_ALBUM_GAIN=-16.21 LU
encoder=Lavf57.41.100
adrian-bl commented 7 years ago

I rewrote parts of the vorbiscomment parsing code (not yet in git). The new code is now able to read vorbiscomment data from multiple ogg-pages and would therefore be able to parse such replaygain data. However: It is not able to re-assemble data which spans multiple ogg pages. However: For our use-case, this shouldn't be an issue.

I'll try to clean-up the code in the next few days and push it to git.

I've yet to actually see replaygain values read properly in other formats, but they ARE there. (I copy them back to the PC to make sure they're there)

How did you tag the files? There are many applications doing 'funny' things, eg. writing ID3v2 tags to Ogg files which is something we do not support.

Here is the replaygain output of bs1770gain

We do not support BS1770 gain (never heard of it before ;-)) - only the 'classic' replay gain and R128 are supported. However: Adding support for BS1770 should be possible

adrian-bl commented 7 years ago

I pushed the updated metadata parser code to the git head and triggered a nightly build: The nightly build at http://neo01.eqmx.net/android/vanilla/ includes the new code and should therefore be able to parse the problematic ogg files.

@heminder @Ofunniku Can you confirm that the nightly build is able to pick up the replay gain values?

@hboetes I created a new bug (#452) for bs1770gain

adrian-bl commented 7 years ago

Closing this as the new parser seems to work well. bs1770gain will be handled in 452