Next Previous Contents

4. Accuracy - Extra information

Here some extra informaion concernig accuracy.

4.1 Theoretical Background

The accuracy of the frequancy measurement depends only! on the sample number. It is given approximately by

             frequency
   df[Hz]= --------------
            samplenumber

and

   frequency(real) = frequency(measured) +/- df

The ratio in frequency between two neighbouring halftones is given by 2 to the power of 1/12:

   frequency(C#)/frequency(C)=1.05946

which is approximately 6% increase in frequency per tune. The tune is normally measured in cent, which is 1/100 of a halftone step (which is therefore approx. 0.06% increase in frequency).

An accuracy of 10 cent (=0.6% of frequency, which is the very least for tuning instruments) is accomplished by:

       df                             1
   ----------- = 0.6% = 0.006 = --------------
    frequency                    samplenumber

so after all we get

                        10000
   samplenumber = ------------------
                    6*accuracy[cent]

or

                         10000
   accuracy[cent] = ----------------
                     6*samplenumber

4.2 Systematic error (bug)

The sampling frequency has to be known with an accuracy of about 1 cent (=0.06%). Otherwise the whole tuning of your instrument would be slightly too low or slightly too high, and you could only play for yourself at home.

The sampling frequency in a soundcard is set by setting a divisor of some built in clock. For example a SoundBlaster uses a 1193180 Hz Clock. If this frequency is divided by e.g. 108, we get a sampling frequency of 11047.96 Hz. The next frequency which can be reached (divisor 107) is 11151.21 Hz.

Ok, now the problem. The OSS-Free driver (Open Sound System) in the kernel has some ability to set the sampling frequency (but not the divisor). This makes sense, because different brands of soundcards have different clocks and so different divisors for a certain sampling frequency are necessary. OSS takes care of this internally, and doesn't bother the programmer with this. What OSS should do, is to return the actually set (exact) sampling frequency. Unfortunately, for my SoundBlaster 16, OSS-Free gives back exact the same frequency as preveousely set. So for a SoundBlaster and a sampling frequency of e.g. 11000 Hz this means a shift of 47.96 Hz = 0.44% = 7.3 cent, which is not neglectable. Maybe the commercial version of OSS doesn't have this problem.

I got to find out some more about all this. If you can help me with this problem please send me an email to florian.berger@jk.uni-linz.ac.at


Next Previous Contents