Windows Timing Machine - Version 2.07 Introduction This program is designed to record and analyze a series of clock or watch ticks to calculate the beats-per-minute setting and indicate the in-beat percentage of the movement as an aid for adjustment. In addition, you can enter any one of the following: desired beat setting in beats-per-hour, beats-per-minute, beats-per-second or the desired pendulum length in feet, inches, centimeters or millimeters and the program will calculate all the other values for you automatically. After entering the desired value and taking a measurement, the program will calculate and display your movement's rate in beats-per-hour, beats-per-minute, beats-per-second, the beat duration in milliseconds, the seconds rate error-per-day, the required pendulum adjustment needed to bring it to time in both inches and millimeters, and lastly, the beat expressed as a percentage (50-50 being perfect) and the beat difference in milliseconds. System Requirements IBM compatible PC Mouse Windows, Windows for Workgroups, or Windows 95 Soundblaster compatible sound board with microphone Optional: movement or contact microphone such as the "Tick Tech Model 20 Pickup sensor" available from Timesavers, 7745 East Redfield Road, Suite #500, Scottsdale, AZ. (www.timesavers.com) external audio amp/speaker such as Radio Shack #277-1008, $11.99, or a beat amplifier such as Timesavers No. 15408, $33.00 (includes the clip on sensor) telephone pickup sensor such as Radio Shack 44-533, $3.99. watch pickup sensor as available from the Adams Brown Company, Box 357, Cranbury, NJ 08512. (www.AdamsBrown.com) Installation Windows or Windows for Workgroups: If you obtained the program on a floppy disk, simply insert the disk and from program manager, do the usual, "File", "Run", and type "a:setup" (or "b:setup" if you're using the B: drive) and follow the instructions on the screen. If you obtained the program via email or download, uncompress the self extracting archive into a temporary directory by typing its name (for example, wtm203.exe) and then install with "File", "Run", "c:\PATH\setup" (where PATH is the path to the temporary directory where you extracted the files) then follow the instructions on the screen. Windows 95: If you obtained the program on a floppy disk, simply insert the disk, press the "Start" button, then "Run" and type: "a:setup" (or "b:setup" if you're using the B: drive) and follow the instructions on the screen. If you obtained the program via email or download, uncompress the self extracting archive into a temporary directory by typing its name (for example, wtm203.exe) and then install with "File", "Run", "c:\PATH\setup" (where PATH is the path to the temporary directory where you extracted the files) then follow the instructions on the screen. Quick Start Tour Start the program by double clicking its icon. Select "File", "Open", "sample.wav" An example waveform will be displayed. Press "Eval" to calculate the beat settings. Press "Play" to listen to the recorded waveform. Click and drag the mouse to highlight a portion of the waveform and press "Zoom In" to examine the selected portion. Press "Record" and then "Stop" after a few seconds to record and analyze your own movement. Enter your desired beat or pendulum setting in any one of the white background text boxes and the program will calculate all the others when you press return. Command Buttons Record - Starts recording a new sample. Press "Stop" to end recording. Note, this will erase and record over any previously recorded, but not yet saved waveform file. If you wish to save a recording, use the "File", "Save" command to save it to your hard disk before recording over it. Play - Press this button to playback and listen to the recorded waveform (or highlighted portion). Stop - Use to stop recording or to stop a playback in progress. Eval - Evaluates the current waveform, (or highlighted portion) and calculates the beats-per-minute settings and beat percentage. You must record or highlight at least 3 beats to evaluate the sample. If there is excessive noise or other problems with the recorded waveform that interfere with the evaluation, the background color will change to red to warn you that the calculations are in error. Try re-recording or adjust the Tick Level and/or Skip Ahead parameters as described below. Zoom In - After clicking and dragging on the waveform display to highlight a desired area, press "Zoom In" to magnify the selected area. You may repeat this several times to take a closer look at individual ticks. Zoom Out - Zooms back out to display and select the entire recorded waveform. Print - Prints a text only hardcopy record of all the values on your printer. If you wish to make a hardcopy printout of the entire WTM screen including the waveform graphics, use the standard Windows clipboard cut and paste as follows: Take your sample recording and enter desired beat or pendulum length values as desired. Make sure the WTM screen is active by clicking the mouse anywhere on the WTM window. Press ALT-PRINT to copy the WTM screen to the clipboard. Start the Windows Paint program by double clicking its icon. In Paint, select "Edit", "Paste" to paste a copy of the clipboard's contents. Select "File", "Print" to print the image. (of course, your printer must already be installed and have graphics capability) Tick Level - Adjusts the threshold at which the program considers high enough to be a valid tick. The default value is 50. Use the slider bar to adjust the Tick Level as desired. Depending on the quality and level of your recording, you may have to adjust this slightly for accurate readings. You may return to the original default setting by pressing the "Reset" button. The Tick Level setting can be saved by pressing the "Save" button, but may be restored to the original default with the Reset button. See the Theory section for more details about setting the Tick Level adjustment. Skip Ahead - After a valid tick has been detected in the waveform, the program skips ahead through "Skip Ahead" samples before it starts checking for the next tick. This is done to speed up evaluation time and helps prevent extraneous sounds from interfering with the calculations by only looking for a tick in the expected window. The suggested value is the number of samples required for about 95 to 98% of the length of the beats you're measuring. The default value is about 2000 samples, which is intended for 300 bpm movements. With clean recordings for movements of 300 bpm or slower, it will not be necessary to adjust this. However, when sampling 5 seconds long beats for an anniversary clock, you may wish to set this up to about 60,000 to (significantly) speed up the evaluation time. Skip Ahead setting changes are saved by pressing the "Save" button, but may be restored to the original default with the "Reset" button. See the Theory section for more details about Skip Ahead adjustment. By double clicking on the label "Skip Ahead", the label will change to "Auto Skip Ahead" and the program will automatically adjust the Skip Ahead value appropriate for the "Desired" beat setting. To turn "Auto Skip Ahead" back off, double click the label again. Auto Skip Ahead automatically adjusts itself to the correct value based on your "Desired" settings. When using Auto Skip Ahead, it is important to enter the correct "Desired" beat setting. If you are unsure of the correct beat setting for your movement, start out with a beat setting well above what you expect (the 300 bpm default is a good value for most any movement) for your first recording, and then use the displayed "Measured" value to determine the correct desired value to enter. Calibration - This drop down text box used to select desired recording rate and to enter the Calibration rates for your sound card. Click the down arrow to drop down the recording rate values and select the desired rate. To enter your specific calibration value, highlight the existing value, typeover the new setting and press return. Press the "Save" button if you wish to save your new calibration settings. Reset - Restores the "Tick Level" and "Skip Ahead" settings to their original default values and turns off "Auto Skip Ahead" if it was on. Save - Saves "Tick Level", "Skip Ahead", desired Beats/Pendulum length values, and (in registered version) "Calibration" settings. This allows you to configure WTM to always startup with your own personal values. WTM Icon - Double clicking the WTM Icon (near the upper left portion of the display) enables a debug mode which logs detailed information on the ticks including their sample number, value, number of samples between ticks and their averaged values. Record your sample and evaluate as usual, then double click the icon again to toggle debug back mode off. The debug data is written to a text log file called debug.txt in your WTM directory and can be viewed with your favorite text editor. Debug mode can be helpful for determining your personal calibration values. When sampling 1 second beats, the overall average presented in the debug.txt file is your Calibration value and should be entered in the Calibration text box (registered version only) to calibrate the program for your sound card. Menu Commands File, Open - Use to select and load a wav file for display and analysis. File, Save - Use to save the currently displayed waveform to disk. The default filename for your own recordings is "newwave.wav", however you may specify your own file name. You must enter the full file name including the .wav extension. File, Record - Same as pressing the "Record" button described above. File, Play - Same as pressing the "Play" button described above. File, Stop - Same as pressing the "Stop" button described above. File, Eval - Same as pressing the "Eval Sample" button described above. File, Print Hardcopy - Same as pressing the "Print" button as described above. File, Exit - Ends the program. View, Zoom In - Same as pressing the "Zoom In" button described above. View, Zoom Out - Same as pressing the "Zoom out" button described above. Options, Calibrate - Used to toggle on or off the Calibration, Tick Level, Skip Ahead, etc. controls and textboxes at the top of the display. Some users may wish to turn this off when printing screen dumps for customers since this info is for the program and not really relevant to their movement. Default at startup is on. Options, Debug - Toggles debug log mode on or off. When debug logging is on, a check mark will be displayed to signify logging is active. Options, File Type - Displays information about the currently loaded wav file. Help, Quick Start - displays "Quick Start" instructions on how to get started using the program for the fist time. Help, View Docs - displays the "WTM.TXT" documentation file with the notepad or wordpad editor. Help, Info - Displays copyright information for the libraries used in this program. Help, Register - Displays registration information. Help, About - Displays program version and author information. Hints and tips for recording The quality of your readings depends on the quality of the recordings you make of your movement. Typical clock ticks are quite faint (and watches are even fainter), so it may be difficult to make a clear and loud enough recording with just a simple microphone. Some experimentation with your equipment will be needed to find the best settings that give you good recordings. Listen to the example waveforms included with the program to get an idea of what works well. Refer to your sound card documentation for information on how to adjust your recording volume level. Minimize any extraneous background noise in the room that may be recorded so it won't interfere with the tick detection routines. With some movements, you may get better results by holding or attaching the microphone directly to the movement or case. A contact microphone attaches directly to the movement with an alligator clip and rejects extraneous background noise much better than a regular microphone. The contact microphone is plugged into a small external speaker amp and your sound card's microphone is placed near the speaker amp to record the ticks. This has the advantage of being able to clearly hear the clock ticks and make adjustments for the best sound before making your recording, however you need to be careful about extraneous background sounds that might also be recorded and interfere with the program. Further improvement can be obtained by directly connecting the output of your external speaker amp to the sound board's "Aux" input with an appropriate adapter cable. This eliminates the problem of extraneous background noise, and the direct connection can give you much cleaner recordings. A pickup device designed specifically for watches is available from the Adams Brown Company, 26 N. Main Street, P.O. Box 357, Cranbury, New Jersey, 08512, phone (609) 655-8269, and is reported to be compatible with WTM. Theory of operation (Simplified explanation with apologies to technical types) Sound cards record sounds by periodically measuring and remembering the sound volume level at each particular instant. The microphone converts sound wave vibrations into a voltage that varies with the sound. On the sound card, this varying voltage is amplified and fed into an analog to digital converter (ADC). The ADC converts the analog voltage at discrete instants (samples) in time to a binary (digital) number that represents the voltage. A relatively loud sound sample might be represented as 120 while a softer sample would be a smaller number like 45. Silence would be 0. These sample numbers can be stored in memory or on your hard disk as a wav file. To playback sounds, the digital number sample values are fed to a digital to analog converter (DAC) on your sound card which reproduces an analog voltage proportional to the sample number value. By feeding these samples to the DAC at the same rate they were recorded, the original sound is reproduced. WTM displays the recorded waveform as a plot of the tick amplitude on the vertical axis vs. time on the horizontal axis. While the usual plot of audio waveforms shows the amplitude with both positive and negative values above and below zero, WTM displays all values as positive to conserve screen space. The sampling rate used in this program is approximately 11025, 22050, or 44100 times per second, depending on which recording rate you select. The exact rate depends on your sound card hardware and must be measured to calibrate the program for accurate results as discussed in the calibration section. Sample values range from 0 (silence) to 128 (maximum) and are stored in a single byte. Thus, a five second recording at 11025 Hz requires about 55 Kbytes (5 seconds * 11,000 bytes/sec = 55 Kbytes) to store all the samples. Higher recording rates will use proportionally more space. WTM allocates a maximum of about 12 MB which equates to a maximum recording length of about 20 minutes at 11025 Hz, 10 minutes at 22025 Hz or 5 minutes at 44100 Hz. The movement's timing rate is calculated by measuring the time intervals between ticks. Ticks are detected by checking each sample byte, starting from the beginning, looking for the first sample value that is greater than the "Tick Level" setting. Once the first tick is found and noted, the program skips over or jumps ahead "Skip Ahead" number of samples and then starts checking again, looking for the next tick. Once all the ticks are recognized, we can calculate the time between each tick by knowing how many samples occurred between them. For example, if we counted an average of 2,205 samples between each tick and we know the samples occur 11,025 times per second, then the time interval between each tick is 0.2 or 1/5th second. From this we can determine that this movement is beating 5 times per second or 300 beats per minute. By making changes to a clock's pendulum rating nut or the balance regulator adjustment on a watch, you can re-sample and evaluate until you have the movement properly regulated to time. We check how well in-beat the movement is by taking the average of the time intervals between every other beat (call `em ticks) and the "other" every others (call them tocks) and calculate the ratio between them in the "Beat %" textbox. A clock in perfect beat would have a 50-50 per cent ratio between the ticks and tocks. A more likely example you might find could be average ticks at 2,155 while the tocks average 2,255. While these would still average out to 2,205 samples overall as in the example above, the beat ratio works out to about 48.9%-51.1%, just slightly out of beat even though you probably couldn't tell listening by ear. By adjusting the movement and re-sampling the ticks you can adjust it as close as you like. WTM also shows the in-beat difference between ticks and tocks in milliseconds. A perfectly adjusted 50-50% in-beat movement will show 0 milliseconds in the "Diff" textbox. Limitations of measurement Assuming a 300 beat per minute movement, each beat would be 200 milliseconds long. At 11,000 samples per second, this works out to 2,200 samples per beat. 11,000 samples per second gives a resolution of 90.9 microseconds per sample. Possible sampling error for the exact tick start instant could be plus or minus one sample which works out to plus or minus 0.045 per cent (that's 4.5 hundredths of one percent) This assumes an accurate and clean recording where the ticks can be detected reliably and repeatedly. In reality, the recording quality is the most likely source of error and further points out the need to determine the best setup for your conditions to give you the most accuracy. For more precise measurements, you can select a higher recording rate. Calibration Unfortunately, not all sound cards sample at the exact same rate. For accurate timing results with this program, you'll need to calibrate the program to your particular sound card. Note that this doesn't affect the beat percentage readings since they calculate the RATIO between ticks and tocks, not the actual times. The demo version does not permit calibration and has the calibration constant purposely fixed low so bpm readings are not accurate. However, the demo version is still useful for setting your movement in-beat since beat percentage calculations ARE accurate. In the registered version, you can calibrate the program to your particular sound card sample rate for accurate timing results. To calibrate, you'll need to find and record some accurate one second ticks. Note: Do NOT attempt to use the sample wwv.wav or quartz.wav files included with this software to calibrate your sound card. You must record your own samples with your own hardware to properly calibrate your system. The current Calibration setting is displayed in a white background textbox near the top of the screen and can be changed by highlighting with the mouse, typing in the new value, and pressing "Enter". Pressing the "Save" button will save your Calibration settings so they'll still be set to your personal values the next time you run the program. If you have access to a shortwave radio, you can sample very accurate time ticks from the National Institute of Standards and Technology radio station WWV or WWVH on 2.5, 5, 10, 15 or 20 MHz. Depending on where you live, season, time of day, etc., you may have to try various frequencies and different times of day to get the highest quality recording. You'll get the best results if you wait until they transmit bare ticks (like the example www.wav file) rather than the tones. These time ticks are extremely accurate and once calibrated, you can repeatedly and consistently measure a perfect 60 bpm, 50.0-50.0% in beat. Another source of 1 second beats is to record ticks from an accurate battery powered quartz clock movement. I have a quartz clock that ticks quite loudly and found that pressing a microphone to the case provided a good recording. (Listen to and view quartz1.wav) An even better method is to use a telephone pickup coil placed near the quartz movement and plugged directly into the sound card's microphone jack. This eliminates any problem with extraneous background noise and provides a very clean recording of the pulses for calibration. (Check out quartz2.wav) Once you have a good recording of several one-second beats, the next step is to identify the exact beginning of the first tick by finding the first sample value that is higher than "Tick Level". Determine this by repeatedly selecting (click & drag to highlight) and zooming in on the first tick until you can identify individual samples and determine where the start of the tick is. Moving the mouse pointer on the waveform will display the sample number and sample level at the spot the mouse is pointing to. Jot down this sample number for the first tick, then zoom back out and repeat for the second tick, the third, etc. The difference between each two adjacent beats is the actual sample rate per second for your card. Enter this number into the calibration box, press return, then and press the "Eval" button. You should read close to, if not exactly: 50.0-50.0% beat, 60.0 bpm. If you sampled 5 or so ticks, hopefully they'll all be pretty close to the same, if not average them together and enter that as your calibration number or try recording again to ensure consistent results. Note, see instructions above for "WTM Icon" for information how to enable debug mode to automatically calculate your personal calibration value. Repeat the calibration process for each recording rate you intend to use. Included example wav files sample.wav - A five second sample from a small clock that was made by holding the sound card's microphone against the movement. vienna.wav - A sample from a Vienna regulator movement. This recording was made with a contact mic attached to the movement and connected to a speaker amp. The sound card's microphone was placed near the speaker amp to record the ticks. wwv.wav - A sample of the 1 second time ticks from the National Institute of Standards and Technology shortwave radio station WWVH. The accuracy of these time ticks make them an excellent calibration standard. Loading and evaluating this sample shows a perfect 50.0-50.0% beat setting at exactly 60.00 beats per minute. This recording was made by simply holding the sound card's microphone up to the radio's speaker. quartz1.wav - A sample from a modern battery operated quartz clock movement with a seconds hand. If you don't access to a shortwave radio, a quartz clock is a good alternative calibration source. This recording was made using the sound card's microphone held against the movement case. quartz2.wav - Another sample of the quartz movement used above, this time recorded with a telephone pickup coil plugged directly into the sound card's microphone input. As you can see from the displayed waveform, this method works very well, providing a very clean, noise free recording that works great for determining your calibration setting. 400day.wav - A sample from a 400 day anniversary clock. This example is provided to show some of the problems you may run into and how to solve them. After opening the 400day.wav file, press Eval Sample and you'll get a reading of 9 ticks detected, 23.72 bpm which is obviously wrong (and signified by the red warning background). Listen to the sample and you'll hear there are really only 5 beats in this example, however if you listen closely, you can actually hear a double tick from this movement. The pre-tick is much softer, yet with the normal Tick Level setting, these pre-ticks are recognized as a tick. Repeatedly Zoom in on the ticks and you can see the double ticks. There are several ways to deal with this. Firstly, you could re-record the sample, lowering the microphone recording level so the pre-ticks are lower in volume so they won't be detected. Another way is to adjust the Tick Level setting higher than the pre-tick levels and effectively filter them out. Try a Tick Level of 90 or 100 and evaluate again. You'll find that the pre-ticks are now eliminated and the program correctly registers 5 ticks at 12.00 bpm. A third way to deal with this is to adjust the Skip Ahead value high enough to skip ahead approximately 95% of the way to the next tick. This has the added benefit of processing the sample much faster. Try setting Skip Ahead to about 55,000 (and return Tick Level back to 50). Evaluating again will correctly detect 5 ticks at a rate of 12.00 bpm, even though it is measuring the pre-ticks. The best solution is to set Tick Level to 90 to filter out the pre-ticks and Skip Ahead to about 55,000 to speed up the calculation. Note, if Auto Skip Ahead is selected and you enter the "Desired BPM" of 12, Skip Ahead will automatically adjust itself to the most efficient value. WTM.INI file Here is a copy of the default WTM.INI file as supplied: ; Calibration 11000.0 22000.0 44000.0 ; Default Sampling Rate 11025 ; Tick Level 50 ; Desired BPM 300.0 ; Skip Ahead 2000 Each line that starts with a semicolon (;) is a comment that identifies the following line's purpose. This file is read each time WTM starts up and is used to initialize these values to your preferences. These values are normally changed while using the program and saved by pressing the "Save" button. However it is also possible for you to edit them with a text editor to set your desired startup values. You can always restore this file to the standard defaults (or replace a missing or corrupt WTM.INI file) by pressing "Reset" then "Save." WTM.KEY file When you register your program, you will receive via email or hardcopy letter a 5 line text file called "wtm.key" that must be placed in your WTM directory (which is usually c:\wtm). If you purchased WTM on floppy disk, your key file will be included on the floppy and automatically installed when you run setup. This file contains your personal registration information and a key code to unlock and enable calibration for you. This file must not be edited or modified in any way or your calibration will no longer work. Files included with this release Here is a complete list of files provided with this package. If you wish to remove this software from your system, simply delete all the files in the WTM directory, the WTM directory itself, and the TEGOMM.VBX file in your \WINDOWS\SYSTEM directory. There are some other files installed in the \WINDOWS\SYSTEM directory that may or may not be required by other applications on your system, depending on if you have installed any other Visual Basic applications so you may wish to simply leave them or at least save copies before removing them. Program files: WTM.EXE - the executable WTM.INI - program initialization file stores settings WTM.KEY - (registered version only) - your personal key file that registers the program to you and unlocks the calibration mode 11025HZ.WAV - initialization file used internally by WTM 22050HZ.WAV - initialization file used internally by WTM 44100HZ.WAV - initialization file used internally by WTM Example sample files: 400DAY.WAV SAMPLE.WAV WWV.WAV VIENNA.WAV QUARTZ1.WAV QUARTZ2.WAV Documentation file: WTM.TXT - the documentation file Visual basic support files: \WINDOWS\SYSTEM\TEGOMM.VBX \WINDOWS\SYSTEM\COMDLG16.OCX \WINDOWS\SYSTEM\VB40016.DLL \WINDOWS\SYSTEM\OC25.DLL \WINDOWS\SYSTEM\VAEN21.OLB \WINDOWS\SYSTEM\CTL3DV2.DLL \VB4-16\SETUPKIT\KITFILES\SYS16\* Contacting the author If you have any suggestions or requests for improvements to this program, please send them to me for consideration. You can write to me at: Greg Saville 33950 SW Bald Peak Road Hillsboro, OR 97123 (please include an SASE for a reply) or email to: gregsa@teleport.com Program Updates WTM program updates are available for download via the World Wide Web at url: http://home.teleport.com/~gregsa/clocks/wtm Questions and Answers Q. When I highlight/select and evaluate 4 (or any higher even number) ticks, why does it always tell me it detected one less number of ticks? A. For the calculations to be accurate, the program must detect an odd number of ticks so it has an even number of spaces between the ticks to evaluate. If you select an even number of ticks, the program simply ignores the last one so it can make an accurate evaluation. Q. How come when I display a long recording or a large number of ticks, some of the ticks on the waveform display aren't shown? A. This is a limitation of the pixel resolution of the display screen. Because there are only a limited number of pixels available on the display, the wav file is sub-sampled when displaying the waveform. Depending on how large a wav file is being displayed, the sub-sampling process won't always display with enough resolution to show every tick. The work around is to work with shorter wav files that won't exhibit this problem as much or to zoom in closer on the area where you want to see more resolution of the tick. Copyright Information This Windows Timing Machine program was written with Microsoft Visual Basic for Windows v4.0 and the TegoSoft Sound+ multimedia utilities. The TEGOMM.VBX file included with this distribution is provided under license from TegoSoft under the following conditions: (a) The included VBX file is supplied by the author for use only for the Windows Timing Machine program and may not be distributed by end users for any other use. (b) The TEGOMM.VBX file is owned and copyrighted by TegoSoft and is protected by United States copyright laws and international treaty provisions. (c) End users may not distribute the TegoSoft VBX file for any other use, other than for this Windows Timing Machine program. (d) The author and end users agree to hold harmless TegoSoft and its suppliers from and against any claim or lawsuits, including attorneys' fee, that arise or result from the use or distribution of this software product. The author and TegoSoft make no warranty of any kind with regard to the merchantability, performances and fitness of this software for a particular purpose. Neither the author, nor TegoSoft shall not be liable for errors or for incidental or consequential damages in connection with the furnishing, performance, or use of the software. The end user shall remain solely responsible for, and hold TegoSoft and the author harmless from all claims, liability or damages arising from use of this software. TegoSoft may be contacted at: TegoSoft Inc. Box 389 Bellmore, NY 11710 Phone: (516)783-4824