Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReplayGain values are totally wrong #701

Closed
2 of 6 tasks
breversa opened this issue Dec 4, 2017 · 13 comments
Closed
2 of 6 tasks

ReplayGain values are totally wrong #701

breversa opened this issue Dec 4, 2017 · 13 comments

Comments

@breversa
Copy link

breversa commented Dec 4, 2017

  • Vanilla Music Version (Settings -> About): 1.0.57
  • Android Version: 6.0.1
  • Phone vendor / model: LG G5 H815
  • Application was downloaded from (use [x]):
    • Play Store
    • F-Droid
    • Other (Nightly Build)
  • Did this work in a previous version?
    • Yes
    • No
    • NA / Don't know.

Description

The dispalyed ReplayGain values are totally wrong, and vary according to the file type :

  • FLAC seems hard-set to +5dB (for both track and album gain)
  • Ogg Vorbis is either +5db OR 0dB OR correct (for album gain only)
  • MP3 is just wrong

Steps to reproduce the issue

  1. Calculate ReplayGain with your favorite tool (I've been using SoundKonverter, and recently moved to the ReplayGain Beets plugin).
  2. Check the calculated gain with your favorite tool (e.g. SoundKonverter).
  3. Play the files in Vanilla Music : the displayed ReplayGain values are totally different, and the sound volume is ajusted accordingly.

Screenshot

Expected result :
snapshot2

Current result :
FLAC file :
screenshot_20171130-223032

Ogg Vorbis files :
screenshot_20171130-223002
screenshot_20171130-223052
screenshot_20171130-223114
screenshot_20171130-223147

MP3 files :
screenshot_20171130-223101
screenshot_20171130-223459
...

Could it be a Vanilla Music internal library error, caused by multiple import/export of music ?

@adrian-bl
Copy link
Member

Please post the output of

metaflac --list $file

@breversa
Copy link
Author

breversa commented Dec 4, 2017

metaflac --list Nightwish\ -\ Once\ upon\ a\ troubadour.flac 
METADATA block #0
  type: 0 (STREAMINFO)
  is last: false
  length: 34
  minimum blocksize: 4096 samples
  maximum blocksize: 4096 samples
  minimum framesize: 14 bytes
  maximum framesize: 13048 bytes
  sample_rate: 44100 Hz
  channels: 2
  bits-per-sample: 16
  total samples: 14147280
  MD5 signature: c467f704381bce6b09e88fcfc23bef86
METADATA block #1
  type: 3 (SEEKTABLE)
  is last: false
  length: 594
  seek points: 33
    point 0: sample_number=0, stream_offset=0, frame_samples=4096
    point 1: sample_number=438272, stream_offset=826392, frame_samples=4096
    point 2: sample_number=880640, stream_offset=1894730, frame_samples=4096
    point 3: sample_number=1318912, stream_offset=2978275, frame_samples=4096
    point 4: sample_number=1761280, stream_offset=4107961, frame_samples=4096
    point 5: sample_number=2203648, stream_offset=5187969, frame_samples=4096
    point 6: sample_number=2641920, stream_offset=6279431, frame_samples=4096
    point 7: sample_number=3084288, stream_offset=7359356, frame_samples=4096
    point 8: sample_number=3526656, stream_offset=8507456, frame_samples=4096
    point 9: sample_number=3964928, stream_offset=9659629, frame_samples=4096
    point 10: sample_number=4407296, stream_offset=10828932, frame_samples=4096
    point 11: sample_number=4849664, stream_offset=11947251, frame_samples=4096
    point 12: sample_number=5287936, stream_offset=12998026, frame_samples=4096
    point 13: sample_number=5730304, stream_offset=14055193, frame_samples=4096
    point 14: sample_number=6172672, stream_offset=15126011, frame_samples=4096
    point 15: sample_number=6610944, stream_offset=16216807, frame_samples=4096
    point 16: sample_number=7053312, stream_offset=17389773, frame_samples=4096
    point 17: sample_number=7495680, stream_offset=18615479, frame_samples=4096
    point 18: sample_number=7933952, stream_offset=19790960, frame_samples=4096
    point 19: sample_number=8376320, stream_offset=20993178, frame_samples=4096
    point 20: sample_number=8818688, stream_offset=22201905, frame_samples=4096
    point 21: sample_number=9256960, stream_offset=23424333, frame_samples=4096
    point 22: sample_number=9699328, stream_offset=24638449, frame_samples=4096
    point 23: sample_number=10141696, stream_offset=25823164, frame_samples=4096
    point 24: sample_number=10579968, stream_offset=26892572, frame_samples=4096
    point 25: sample_number=11022336, stream_offset=27964292, frame_samples=4096
    point 26: sample_number=11464704, stream_offset=29099536, frame_samples=4096
    point 27: sample_number=11902976, stream_offset=30262274, frame_samples=4096
    point 28: sample_number=12345344, stream_offset=31485701, frame_samples=4096
    point 29: sample_number=12787712, stream_offset=32659635, frame_samples=4096
    point 30: sample_number=13225984, stream_offset=33775704, frame_samples=4096
    point 31: sample_number=13668352, stream_offset=34769535, frame_samples=4096
    point 32: sample_number=14110720, stream_offset=35207543, frame_samples=4096
METADATA block #2
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 4683
  vendor string: reference libFLAC 1.3.0 20130526
  comments: 64
    comment[0]: FMPS_PLAYCOUNT=0
    comment[1]: FMPS_RATING=0.6
    comment[2]: FMPS_RATING_AMAROK_SCORE=0
    comment[3]: REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB
    comment[4]: ACOUSTID_FINGERPRINT=AQADtJ3SaFII-_iR7EesMKJwXjiOKQ8-Hc-Efsh6JGcujImOH6VEmFWMb0e6U8eVyNAXpEU_4sTD4xd-HF2Q8DnSpsE__IE5Pugi5XiHy6kWtCfCPC-Si7iE70F5-CmFP-iNY85HhCT0BZyl48cPRVOI69AehOGO58P1YFc-VOXQ4-GjIesv6EjPYHxRHk3S40ItJfCJw0_QLjti0YW2o2ma4Pvx449EnMqJHxf65WikucMbqNeGpimuKUf6rOg_9GiqF1f8YCiY3MeJiE6KH9dyfFJyKOoueBL0HD6-pci0KCh5Yc-FUEfjSNAVJfhxHc-FKkv4wFWLXkeOKz4eRseTExV5NA8eHjmS-UET88Ofo8mD_uiToelx3NIR6ocWEj9eifhTNAp6TceTZ3gchQp-HD8aJ4uL6slITJYOLbrALaKQJzvMiCnew3kV7MqFD6EZNH9w9Xie4g6GBvXxBWymB-V0OMbW47OOw00ylMTxSiiPpgl-_PAz_PiFJ6jh8TiHE64Y2Dz6BfULEd3G4zra44QuOBOe4eTx6DjhL6iJi4YsHpWOz4ST9jgqXDd-fEPv4ggvHm-iIA914vsD7YPHlshzoy-e4Tz6HKVEHPGLa1mOn8Px4UYf_Mcj44cTShKD0NKBHk6OHjGT8Jga0RBxUketLBi74_kDHZFoGc2ZGceP6dkLc-3R7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ACVMUEMeAEEAYpYQxgBCACBCICKMUAM4gAwSQlBDDBGICAgMMQCIQIgBBwBFgFQACGUMAIAwAkRBxhgENGPAGMEIEQkAJY4AwRnCgBCBEAgMI0EwwYggixBFGARDGgiYIU8oRQYAQilFgJRCAOAocEUJRaJkCQVCoFBCEMeEEIEQYRQU4VDCEhDFAAAWAYUApYoAEjGmALAIYCASYIgoxCyhBhCijmBJEkEMEIGIZ4RxCAIJFjJCEGaEcAkAAA5RyAkHhBBTKEUKAJYIAAQ0wgillDGCKEcCJAooAJwADCTiAnXNQGCMYEA4AQxgTChBDCBGCISGUAEgBQY0HQDBpLAFMOCIAJkIxKQARzDGgCHBCKESIQAABToAAADgKABEEKISgAMwhwoghBhkgiICOAEcIUEBYApEwSBACmKMEAGGAMEQggIwAAAiGiCICMMWBEUIcwgAUggCAFIOAGGIEQ9gJRwgTShggkHIGCCIYAIooAwiSSIAhGRAAAAGMooYAAC4wykhDARDGggAIAAQSZAQCAjoBrGcCMQ
    comment[5]: ACOUSTID_ID=
    comment[6]: ALBUM=Angels fall first
    comment[7]: ALBUM ARTIST=Nightwish
    comment[8]: ALBUMARTIST=Nightwish
    comment[9]: ALBUMARTIST_CREDIT=
    comment[10]: ALBUMARTISTSORT=
    comment[11]: MUSICBRAINZ_ALBUMCOMMENT=
    comment[12]: MUSICBRAINZ_ALBUMSTATUS=
    comment[13]: MUSICBRAINZ_ALBUMTYPE=
    comment[14]: ARRANGER=
    comment[15]: ARTIST=Nightwish
    comment[16]: ARTIST_CREDIT=
    comment[17]: ARTISTSORT=
    comment[18]: ASIN=
    comment[19]: BPM=0
    comment[20]: CATALOGNUMBER=
    comment[21]: DESCRIPTION=
    comment[22]: COMMENT=
    comment[23]: COMPILATION=0
    comment[24]: COMPOSER=
    comment[25]: COMPOSERSORT=
    comment[26]: RELEASECOUNTRY=
    comment[27]: DATE=1999
    comment[28]: YEAR=1999
    comment[29]: DISC=1
    comment[30]: DISCNUMBER=1
    comment[31]: DISCSUBTITLE=
    comment[32]: DISCTOTAL=1
    comment[33]: DISCC=1
    comment[34]: TOTALDISCS=1
    comment[35]: ENCODEDBY=
    comment[36]: ENCODER=
    comment[37]: GENRE=Heavy Metal
    comment[38]: GROUPING=
    comment[39]: LABEL=
    comment[40]: PUBLISHER=
    comment[41]: LANGUAGE=
    comment[42]: LYRICIST=
    comment[43]: LYRICS=
    comment[44]: MUSICBRAINZ_ALBUMARTISTID=
    comment[45]: MUSICBRAINZ_ALBUMID=
    comment[46]: MUSICBRAINZ_ARTISTID=
    comment[47]: MUSICBRAINZ_RELEASEGROUPID=
    comment[48]: MUSICBRAINZ_TRACKID=
    comment[49]: MEDIA=
    comment[50]: ORIGINALDATE=0000
    comment[51]: R128_ALBUM_GAIN=0
    comment[52]: R128_TRACK_GAIN=0
    comment[53]: REPLAYGAIN_ALBUM_GAIN=-14.51 dB
    comment[54]: REPLAYGAIN_ALBUM_PEAK=1.000031
    comment[55]: REPLAYGAIN_TRACK_GAIN=-10.03 dB
    comment[56]: REPLAYGAIN_TRACK_PEAK=0.875668
    comment[57]: SCRIPT=
    comment[58]: TITLE=Once upon a troubadour
    comment[59]: TRACK=13
    comment[60]: TRACKNUMBER=13
    comment[61]: TRACKTOTAL=13
    comment[62]: TRACKC=13
    comment[63]: TOTALTRACKS=13
METADATA block #3
  type: 1 (PADDING)
  is last: true
  length: 3549

@adrian-bl
Copy link
Member

Hmm, that's interesting, haven't seen this yet. Maybe there is some odd splitting going on between ogg pages.

Could you send me this file to [email protected]?

@breversa
Copy link
Author

breversa commented Dec 4, 2017

Sure !
What file(s) do you want ? The FLAC, Ogg, or MP3 one(s) ?

@adrian-bl
Copy link
Member

The Ogg and the MP3 would be the most interesting (the flac file probably has the same issue as the ogg file)

@adrian-bl
Copy link
Member

Thanks for the sample files:

The values we read from the MP3 file seem to be correct: VLC reads exactly the same values.
image

For the ogg file: I also think that we are right there: Your file contains both REPLAYGAIN_*_GAIN and R128_*_GAIN tags:

image

Vanilla music prefers R128 tags (if available, which is the case with your sample files) and converts the R128-gain values into 'legacy' values (and a R128-gain value of 0 happens to be 5dB).

The related code is here:
https://github.com/vanilla-music/vanilla/blob/master/src/ch/blinkenlights/android/vanilla/BastpUtil.java#L83

tl;dr: SoundKonverter seems to write invalid R128 tags.

@breversa
Copy link
Author

breversa commented Dec 6, 2017

Thank you for your detailed reply.
Actually, I used Beets to calculate the ReplayGain, but I checked the values with SoundKonverter. I've yet to find a tool that has both bs1770gain AND tag-based album gain calculation support.

I guess I'll have to sanitize my tags to get rid of the R128 ones, as the newer bs1770gain tool apparently uses the standard "replaygain_*_gain" tags.

@adrian-bl
Copy link
Member

Interesting: did you use both bs1770gain and beets on these files or did beets write both tag types?

@breversa
Copy link
Author

breversa commented Dec 7, 2017

I'm new to Beets, but I used the Beets ReplayGain plugin to calculate the gain : http://docs.beets.io/en/v1.3.15/plugins/replaygain.html
Not sure if the R128 tags are Beets' or bs1770gain's work.

@adrian-bl
Copy link
Member

Thanks for the info.

I'm closing this as i think we are doing the right thing in such a situation.
We may revisit our R128-tags support if they go out of fashion (i haven't seen them used that often in the wild)

@breversa
Copy link
Author

I've tried to get rid of those R128 tags in Beets, but to no avail… so yeah, applying R128 tags only if ReplayGain ones don't exist may be a great idea in that case.

@breversa
Copy link
Author

breversa commented Dec 14, 2017

Follow-up :
It's a Beets bug, not bs1770gain : beetbox/beets#2757

@breversa
Copy link
Author

@adrian-bl :
This issue is being worked on, but I have no idea if or when it'll be solved.

In the mean time, would you consider adding an option to Vanilla Music to pick which tag should have precedence, between ReplayGain or R128 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants