Mechanical watch analysis on a Wav file
Forked from https://github.com/petergeelhoed/tico
Requires gnuplot and fftw3
$ sudo apt-get fftw3-dev gnuplot
# make the wav file, use 48000Hz please
a=122;rm -f out.wav; (ffmpeg -i Recorder/Voice\ $a.m4a out.wav) 2>/dev/null ;
# help
tico -h
# use -t to get only the top of the sound
-r cuts off the last 10 seconds
-l cuts off the first 20 seconds
-d narrow search round max
-c crosscorrelation threshold
-v prints the gnuplot statement
-s split tick tock pulseshape
-e applies a gaussian window of s=8
# generate a plot in lussen/www/tico.png and raw data
~/tico/tico/tico -l 4 -r 5 -s -e4 -d 50 < out.wav
teeth -e4 -c 0.8 -l 4 -r 4 < out.wav
https://www.watchuseek.com/threads/open-source-timing-software.2542874/page-30#post-56152420
gcc -o capture capture.c -lasound -Wall && ./capture default:1
https://www.watchuseek.com/threads/open-source-timing-software.2542874/post-56161873
./capture default:1 -t 3 -z 10 -x
https://www.watchuseek.com/threads/open-source-timing-software.2542874/post-57156704
It now gives you the live linear regression rate over the last 10 seconds, and it shows you how well the ticks correlate with the continually updated sound profile of a tick.
usage:
capture options:
-d <capture device> (default:1)
-z <zoom> (default: 10)
-b bph of the watch (default: 21600/h)
-r sampling rate (default: 48000Hz)
-t <measurment time> (default: 30s)
-v verbose, print points to stdout
time, tick position modulo(3600/rate), deviation, σ
-s cutoff standarddeviation (default: 3)
-x do not use crosscorrelation instead use peak derivative
-c 8 threshold for local rate
-e 4 Gauss smooth
-q split local tick/tock rate
# make all
make all
# or individually ...
# build tico
gcc tico.c -lm -o tico -lfftw3 -I /usr/local/fftw/include -L /usr/local/fftw/lib
# List audio devices:
pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2
# or (requires alsa-utils: sudo apt install alsa-utils)
arecord -L
# capture
./capture -dsysdefault
./capture -dpulse
# 18000 bpm watch
./capture -dsysdefault -b18000