WatchUSeek Watch Forums banner
  • Take part in a short activity and share your valuable opinion on new design concepts for AVSForum! >>> Click Here

Open source timing software.

280319 Views 604 Replies 139 Participants Last post by  tpiepho

Hi guys,

I have a more or less usable version of my timing program that is ready
for initial testing, if anyone is interested.

First the goodies. Here are Windows binaries
http://ciovil.li/tg.zip
and here is the full source code
https://github.com/vacaboja/tg

Now some info on the program. This program is released under the GNU GPL
license, version 2 -- basically you can do what you want with it, free of
charge, no warranty, if you redistribute a (modified) version, you must
distribute also the source code. If you want to build from source, you
need gtk+ (I'm using v. 2.24), portaudio2, and fftw3, plus a C99 compiler
clearly. If you want to run the Windows version, just download the zip
archive, unzip, double click.

This program tries to pick up audio from the default audio input of your
computer, which should be the same that Audacity defaults to, so you can
test the audio setup with Audacity. It does not fiddle with the volume:
just check that it is set to a reasonable level. Of course the rate that
you get from this program, for any watch, is affected by the rate of the
clock of your sound card: the same holds for all timing programs and there
is no escape (except calibrating the card against a reliable time source).

The algorithm I decided to use is quite hungry of computing power, so I
made two versions: "tg" is the full version, "tg-lt" is a lighter version.
The light version sacrifices some accuracy and noise resilience for speed.

My intended audience is amateurs and tinkerers. This program has not been
written for professionals, neither do I want to compete with
professionally built hardware or software, nor with those that can write
better software on their own. In particular I have set to myself the
following three goals.

One. Try a less conventional algorithm to deal with bad audio, at the
expense of lots of number crunching (all other programs for which I did
find information online use possibly some band pass filter and a threshold
trigger, we do it differently). I can currently obtain satisfactory
results from the internal mic of my ThinkPad and a few other lower quality
mics. I don't know how it will perform with a good piezo, but I am
interested (probably, for clean audio, mine is not the best approach).
Your mileage may vary.

Two. To avoid complaints like this one
Review: TickoPrint Android App | Watch Guy
the entire operation of the algorithm is designed to be double-checkable.
In particular, the waveforms that the program associates to the tics and
tocs of the watch are shown in real time, so one can check that they are
properly recognized and properly aligned. The slope representing the
currently detected instantaneous rate is drawn (the blue lines) on the
timing-machine-like graph, etc. See also the discussion here for some
example of such double checking
https://www.watchuseek.com/f6/definition-beat-error-2394130.html

Three. Make it open source, so other people can tinker with the source
code (well, this one was the easy part).

Usage should be quite intuitive for those that know how an escapement
works. See also the thread referenced above for more info.

That's all for now. Any feedback is appreciated.
See less See more
  • Like
Reactions: 5
581 - 600 of 605 Posts
Is it possible to have the last windows build? Can someone upload that somewhere? Thanks!
So for people running linux without a gui:
How about a live terminal timegrapher?
Font Technology Space Screenshot Darkness


No amplifiers just pu the watch on the headphone mice and plug it in to your raspberry pi!

Peripheral Output device Body jewelry Gadget Audio equipment
See less See more
2
  • Like
Reactions: 1
You need to a get a stack of fan-fold paper and a dot matrix printer and output it to that.
  • Haha
Reactions: 2
You need to a get a stack of fan-fold paper and a dot matrix printer and output it to that.
;)

Professionally I develop software that uses the terminology "CARDS".

It is older than I am, and still cutting edge. Not using cardboard any more though.

This little program got a bit more complex since posting, It has crosscorrelation matching and error suppression.

I think I will add the live rate as well, now you only get it at the end of the program
Terrestrial plant Font Event Darkness Screenshot
See less See more
building this in that piece of **** 'homebrew' for mac is quite interesting.
24 hours and counting on my old ivybridge mac.
this 'build everything from code' was a nifty novelty when introduced in gentoo linux but got out of hand pretty quick it seems :)

but the icing on the cake is reading that 'you are stupid and running an unsupported version of macos so do not dare to report when things break just fix it yourself as we can't be bothered to help you (which indeed I had to, for a couple of stupid packages)' attitude. priceless.

all ranting aside... how hard would it be to build this in something decent like 'macports'... or would there be so many missing pieces (like gnome crap?). apparently I need to compile not one but TWO compilers (gcc and rust) just to have a timegrapher :D
I don't use Mac but on my 8 year old HP laptop running Linux, it took about 5 seconds to build, assuming having the necessary libs installed prior.
I don't use Mac but on my 8 year old HP laptop running Linux, it took about 5 seconds to build, assuming having the necessary libs installed prior.
exactly! it has been a while but I remember when I installed this on linux it was a .deb file.. 5 second job and good to go!

this 'homebrew' thing looks like something that is run by druken millenials, geez. if that's the only option I am grateful for it but that thing is annoying AF :D

oh and by the way TG is now up and running on this old, unsuported, retarded mac (which incidentally I consider the best macbook ever built, the glorious pre-retina 2012). 10 years under its belt and still runs like a champ despite the drunken millenials :)
I added a binary build for Fedora on COPR, tpiepho/tg-timer Copr
But I don't use Windows and hardly use MacOS. If someone who uses those systems and knows how to make installable packages wanted to provide them, I'm sure others would appreciate it.
I added a binary build for Fedora on COPR, tpiepho/tg-timer Copr
But I don't use Windows and hardly use MacOS. If someone who uses those systems and knows how to make installable packages wanted to provide them, I'm sure others would appreciate it.
An actual mac os package would be great, some of us aren't crafty enough with the terminal. This being said additional issue on mac as of today is to provide a package for M chip sigh... Tried to install home-brew, apparently I encounter an illegal variable name. There it stops lol Maybe someone more knowledgeable and skilled will succeed.
Cheers
Anyways, if you're with a Mac, easiest way IMO is a Linux VM, .deb file
To install from source is pretty straightforward on a mac - using intel (x86) hardware. I can't speak to M silicon, but it should be the same. I'm on Ventura.
Git way:
Assuming you have git, fftw installed find a place to install tg-timer. I have a folder for git stuff. go to your folder and ...
Code:
git clone https://github.com/xyzzy42/tg.git
cd tg
./autogen.sh
./configure
make
./tg-timer
you can also download the zip file from github, unzip to a folder, then open the folder in your terminal and start from ./autogen.sh
I hope that helps.
See less See more
Ok, so I have a questions or two about tg-timer and it's a bit meandering, so forgive me :)
I have a problem with TG. The beat error and amplitude seem to jump all over the place. I'm using one of these guys as my microphone
might not be the exact thing, but close enough. It's the USB-C version, not the version with analog out (annoyingly)

I thought this might be the issue, so I listened to the output directly, and A) it's super loud, B) there's a 1khz (ish) tone that breaks in intermittently, like microphone feedback.

So, my questions are... Is this mic just fubared? Can I trust the results of TG with this noise? Does the high output of the piezo mic mess up TG?
A feature request for TG would also be: can we add a noise gate if that's an issue? Seems like an FIR noise gate is possible, but beyond my capabilities. http://www.jatit.org/volumes/Vol100No15/6Vol100No15.pdf

Ok, now to get a little more meandering ...
Here's a couple screenshots of TG
Light Rectangle Slope Plot Font
Light Product Rectangle Slope Plot

These two screenshots were taken within a couple seconds of each other, you can see how much the beat error and amplitude jump around.
What could cause that? Is that my mic being too loud or that weird 1khz noise?
Follow up, so I understand what TG is doing ...
How is it calculating the amplitude and beat error? I'm assuming these waveforms
Font Line Rectangle Pattern Parallel

Show the"tic" and the "toc" of the escapement.
What is the blue line showing? How is it setting what's at 0 and what's at the blue line?
this software is really cool, but it would really help me better use it if I understood what it was doing.

Thanks!
jrubins
See less See more
3
might not be the exact thing, but close enough. It's the USB-C version, not the version with analog out (annoyingly)

I thought this might be the issue, so I listened to the output directly, and A) it's super loud, B) there's a 1khz (ish) tone that breaks in intermittently, like microphone feedback.
From what I've seen, the usb audio implementation in these is not the best. The circuit is noisy and the PCB unreliable. And it doesn't use USB audio async mode. The analog output is better, assuming one has good enough computer sound.

So, my questions are... Is this mic just fubared? Can I trust the results of TG with this noise? Does the high output of the piezo mic mess up TG?
A feature request for TG would also be: can we add a noise gate if that's an issue? Seems like an FIR noise gate is possible, but beyond my capabilities.
Yes, high output and noise are bad. But you can filter noise. Check the latest branch for the feature. I describe it here, showing how to remove a background noise caused by the circuitry in one of these microphones. I have also added a feature to check signal levels.
I read that paper, thought maybe there would be something interesting. They implemented an 8-tap low-pass FIR filter in VHDL. That's like an undergraduate intro to signal processing lab. The signal processing already done is well beyond that.

These two screenshots were taken within a couple seconds of each other, you can see how much the beat error and amplitude jump around.
What could cause that? Is that my mic being too loud or that weird 1khz noise?
Those are very odd looking waveforms. Yes, it could be the background noise. Loud noises at a constant frequency are bad. But are easy to filter. The waveform lacks a clear unlock, impulse, lock and this makes amplitude detection hard. The post I linked to above describes now just filtering out noise, but also how to identify and amplify the portions of the tick sound that most clearly show the operation of the escapement for better amplitude measurement.

How is it calculating the amplitude and beat error? I'm assuming these waveforms
View attachment 17341701
Show the"tic" and the "toc" of the escapement.
What is the blue line showing? How is it setting what's at 0 and what's at the blue line?
There are sections from timegrapher manuals that often get posted here. They explain how to use a timegrapher, how amplitude is calculated, what beat error is, and so on.

The blue line is the estimated position of the unlock. "0" is the estimated position of the lock. The scale on the bottom shows how much time is between them in milliseconds, while the scale on the top shows this in degrees of amplitude. The higher the amplitude the faster the balance is moving as it passes through pallet fork. The faster it moves the less time it takes to get from the unlock to the lock. Which is the lift angle, sort of. The escape tooth hits the pallet stone about the same time the fork hits the banking pin. So this is why the top scale gets larger as the beat gets shorter. You'll see adjusting the lift-angle will also adjust the scale.
See less See more
To install from source is pretty straightforward on a mac - using intel (x86) hardware. I can't speak to M silicon, but it should be the same. I'm on Ventura.
Git way:
Assuming you have git, fftw installed find a place to install tg-timer. I have a folder for git stuff. go to your folder and ...
Code:
git clone https://github.com/xyzzy42/tg.git
cd tg
./autogen.sh
./configure
make
./tg-timer
you can also download the zip file from github, unzip to a folder, then open the folder in your terminal and start from ./autogen.sh
I hope that helps.
Should this run on M silicon? I'll try... Thanks!
Should this run on M silicon? I'll try... Thanks!
I don't have an M machine to test on, but I don't see why it wouldn't.
Do you have Git installed? That's step 1.
I think you can get it with xcode select
Code:
xcode-select --install
try it and see. Brew is the easy way to install things, but it looks like brew was failing for you. You might need Xcode first. I'll be honest, I don't know diddly about the m1 silicon, and most of this crap has been on my work machine since I got it, so i don't remember the install procedures !:rolleyes:
I don't have an M machine to test on, but I don't see why it wouldn't.
Do you have Git installed? That's step 1.
I think you can get it with xcode select
Code:
xcode-select --install
try it and see. Brew is the easy way to install things, but it looks like brew was failing for you. You might need Xcode first. I'll be honest, I don't know diddly about the m1 silicon, and most of this crap has been on my work machine since I got it, so i don't remember the install procedures !:rolleyes:
I have this prompt: ERROR: Unable to locate GNU Autoconf.
any idea?
This is absolutely not my trade lol obviously you don't have to follow up, I don't want to eat up your time :)

UPDATE
@jrubins big up and thank you! It's alive! After a bit more research on how to install brew, I opened a new terminal window and changed the default shell to zsh (sigh) and it finally went through 👍
UPDATE
@jrubins big up and thank you! It's alive! After a bit more research on how to install brew, I opened a new terminal window and changed the default shell to zsh (sigh) and it finally went through 👍
[/QUOTE]
Hurray! I'm glad I could help. Not an expert here by any means, which I will now demonstrate with my next post ...
  • Like
Reactions: 1
Yes, high output and noise are bad. But you can filter noise. Check the latest branch for the feature. I describe it here, showing how to remove a background noise caused by the circuitry in one of these microphones. I have also added a feature to check signal levels.
Which branch? You mention a couple in that post, and I tried json-dump and color-coded-tics. I didn't see any new features in the interface after switching branches and recompiling (which i may have messed up. I'm not a huge git user). The filters and spectrogram look badass, exactly what I'm looking for!
I read that paper, thought maybe there would be something interesting. They implemented an 8-tap low-pass FIR filter in VHDL. That's like an undergraduate intro to signal processing lab. The signal processing already done is well beyond that.
Oh yeah, super basic, that's the point. A simple FIR noise gate could be a solution for removing low level noise. From what I've seen from the original TG, the noise rejection was all on the high side, not the low level side. I'm excited to try out your version (didn't know you had features beyond input selection and HP filter built in, so that's pretty sweet!).
Those are very odd looking waveforms. Yes, it could be the background noise. Loud noises at a constant frequency are bad. But are easy to filter. The waveform lacks a clear unlock, impulse, lock and this makes amplitude detection hard. The post I linked to above describes now just filtering out noise, but also how to identify and amplify the portions of the tick sound that most clearly show the operation of the escapement for better amplitude measurement.
Yes, that looks like a handy guide. I will refer back to it once I get the best version installed and running.
There are sections from timegrapher manuals that often get posted here. They explain how to use a timegrapher, how amplitude is calculated, what beat error is, and so on.

The blue line is the estimated position of the unlock. "0" is the estimated position of the lock. The scale on the bottom shows how much time is between them in milliseconds, while the scale on the top shows this in degrees of amplitude. The higher the amplitude the faster the balance is moving as it passes through pallet fork. The faster it moves the less time it takes to get from the unlock to the lock. Which is the lift angle, sort of. The escape tooth hits the pallet stone about the same time the fork hits the banking pin. So this is why the top scale gets larger as the beat gets shorter. You'll see adjusting the lift-angle will also adjust the scale.
I'm familiar with the basics of the timegrapher, not with the specifics of TG-timer. I guess what I'm looking to understand is how it decides where the lock and unlock are happening.
Once i get a grasp on the tg software, I can fiddle with the piezo mic hardware a bit. Failing that, I have other mics :) even a cheapo ($1) trrs phone headset is better right now (with a few modifications). I just want to use my new toy properly, y'know!
Same watch with a dollar store headset mic.
Product Rectangle Slope Font Screenshot


EDIT: PS i'm still just learning, so happy to look at any materials that are useful. I'll say my background in audio reproduction helps me understand the ins and outs of signal processing, but totally tip my hat to your expertise. 🤠
See less See more
UPDATE
@jrubins big up and thank you! It's alive! After a bit more research on how to install brew, I opened a new terminal window and changed the default shell to zsh (sigh) and it finally went through 👍
Hurray! I'm glad I could help. Not an expert here by any means, which I will now demonstrate with my next post ...
[/QUOTE]
I think you're good enough lol I can't seem to wrap my mind around getting to the updated version
EDIT
And all done! hahaha I owe you! learning stuff today! thanks :)
581 - 600 of 605 Posts
Top