No clock keeps perfect time. The better the clock the closer it stays to real time.
Quartz clocks that are found most common consumer electronics vary in quality and all have some amount of error that is introduced due to imperfections, age, tolerances and temperature changes. The clock in a PC or sound card can be off by 2 to 9 seconds a day, while a quartz wristwatch is typically within 0.5 seconds a day.
Parts Per Million (PPM) explains by how much the crystal's frequency can deviate from the defined frequency. PPM is just like a percentage but instead of being one out of hundred it is one out of a million.
For example 20ppm would mean 20/1,000,000 = 0.002%. 0.002% of 1 is 0.000002. A sound card that outputs at 48kHz (48000 samples of audio every second) that is rated to 20ppm means that it will output anywhere between 48000 * 0.999998 = 47999.904 and 48000 *1.000002 = 48000.096 samples every second.
Another way to represent this is a 20ppm sound card can be off by 48000 * 20 / 1000000 = +- 0.96 samples per second.
For a given watch's rate, say 18000 bph, there are 18000 / 3600 = 5 beats per second. In other terms, tick tock tick tock tick take one second if the watch's rate was a perfect 0s/d.
Since with five beats per second, a single beat takes 1/5 = 0.2s so 0.2s between tick and tock.
With a sample rate of 48kHz a timegrapher software would expect a watch running at 18000bph with a rate of 0s/day to have 48000 * 0.2 = 9600 samples between every tick and every tock (or 48000 / 5).
If the input device was providing the timegrapher with 47999.904 samples per second due to clock error actual number of samples over 0.2s would be 47999.904 * 0.2 = 9,599.9808 samples which means that the software would read these number of samples instead of 9600 samples between a tick and a tock. So the software would then calculate the rate as (9,599.9808 - 9600 / 9600) * 86400 = -0.1728 s/d for a perfectly running watch.
Overcoming
Two ways, count the actual number of samples per second in software or make sure that the sample rate is really 48kHz.
Count the actual number of samples per second in software
This is a flexible approach that does not require any special hardware. There are two problems here: knowing exactly how long a second is and obtaining the actual sampling frequency takes a long time and needs to be constantly repeated.
Knowing exactly how long a second is, in software is tricky because a computer's internal clock suffers from the same problems as quartz clocks.A different reference is needed which is where NTP comes in. The Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems. Software like Meinberg NTP can be used to acurately set a computer's time by referencing multiple accurate time servers who's clocks can be based on accurate sources like atomic clocks and GPS signals.
Software could obtain the real average frequency of the input device by reading samples from the device over a long, accurate period of time (one hour or more) so that the calculation can obtain rates closer to real rates.
This spreadsheet contains actual sample rates of a few different sound cards over some short and long (1hr) captures and also gives the rate a timegrapher using these sound cards as input would calculate if it instead used a fixed 48000 sample rate, instead of the actual sample rate. https://docs.google.com/spreadsheets/d/10Mat28fhmoakWvrwON1r79d0zgn54yOvkP9EOGW8ko0/edit?gid=0#gid=0
The above data also proves that uncalibrated timegrapher software is not very useful unless long captures with high quality hardware is used.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.