From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dr. Damien's Development - The Xylophone Project IX - Calibration Dialog

The Calibration button was made active in this installment. The following changes were made.


  • The calibration concept dialog was filled out using functionality from the aquire sound and note calculation objects. It is a simple dialog whose only purpose is to determine a multiplier for the clock in your PC/sound card. On some PCs, especially those with better sound cards, its use will not be necessary.
  • The calibration button on the main panel was made active by adding the new calibration code to the appropriate case in the command processor.
  • A calibration constant was added to the note calculation class and the frequency calculation VIs modified to use it.

The calibration dialog uses the simple dialog pattern, like the configuration dialog. The VI properties are identical to a dialog with one exception — the VI front panel is not shown and closed automatically. This allows us to post an error dialog without showing the main panel in the event the sound card does not initialize properly. Of course, we must programmatically open and close the front panel. Note the clear error before the close front panel method. This ensures the front panel will close. If we need the error in the future, we can move the method off the error wire, surround it with a single frame sequence, and run the error through the sequence without running it through the method. This ensures proper code sequencing.

 

Calibration requires use of the sound acquisition loop. The dialog itself assumes the loop is not in use and starts and stops it using the usual public methods. The event in the main code which calls the calibration loop handles starting and stopping the loop if it is currently in use. It uses the start and stop code which was already implemented. This shows the flexibility of the event driven task handler.


To test the code, I have been using two test bars and an A440 tuning fork. The test bars are about 1cm thick. One is about 1.5cm wide and 10cm long. The other is about 2cm wide and 20cm long. Both are made of poplar, although any wood will do. Hold the bars about 25% of their total length from each end and rap in the center. If you do not have a handy xylophone or test bars, you can snap your fingers or rap a table top. If you do not have a tuning fork, you can hum into the microphone. Not being an operatic tenor, I have to get into falsetto to hit a 440 A Smiley Tongue.


As always, comments and suggestions are welcome and encouraged.


Previous Installments


Message 1 of 1
(3,357 Views)