Vobarian Software
Home to Fransys to Manual
Last update: 2009-10-10
Fransys Manual

Contents

  1. License
  2. Installation of the program
  3. Quick intro
  4. Test setup
  5. Generate a sweep with WaveGen
  6. Play & record — setting up playback and recording, adjusting levels
  7. Analyze the recording with WaveMeas
  8. Import the frequency response data — how to import data to Works, Excel, and Quattro Pro
  9. Analyze the data — interpreting data and compensating measurements
  10. Troubleshooting
  11. Resources — links to other useful software and information

Additional documents

Testing Fransys's Accuracy — also contains information on testing electronic circuits


1. License

Fransys is provided free and "as-is" for non-commercial use. By using the software, you agree to the terms of the license. Please read the full license before using the software.


2. Installation of the program

Simply unzip all the files into a folder of your choice. To uninstall, just delete the folder. If Fransys is not available for your operating system, you can download the source code (see Resources) and compile it using an ANSI C++ compiler.


3. Quick intro

Fransys is a set of programs for measuring the frequency response of audio equipment connected to a computer's sound card. Many other audio analysis programs are available (see Resources), but Fransys was created to meet specific requirements:

The programs use discrete sine-wave tones of different frequencies, played one after the other, making a "sweep" from the low frequency to the high. The WaveGen program generates the tone samples. WaveGen allows you to specify the parameters of the sweep and produces two files: a sweep parameters file, which contains the parameters you entered, and a Wave format sound file (typically with a .WAV extension) containing the test tones. Next, the test wave file is played out through the sound card, through the DUT (device under test), and the output is fed back to the input of the soundcard and is recorded. WaveMeas then analyzes the recorded sound and creates a text file containing the results.

The basic steps to run a test are:

  1. Run WaveGen to create a sweep wave file
  2. Play the wave file and simultaneously record the output back from the audio equipment under test into another wave file
  3. Run WaveMeas on the recorded wave file to measure the frequency response
  4. Import the output text file from WaveMeas into a spreadsheet or graphing program and perform analysis and graphing

Block Diagram of Data Flow

Each step is covered in more detail below.


4. Test setup

To measure the frequency response of audio equipment, an input signal is played through the equipment and the output is recorded simultaneously. The input signal is a sweep of sine-wave tones ranging from low to high frequencies. A synchronization pulse is used to mark the start of the tones in the recording. The sync pulse makes a "pop" sound when played through speakers. (Note: I have never seen equipment damaged by this synchronization pulse, and I would not expect there to be danger if the volume is set appropriately, but all responsibility for the risk and liability rests with you.)

There are two ways to play and record the sounds simultaneously. Either you can use one sound card to play and record simultaneously, or you can use two different computers, one to play and one to record. It is easiest to play the sweep and record the equipment's response simultaneously on one sound card, if your sound card has support for simultaneous playback and recording (full duplex). However, one possible source of error in this case is crosstalk between the playing and recording. If you play a sound while simultaneously recording but with nothing connected to the line-in, you will probably be able to see a very small amplitude signal in the recording which is interference from the playback. The effect is usually greater at higher frequencies. This effect is not very large, but if you are concerned with getting the highest accuracy, you might need to use a better sound card.

Alternatively, you can play the sweep into the equipment with one computer and record the response with another computer (or another sound card in the same computer). However, the two sound cards will not have exactly the same sampling rate. For example, even if you play and record at 44.1 kHz, the sampling rates will not match exactly because the clocks on the sound cards are not perfectly matched. This variation interferes with the precise timing of the sweep, so regular re-synchronization is needed. Synchronization is achieved by inserting a pulse in the sweep wave, which will produce a "pop" when played. You will need to generate the sweep using WaveGen with slightly different parameters than if you were using just one sound card. In particular, you need to specify a number of tone samples to play following each synchronization pulse. I recommend starting at 10 tones before each re-synchronization. However you need to decrease this number if there are regular "jumps" in the results. There is more information in the section of this manual on "WaveGen" (the program for generating the test tone sweeps). Using this method, amplitude can be measured fairly accurately, but even if you set the sweep to re-synchronize after every tone, it is usually not possible to make accurate phase measurements. At higher frequencies, the phase will tend to jump around. It is easy to understand why. Consider a 15 kHz tone sampled at 44.1 kHz. If the recording were off by just one sample, it would result in a 122 degree phase shift. So, accurate phase measurements generally must be made by playing and recording simultaneously with the same sound card.

Another possibility is to make a CD containing the tone sweep. This method makes it possible to measure the frequency response of a CD player. The above paragraph about re-synchronization applies in this case too.


5. Generate a sweep with WaveGen

5.1 Basic steps to know

The first step is to generate a sweep wave file. A sweep is a set of tones (sine waves) which will be played through the audio equipment under test. You can adjust the parameters of the sweep, such as the start and end of the frequency range, the length of the tones, etc. WaveGen will produce two files: first, a wave file containing the sweep sound; second, a "sweep parameters" file which contains the parameters describing the sweep. The sweep parameters file is needed later so that the WaveMeas program can find the tones and measure them.

To save time as you enter parameters, just press <Enter> (type nothing) for any parameters you don't care about and the default will be used automatically. Under most operating systems, you should be able to press Control-C at any time to abort the program.

Here's how the program runs, step-by-step:

  1. Enter a filename for the sweep wave file (the output sound). If you are using the Windows version of the program you should see a standard Windows "Save" dialog box. Under text mode in other operating systems you will have to type the filename when prompted, including the .WAV extension if you want.
  2. Enter a filename for the sweep parameters file. The name does not need to have any particular form, but I usually give it the same name as the wave file and add ".SWP" after the filename so I can keep track of it.
  3. Enter the output sampling rate. Most sound cards today support a 48000 Hz sampling rate. Audio CD's use a 44100 Hz sampling rate. In general, higher sampling rates will give more accurate results at high frequencies. (Note: Just press <Enter> (type nothing) to accept the default.)
  4. Select the sweep type. An octave sweep is usually more useful in audio applications. A linear sweep on the other hand has a constant increment of frequency from one tone to the next.
  5. Next you define the start (lowest) frequency and end (highest) frequency of the range. Keep in mind that the maximum possible frequency is half the sampling rate. For instance, with a 44100 Hz sampling rate, the frequency cannot exceed 22050 Hz.
  6. Next you define the size of the step from one frequency to the next. If you selected an octave sweep, you will be asked to enter the number of tones to play per octave. The default, 24, will give a medium level of detail. A higher number (48 or greater) will give very detailed results. A lower number, around 12, can be used for a quick sweep. If you chose a linear sweep, you will be asked to enter the increment in frequency (in Hertz) from one tone to the next.
  7. Enter the minimum duration (in seconds) for each tone. Higher numbers may give more accurate results, but the default of 0.02s seems to be accurate enough in most cases.
  8. Enter the time between tones. This time allows the tone to stabilize and allows the previous tone to stop ringing. Here are some recommended settings depending on what you are measuring:
    • Speakers: 0.040 seconds
    • High-quality headphones: 0.025 seconds (headphones usually respond faster than speakers and there is no room reverberation)
    • Electronic circuits: 0.005 seconds (circuits usually respond very fast in the audio frequency range)
  9. You are asked for the number of tones to play following each synchronization pulse. A synchronization pulse allows WaveMeas to find the start of the sweep in the wave file you record. When playing the sweep and recording simultaneously on one computer, a single sync pulse at the beginning is usually all that is needed (default; tones per sync=0). But when playing sound on one computer and recording on another, the difference in the sound card clocks will ruin the precise timing of the sweep. If you are not using a single sound card for playback and recording, set this parameter to around 10 and decrease it if there are "jumps" in the results.

5.2 Optional advanced settings

Finally, you'll be asked if you want to edit the "advanced options." You can usually answer "no" (press N) and skip the information below, but for reference here are the advanced options:

  1. Enter the amplitude of the synchronization pulse. This is the pulse used to find the start of the sweep when WaveMeas examines the output from the audio equipment under test. Lower numbers might be "safer" for the equipment, but I've never seen any damage result from the pulses. A higher number may be needed if recording at very low levels.
  2. The minimum number of cycles for each tone helps control error in the low frequencies. For instance, 0.02 seconds of a 50 Hz tone is still only one cycle, which isn't enough for accurate measurement.
  3. The "maximum fractional cycle" option is kind of lengthy to explain. Basically, a value of 1 (the default) works in general, but lower values (0.1 or less) may reduce error. You can experiment with this parameter and see if making it lower changes the results. However, as you lower the number, the size (and duration) of the sweep wave file will increase.
  4. Enter the maximum number of samples (of the waveform) to add to each tone for error control. The program tries to choose the number of samples so that a whole number of cycles is played, improving the accuracy of the DFT. This parameter prevents the program from producing excessively long tones. Increasing this number could reduce error (and result in larger, longer wave files) but it probably won't make much difference.
  5. The "maximum time drift" parameter controls the amount of padding (extra tone) surrounding each tone. This parameter is usually only important when playing the sweep and recording with two different computers. You may get more accurate results (and larger wave files) by increasing this number if the two sound cards being used have very different clocks.

6. Play & record

After a sweep wave file has been created, it must be played out through the sound card and through the audio equipment under test. The output from the audio equipment must then be recorded into another wave file while the sweep plays through the equipment. For example, if you are measuring a speaker, the sweep would be played from the computer into your amplifier, and into the speaker. Then the sound produced must be recorded using an accurate microphone.

The wave file you record must have certain format characteristics. These are:

Almost any sound recording program can be used. If you don't already have a program for recording, an excellent program to use is Audacity. Audacity is free, supports simultaneous playback and recording with one click, shows the waveform, and has a convenient level meter. If you're using Windows and you don't want to download Audacity, you can just use the "Sound Recorder" program that comes with Windows (sndrec32.exe).

If you are using the "Sound Recorder" program that comes with Windows, here are some tips:

If you are playing and recording from a single computer, or if you can access the sweep wave file over a network, you can start the recording by opening the sweep wave file and then saving it under a different name. This way the wave file will already have the correct format as described above. To run the sweep, open the sweep wave file in two different instances of "Sound Recorder." Then go to "File" and select "Save As..." to give the file a new name. This renamed file will be used to record while the other "Sound Recorder" window will play the sweep.

If you are playing and recording on two different computers, you need to set the format of the wave file before you start recording. To do so, start "Sound Recorder" and then go to "File" then click "Properties." Click "Convert Now..." Under "Format" select "PCM" and under attributes select an option which says "16 Bit, Mono" and which has a sampling rate matching the sweep wave file you will use in the test.

Some sound cards may produce a "pop" when they first start playing back a sound. The analysis program, WaveMeas, could mistake such a "pop" for the synchronization pulse. In order to prevent that mistake, it is probably best to start the playback of the sweep first and then to immediately start the recording. (The sweep wave file contains 3 seconds of silence at the beginning in order to give you time to start the recording.)

Before recording, it is important to set the right playback and recording levels. The playback level should be set so that it does not cause clipping in the device under test. A higher recording level will give you more dynamic range, but the recording level must not be so high that the waveform is clipped. The recording must be made in mono. When recording in mono, some sound cards record only the left channel, and it is possible to set the recording level so that the maximum recording level is reached. However, other sound cards take the sum of the left and right channels. This may give inaccurate results when testing stereo equipment because the performance of the left and right channels will be mixed together. Or, if only the left channel is used, the right channel input level will be zero, so it will not be possible to reach the maximum recording level. The waveform will clip but the maximum amplitude will be only 50%. This cuts the resolution of your results in half. In this case, you could either use a different sound card, or connect both the left and right channels of the sound card's line-in to a single output of the DUT. Another possibility may be to make the recording in stereo and then discard one channel before saving the Wave file.


7. Analyze the recording with WaveMeas

The easiest part of the process is running WaveMeas to measure the recorded response of the audio equipment. Once you have made your recording, run WaveMeas as follows:

  1. Start the WaveMeas program.
  2. Enter the filename of the recorded sound (or just select the file if you are using the Windows version of the program with standard Windows Open/Save dialogs).
  3. Enter the filename of the sweep parameters file which was generated when you created the sweep with WaveGen. This file is needed so that WaveMeas can find the tone samples in the recording.
  4. Enter a filename for the output, which will be in plain text format.

After entering the three filenames, WaveMeas will perform the measurement and display a "Percent Done" indicator. After it is finished, the peak recording level will be displayed. If the peak level is 100%, then it is likely that the input to your sound card when recording was too loud and clipping occurred, causing inaccurate results. So, if the peak level is 100%, you should reduce the recording level and try again. On the other hand, if the recording level is too low, the results will not reveal as much detail as they could at a higher recording level.


8. Import the frequency response data

The output of WaveMeas is a plain text file. The file is arranged in columns, each of which is delimited by a comma and a single space. The first several lines contain information about the sweep. Following the header is the actual data, arranged in five columns: the frequency, the amplitude, the normalized amplitude, the normalized amplitude in decibels (dB), and the phase in degrees. You will probably want to import this data into a spreadsheet or graphing program for further analysis and plotting. Here are the instructions for several programs:

Quattro Pro 7 spreadsheet

  1. Select a cell as the upper-right corner of the block into which the data will be placed.
  2. From the "Data" menu select "Text Import".
  3. Enter the filename or browse to find the text file output from WaveMeas.
  4. Select "Only Commas".
  5. Press OK.

Microsoft Excel

  1. Select a cell as the upper-right corner of the block into which the data will be placed.
  2. Click the "Data" menu, go to "Get External Data", click "Import Text File".
  3. Select the file and press "Open".
  4. Click "Next".
  5. Check the box labeled "Comma".
  6. Press "Finish". Press OK.

Microsoft Works

  1. Go to File => Open.
  2. In "Files of Type" select "Text" or "All Files". Select the output wave file from WaveMeas.
  3. Press "Open".
  4. Select "Spreadsheet" to place the data in a spreadsheet.
  5. You can copy & paste the data into another spreadsheet if you want.

OpenOffice.org

  1. Go to File => Open.
  2. Under "Files of Type" select "Text CSV".
  3. Select the file to import and press "Open".
  4. Place a check mark next to "Comma" and press "OK".
  5. You can copy & paste the data into another spreadsheet if you want.

9. Analyze the data

There are five columns of data. Each row contains the data for one tone. The "Amplitude" column contains the measured amplitude of that particular tone, expressed in the same units as the digital samples in the wave file, which are 16-bit samples. These units are fairly arbitrary but the numbers can be used to compare the volume level of different tones. The "Normalized Amplitude" is just the value of the amplitude divided by the average amplitude of all the tones. This should help reduce the dependence of the results on the recording level. For instance, if the recording level were cut in half, the actual amplitudes would change, but the normalized amplitude should remain the same. The next column shows the amplitude in decibels, relative to the average raw amplitude. This value is calculated as:

Amp[dB] = 20 ⋅ log10(amplitude / (average amplitude))

The last column is the phase in degrees. Phase shift indicates how much tones of different frequencies are delayed by the equipment through which they pass. Phase shift can be converted to a time delay, in seconds, with the formula:

timeShift[seconds] = -phase[degrees] / (360 ⋅ frequency[Hertz])

Phase shift is measured relative to the synchronization pulse. If some tone has a positive phase shift, the time delay would be negative, and that tone would arrive before a tone with a phase of zero if both were played into the DUT simultaneously.

The frequency response will depend on the device under test (DUT) and the measurement equipment. For instance, if you are interested in the frequency response of a speaker, the speaker is the DUT. The "measurement equipment" is all the other equipment in the audio chain, such as the sound card, amplifier, and microphone used in the measurement. The measurement equipment will have its own imperfections, and it is important to measure the measurement equipment itself so that you can ensure that it won't interfere with the desired data, and so you can compensate the raw data to some extent. Two approaches (that I know of) can be used to control this error. First, very accurate measurement equipment is needed if you want accurate results, which means you need a good sound card, measurement microphone, etc. But no equipment is perfect, so the second thing to do is to measure the test platform and try to compensate the results.

To compensate for the effects of the measurement equipment, first measure the frequency response of the measurement equipment by itself. Then insert the DUT into the signal chain and measure the frequency response again. You now have two sets of data—the frequency response of the measurement equipment, and secondly the frequency response of the measurement equipment plus the DUT. As an experiment, you might start by connecting a cable directly between the line-in and line-out of your sound card and measuring its frequency response. To compensate your measured data, divide each frequency's amplitude by the normalized amplitude of the measurement equipment at that frequency. Note that division is required for the amplitude when it is expressed linearly. For decibels, you would use subtraction. Also subtract the phase of the measurement equipment at each frequency from the raw phase to help remove the effect of the measurement equipment.

For example, suppose you measure the frequency response of your sound card and the normalized amplitude at 500 Hz is 0.75 (-2.5 dB) and the phase is 20 degrees. Next, you place the equipment to be tested into the signal chain and measure its frequency response. Suppose the normalized amplitude is then 1.0 (0 dB) and the phase is 22 degrees at 500 Hz. To reduce the effect of the sound card's own frequency response, divide the amplitude by the normalized amplitude of the sound card at that frequency. In this case, the corrected amplitude at 500 Hz is: 1.0 / 0.75 = 1.33 (2.5 dB). The corrected phase is 22 - 20 = 2 degrees. The new amplitude and phase represent the change caused by placing the equipment under test into the signal chain. These calculations can easily be performed in a spreadsheet using formulas. However, these corrections can only smooth out minor bumps in the frequency response of the measurement equipment. The final results still require good measurement equipment to start with.


10. Troubleshooting

Error message: Input wave file ended before expected.

WaveMeas expected to find more tones but the input wave file ended. Possible causes/solutions:

Error message: The synchronization pulse could not be found.

The synchronization pulse is used to locate the start of the tones. This pulse was not detected in the recording.


11. Resources

Fransys Homepage
Here you can download the Fransys source code and the latest version of Fransys. Also you can find my e-mail address.

The WAVE File Format
Information on Wave files and source code for reading them. Fransys uses Timothy J. Weber's wave file manipulation code.

RightMark Audio Analyzer
RMAA is a free audio analyzer with an easy-to-use interface. It measures frequency (amplitude) response, THD, IMD, noise, and crosstalk.

Audacity
Audacity is a free program for multitrack recording. It allows you to play and record simultaneously. It has a level meter and waveform display.

TrueRTA
TrueRTA is a real-time analyzer displaying amplitude versus frequency. Includes an oscilloscope and function generator. A free version is available with very limited resolution.

Liberty Instruments' Praxis
More software measuring frequency response with many other features. A limited free version is available.

How to Troubleshoot Wave Sound File Problems in Windows 95, Windows 98, and Windows Millennium Edition (Me)

Comments and questions are welcome. E-mail address: contact delete-this-before-sending _AT_ vobarian.com (Obviously, delete the extraneous words and replace _AT_ with @. This is to reduce spam.)

Mountains & clouds at top of page (clouds.jpg) taken from photo by Oswald Skene / DHD Multimedia Gallery

©2009 Chad Berchek - everything here unless otherwise noted