Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  ReplayGain Implementation
« previous next »
  • Print
Pages: [1]

Author Topic: ReplayGain Implementation  (Read 4611 times)

Offline Carson Dyle

  • Member
  • *
  • Posts: 80
ReplayGain Implementation
« on: December 14, 2010, 08:34:52 PM »
Does Rockbox read and utilize ReplayGain peak fields, perhaps to avoid clipping?

REPLAYGAIN_TRACK_PEAK
REPLAYGAIN_ALBUM_PEAK

Or does it only use the gain values?

REPLAYGAIN_TRACK_GAIN
REPLAYGAIN_ALBUM_GAIN

What about reference loudness?

REPLAYGAIN_REFERENCE_LOUDNESS
Logged

Offline tpijag

  • Member
  • *
  • Posts: 65
Re: ReplayGain Implementation
« Reply #1 on: December 14, 2010, 09:08:37 PM »
Gain type and whether to protect from clipping is up to you - via the settings.
Regarding reference loudness, I assume that is adjusted via pre-amp settings.

For the sansa clip that I use it is all in the manual. http://download.rockbox.org/daily/manual/rockbox-sansaclip/rockbox-buildch7.html#x10-1220007.7
Logged

Offline Carson Dyle

  • Member
  • *
  • Posts: 80
Re: ReplayGain Implementation
« Reply #2 on: December 14, 2010, 09:41:00 PM »
Right, I'm aware of the available settings.  I was just wondering whether the other RG values are used in the implementation or if they were ignored.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: ReplayGain Implementation
« Reply #3 on: December 15, 2010, 12:05:20 AM »
Quote from: Carson Dyle on December 14, 2010, 09:41:00 PM
Right, I'm aware of the available settings.  I was just wondering whether the other RG values are used in the implementation or if they were ignored.

You can't prevent clipping without using the PEAK tag.  Literally whats done is that you take the peak tag and compare it to 1.  If its greater, you divide every sample in the song by that amount.  If you don't have that tag theres no way to avoid clipping (since you have no idea if the song is going to clip).
Logged

Offline Carson Dyle

  • Member
  • *
  • Posts: 80
Re: ReplayGain Implementation
« Reply #4 on: December 15, 2010, 12:22:03 AM »
Quote from: saratoga on December 15, 2010, 12:05:20 AM
You can't prevent clipping without using the PEAK tag.  Literally whats done is that you take the peak tag and compare it to 1.

Thanks. Are you talking about the raw value of the PEAK fields or some computed value?  The RG track and album PEAK values can't be greater than 1.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8974
Re: ReplayGain Implementation
« Reply #5 on: December 15, 2010, 12:36:57 AM »
Quote from: Carson Dyle on December 15, 2010, 12:22:03 AM
Are you talking about the raw value of the PEAK fields or some computed value?

The raw value.  The peak is exactly what it sounds like.  The amplitude of the largest sample relatively full scale (1.000000).  Hence its a little odd of you to ask if the peak information is used to determine the peak. 

Quote from: Carson Dyle on December 15, 2010, 12:22:03 AM
  The RG track and album PEAK values can't be greater than 1.

Looking at my player, something like 80% of the songs on my player have peaks > 1.  Pretty much any modern music will come out well over 1 if MP3 compressed because lossy compression is only approximate and need not have anywhere near the same amplitude as the input signal. 
Logged

Offline Carson Dyle

  • Member
  • *
  • Posts: 80
Re: ReplayGain Implementation
« Reply #6 on: December 15, 2010, 01:06:24 AM »
Quote from: saratoga on December 15, 2010, 12:36:57 AM
Looking at my player, something like 80% of the songs on my player have peaks > 1.  Pretty much any modern music will come out well over 1 if MP3 compressed because lossy compression is only approximate and need not have anywhere near the same amplitude as the input signal.

Interesting.  I know that 1.0 is the maximum possible value for Flac files, but I'm not sure I understand why being Mp3 encoded makes a difference, or why the peak amplitude would differ significantly.

What software do you use to do the RG analysis and tagging of the Mp3 files?

My Mp3 library is transcoded from my Flac library, to which I've run RG tags using metaflac.  I'll have to set up a test and compare the values computed on the Flac files to those computed on the transcoded Mp3 versions.
Logged

Offline Buschel

  • Developer
  • Member
  • *
  • Posts: 190
Re: ReplayGain Implementation
« Reply #7 on: December 15, 2010, 02:12:23 AM »
Following simple example from signal theory: Take a full scale (+/- 1.0) square wave signal and cut the upper frequencies. In effect you will see overshooting/ringing (so-called Gibbs-phenomenon) that has a higher amplitude than full scale.
Just think of a lossy encoder as a tool to remove signal parts and (often) higher frequencies. When decoding/synthesizing the signal again it may have higher peak scale as the original waveform -- the overall scaling keeps the same.
As most current productions use high amplitude combined with dynamic compression (to achieve high volume/loudness), such peaks >1.0 will appear quite regularly when using lossy codecs. Generally speaking each peak>1.0 will result in clipping during playback. To avoid clipping and to keep the overall scaling constant during playback replay gain can scale all samples with 1/peak, if peak is >1.0
Logged
iPod 5.5G 30GB, iPod nano 2G 8GB, 97% MPC and growing...
 

Offline Lear

  • Developer
  • Member
  • *
  • Posts: 533
Re: ReplayGain Implementation
« Reply #8 on: December 15, 2010, 03:48:25 AM »
Quote from: Carson Dyle on December 14, 2010, 09:41:00 PM
Right, I'm aware of the available settings.  I was just wondering whether the other RG values are used in the implementation or if they were ignored.

REPLAYGAIN_REFERENCE_LOUDNESS is ignored; the others are used. I hadn't heard about REPLAYGAIN_REFERENCE_LOUDNESS before, but according to this post (at Hydrogenaudio, by the author of the ReplayGain standard) it shouldn't be used.
Logged

Offline Chronon

  • Rockbox Expert
  • Member
  • *
  • Posts: 4379
Re: ReplayGain Implementation
« Reply #9 on: December 15, 2010, 10:20:39 AM »
Quote from: Buschel on December 15, 2010, 02:12:23 AM
Following simple example from signal theory: Take a full scale (+/- 1.0) square wave signal and cut the upper frequencies. In effect you will see overshooting/ringing (so-called Gibbs-phenomenon) that has a higher amplitude than full scale.
What a concise and clear example.  Thank you!  :)
Logged
Sansa e280, Gigabeat F40, Gigabeat S60, Sansa Clip+, iPod Mini 2g

Offline Carson Dyle

  • Member
  • *
  • Posts: 80
Re: ReplayGain Implementation
« Reply #10 on: December 18, 2010, 07:24:25 AM »
Do I understand correctly that Rockbox can only read ReplayGain metadata in Mp3 files from ID3v2 TXXX frames, or is it able to read the RG values that LAME writes to the LAME tag?
Logged

Offline Lear

  • Developer
  • Member
  • *
  • Posts: 533
Re: ReplayGain Implementation
« Reply #11 on: December 19, 2010, 04:41:18 AM »
ReplayGain in TXXX and RVA2 frames are supported, but not the values in the LAME tag.
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Audio Playback, Database and Playlists
| | |-+  ReplayGain Implementation
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.103 seconds with 14 queries.