[LAD] Library for accurate time stamping using a DLL

From: Olivier Guilyardi <ml@email-addr-hidden>
Date: Mon Jan 26 2009 - 23:22:35 EET

Hi everyone,

Fons, thanks to your essay "Using a DLL to filter time" [1], that you mentionned
in a discussion we had in August, I've put together a small library, named
Pendule, for accurate timing within a real time context. It's a tiny piece of
code, but offers a very easy to use replacement for gettimeofday().

Plus, it includes some benchmarking/measuring tools, that produce that sort of
fancy graphics (this one using a PCI hda intel card):
http://www.samalyse.com/code/pendule/shortgraph.png

Usage is very simple. first create an instance:
#include <pendule.h>
Pendule *pendule = pendule_new(buffer_size / sample_rate, bandwidth);

Then, in the realtime thread, update the loop every process cycle:
pendule_cycle(pendule);

And use pendule_gettime() instead of gettimeofday():
double current_time_in_seconds = pendule_gettime(pendule);

As expected, looking at the graph above, the obtained time doesn't drift as the
audio time, and has a lower jitter than the system time. Well, at least, it
works for me.

However, although my measures are pretty encouraging, I am not 100% sure of my
DLL implementation. Could you please review it ? It's there:
http://svn.samalyse.com/pendule/trunk/src/pendule.c

You can grab everything using svn:
svn co http://svn.samalyse.com/pendule/trunk pendule

I'd like to know how it works for others. You can easily test your
hardware/system and make graphs with:

./waf configure
./waf build
./measure
./graph

Check the README for more.

[1] http://www.kokkinizita.net/papers/usingdll.pdf

Best regards,

-- 
  Olivier
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Tue Jan 27 00:08:50 2009

This archive was generated by hypermail 2.1.8 : Tue Jan 27 2009 - 00:08:50 EET