Welcome Guest ( Log In | Register )

Replaygain at high sample rate, currently replaygain only works upto 48 khz
post Oct 5 2010, 14:22
Post #1

Group: Members
Posts: 3
Joined: 5-October 10
Member No.: 84356


I noticed that replaygain (as applied by metaflac) only works on tracks with a sample rate upto 48 khz.
I'd like to apply it to all my audio files and I do now have some with 88.2, 96, or 192 khz sample rate.
Looking into the code I see the following:
FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency)
    static const unsigned valid_sample_rates[] = {
    static const unsigned n_valid_sample_rates = sizeof(valid_sample_rates) / sizeof(valid_sample_rates[0]);

    unsigned i;

    for(i = 0; i < n_valid_sample_rates; i++)
        if(sample_frequency == valid_sample_rates[i])
            return true;
    return false;

In other words, a limit, but it looks as if I could just add other values. However, 96khz would go over the unsigned 16-bit integer limit, so changing to 32-bit integers might be necessary. Would this make anything run into trouble? I've yet to try, which I'll hopefully do later today.

Now the guesswork:
Have these rates been chosen as commonly used?
Is this check at all necessary? Isn't it enough for the sampling rate to be a positive integer?
Is this only in the flac implementation or is this part of the proposed replaygain specification?
Is the reason for the lack of higher sampling rates that at the time calculation for them would have been very slow (in this case it would be better to put up a warning instead)?
Is this because the replaygain reference values are based on psychoacoustics and those are lacking for frequencies we don't hear but which would be present in the higher sampling rate signals?
Go to the top of the page
+Quote Post
Start new topic
post Oct 5 2010, 18:51
Post #2

Group: Members
Posts: 1706
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383

unsigned means unsigned int, and unsigned int has been 32bits since the windows 95 era (even before, in some compilers). This won't be a problem to add higher sampling rates.

Next, the sample rates themselves: Those are the typical sample rates of audio

44.1Kz = CD , 22.05 = half CD, 11.025 = quarter CD (the value of CD has a relation with analog video, but that's for another topic)
48Khz = DAT, 24 = half DAT, 12 = quarter DAC.
32Khz = FM?, 16Khz half FM, 8Khz = analog telephone.

I haven't checked the replaygain algorithm of FLAC, but there's nothing in replaygain specific to sampling rates. What is obvious is that replaygain is a psychoacoustic algorithm, so an implementation may be implemented for specific sampling rates. One such cases can be the design of a lowpass filter.
Go to the top of the page
+Quote Post

Posts in this topic

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 16th April 2014 - 18:47