Tuner is a software chromatic tuner for determining the musical pitch of a sound as well as how close that pitch is to the established value for the note.  Tuner listens on the NeXT's CODEC microphone input and computes a frequency for the sound it samples.  It maps this frequency onto a musical note and displays the value.  Then it looks up the standard value for the note to display the difference between the standard value and the computed frequency.

The tuner can compute pitch using two different algorithms, by counting zero transitions and by doing a fast Fourier transformation (FFT) using the DSP array routines.  You need a relatively simple waveform for the zero transitions algorithm to work -- some instruments and voices work better than others.  When it works, it has a potential accuracy of about +/- 1/4 Hz.   The FFT algorithm is able to handle more complex waveforms but currently only has a potential accuracy of about +/- 2 Hz.  (The zero transitions algorithm works well with recorders and the FFT algorithm works better with bassoons.)  The potential range of both algorithms is C00 to B7 and both are further constrained by the limits of the microphone.

The tuner waits for two consecutive samples at the same pitch before reporting a result.  In combination with the sampling period, this means that you need at least a couple of seconds of tone to register.

At the top of the tuner are SoundMeter and SoundView objects.  The SoundMeter object represents the amplitude (volume) of the sound being received.  The tuner uses the SoundMeter and the squelch setting (see below) to determine if the sample was loud enough to analyze.  Below the SoundMeter is a SoundView object which is a representation of the waveform.  (Occasionally the SoundView stops working, however it is provided only for feedback purposes and does not affect the tuner.)

At the center of the tuner is a row of grayed out note name buttons with radio buttons above them.  When the tuner determines the pitch of a note, the corresponding note name button is highlighted by changing from gray to black.  The radio buttons above the notes are used to transpose the tuner to work with transposing instruments.  (See the transposition default below).

At the bottom of the tuner is the tuning accuracy slider which indicates how sharp or flat the sample is compared to the defined value for the note.  (The slider is shorter on the flat side than the sharp side since notes aren't linear and the distance to the next higher pitch is slightly greater than the distance to the next lower one.)  If a pitch is flat or sharp, the corresponding flat or sharp sign will highlight by changing from gray to black and the slider will indicate the amount of error.  If the pitch is in tune, both the flat and sharp signs will highlight as will the center marker below the slider.

Tuner has several adjustments that are set using its preferences panel:

Transposition (default = 0, range = -11 to 11)  This is the number of semitones by which to shift the computed note value.  It is set using the radio buttons that appear above the note names in the tuner window.  (It's numeric value is shown on the preferences panel but not settable from there.)  For example, if you are tuning an E-flat instrument, selecting the radio button above E-flat will cause the tuner to operate as an E-flat instrument.  By default, the radio button above C is selected indicating no transposition.

Calibration (default = 440, range = 428 to 453)  This default is set via the 'A =' box in the preferences panel and is used to set different values for the pitch of A4.  Setting this default will not affect the note name shown on the tuner (use the transposition buttons to affect that), it will only affect the tuning accuracy slider display.

Squelch (default = 0.1, range = 0.0 to 1.0)  This determines how loud a sound sample has to be before the meter will compute its pitch.  It is used to keep the meter from analyzing background noise.  You may need to set it lower if you're trying to determine the pitch of a very soft sound or set it higher if you've a lot of background noise.  (This setting is also used as the amplitude cutoff for the FFT algorithm so unexpected results may occur when setting this when FFT is in use.)

SampleTime (default = 0.5, range = 0.25 to 2.0)  This is the number of seconds of sound that the tuner samples.  Currently, you shouldn't set this to much less than 1/2 second.  Since the tuner waits to get two consecutive samples that compute to the same frequency before displaying, setting this higher will require a longer settle time.

Tolerance (default = 0.03, range = 0.0 to 1.0)  This determines how close to perfect the tuning accuracy slider has to be before the tuner indicates that the pitch is in tune (by highlighting the center marker and both the flat and sharp signs).

Adjustment (default = 1.0)  This is a fine tuning adjustment that you don't need to change unless you're unhappy with the tuning results and want to bias the frequency.  The default value introduces no bias into the frequency computation.  Make sure you've correctly set the transposition, calibration and tolerance settings before resorting to this adjustment.

Method (default = Zero, alternate = FFT)  This is the algorithm used to compute the pitch.  The zero transitions algorithm is more accurate but may not handle complex waveforms.  The FFT algorithm can handle complex waveforms but isn't as accurate.  The FFT algorithm uses the NeXT's DSP so it may conflict with other programs that use the DSP hardware at the same time.  If such a conflict is detected, the tuner will put up an alert panel and switch to the other mode.

The Save button will save settings that differ from the system defaults into your defaults database.  The Reset button will reset the current settings to those stored in your defaults file in combination with the system defaults.  To restore the settings to the system defaults, remove any changed values from your defaults database via:  dread -o Tuner | dremove

The preferences panel controls don't allow for the full range of possibilities.  For more extreme settings, you'll need to use dwrite to set the values in your defaults database.

There are some known problems with the tuner.  The SoundView object slowly leaks memory, according to MallocDebug, so this is not an application you want to leave running for extended periods.  As mentioned above, occasionally the SoundView just stops working, but tuner doesn't need it to work.  Rarely, the sound recording process itself also stops working, which locks up the tuner.

The current FFT algorithm is not very flexible.  Among other problems, it only uses about 1/4 second of any size data sample and is not able to take advantage of NeXT's with increased DSP memory.  Occasionally when using the FFT algorithm, the tuner will get a segmentation fault, possibly due to the tuner and sound recording trading off use of the DSP.

Although the original version was shareware, Tuner 2.0 is free.  Full sources are provided and bug reports and/or suggestions are welcome.

This software copyright 1992 -- all rights reserved.

Christopher Lane <lane@sumex-aim.stanford.edu>