Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Oct 30, 2006


Feedback


Yes No

Related Links - Developer Zone

Related Links - Products and Services

Production Line Audio Testing - Advanced Concepts and Applications

1 ratings | 4.00 out of 5
Print | PDF

Overview

This tutorial is part of the NI Analog Resource Center. Each tutorial will teach you a specific topic by explaining the theory and giving practical examples. This tutorial describes how to make accurate audio measurements.

You can also view a webcast for a multimedia presentation with slides and audio.

For more information, return to the NI Analog Resource Center.

Introduction

One of the first recorded attempts to measure audio signals took place in 1627 when Francis Bacon attempted to measure the speed of sound in an open field1. While his idea was good, he could not come up with a valid measurement due to technical limitations. Today, we can use software and hardware to empower us to analyze many aspects of a sound signal, in addition to just its speed. Programming software such as LabVIEW gives us ease of use, performance, and powerful functionality to develop complex measurements in a short time. This paper describes the steps to develop an audio measurement system that delivers better productivity while providing scalability. The system will be based on LabVIEW industry-standard measurement software.



Modern audio measurements are among the most demanding operations for a digital measurement system. To perform successful audio measurements the software must be able to perform several tasks (such as data scaling, filtering, analysis, and visualization). From acquiring the data to presenting the results, LabVIEW has the flexibility and modularity to assure precise measurements. National Instruments offers the possibility to expand the power of LabVIEW with a toolset designed to make sound and vibration measurements easier. National Instruments hardware and software integrate seamlessly to replace many box instruments and offer much more customization and power.

The following section presents a general explanation of some common tasks in audio measurements. The examples in this paper use LabVIEW professional development system or full development system, some of them using the LabVIEW Sound and Vibration Toolset. The examples can be easily integrated to create a custom audio measurement system.
 
View Webcast
 

Data Acquisition, Scaling, and Weighting

Most measurement systems begin with some form of sensor or transducer that generates electrical signals according to physical phenomena. The process of measuring those electrical signals and inputting them to a computer for processing is known as data acquisition. Dynamic signals such as audio require high-resolution and high-dynamic-range digitizing devices. National Instruments NI 4472 devices offer 24-bit analog-to-digital converters to simultaneously acquire input signals over a bandwidth from DC to 45 kHz to ensure high-resolution measurements. Figure 1 shows the block diagram and part of the front panel of a LabVIEW VI that drives up to 14 synchronized NI 4472 devices to acquire 112 simultaneously sampled channels. In this example, the user can configure integrated circuit piezoelectric excitation and AC/DC coupling on a per-channel basis. The acquired data is then plotted in a graph.

 

Figure 1. Acquire and plot up to 112 channels simultaneously at 24 bits per sample

Signal Scaling
The LabVIEW Sound and Vibration Toolset (SVT) offers high-level VIs that present data with the appropriate units – that is time-domain data in the correct engineering units, frequency data in decibels, etc. However, values acquired via a data acquisition device usually have a linear relationship with the voltage coming from the sensor; raw data comes in regular voltage units. Signal scaling is the required process of converting the voltage values to the correct engineering units. The SVS Scale Voltage to EU.vi provides an easy way to scale a voltage signal to units such as pascals, g, m/s², etc. The scaling VI is the bridge between raw data coming from the digitizer and a useful value related to the microphone or sensor being used. Figure 2 shows a VI that uses the SVT to present the data acquired with a unit range that correspond to the actual physical phenomena under observation.


  

Figure 2. Scale raw data to proper engineering units with the the LabVIEW Sound and Vibration Toolset

In order to get an accurate scaling of a signal, calibrating the system might be necessary. Calibration can be achieved when there is a known relationship between a measured value and the value provided by a standard. In audio measurement systems calibration requires an external sound source with a known value, usually coming from a pistonphone or an acoustic calibrator. The SVT provides calibration VIs that help to ensure the accuracy of the complete measurement system.

Weighting Filters
Measurement hardware is usually designed to have a flat response across the audio frequency band. On the other hand, the human ear has a nonlinear response. Because in most cases the final sensor is the human ear, we need to compensate our measurements to fit a model of our ears. Using weighting filters is the standard way to best describe our subjective perception of sound. Traditionally, weighting filters are built using analog components; however, the SVT offers digital weighting filters for time and frequency data. Figure 3 shows a VI that applies an A weighting filter that combined with National Instruments hardware complies with the American National Standards Institute (ANSI) standards.

  

Figure 3. Apply an A weighting filter to scaled data with the SVT

View Webcast

Audio Measurements with LabVIEW

Having acquired, scaled and weighted an audio signal, we are now ready to take advantage of the processing power of our computer to perform complex signal analysis. This section describes common audio measurements used throughout the industry. A brief explanation is provided together with example code that demonstrates how to perform these measurements with the SVT. The first part covers standard measurements that can be accomplished with LabVIEW alone; the second part demonstrates how the SVT performs high-level audio measurements with simple LabVIEW code.

Single-Tone Information
Several standard methods for audio measurements require the excitation and analysis of a single tone. LabVIEW offers a high-level VI to extract important information about a tone found in a signal. The Extract Single Tone Information.vi finds the tone with the highest amplitude on the signal and calculates the amplitude, frequency, and phase. This VI also has the option to export either the extracted tone or the signal minus the extracted tone. For better performance, this VI can also narrow the search to a specified frequency band. Figure 4 shows the Extract Single Tone Information.vi analyzing a noisy sine wave and reporting the values. This example was limited to a single-channel analysis, but a small variation of this code could analyze several channels simultaneously.


  

Figure 4. Extract the frequency, amplitude, and phase of a single tone in a signal


RMS
For certain applications the amplitude of a signal is not enough information. In many measurements, such as gain calculations and power, the root-mean-square (rms) value of a signal is required. LabVIEW provides a VI that easily computes the rms value by squaring the instantaneous signal data, integrating over the desired time, and taking the square root. The Basic Averaged DC-RMS.vi is also capable of averaging the rms values calculated from the signal. This VI also includes the option of time windowing for better measurements. Figure 5 shows how LabVIEW calculates the linear averaged DC and rms value using a Hanning window.

  

Figure 5. Obtain the averaged rms value of an acquired signal

Gain
One of the basic measurements performed on an audio system is gain. The system gets a stimulus signal and generates a response signal. The factor by which the signal is amplified by the system is the gain. When calculating a series of gain measurement in different frequencies it is possible to generate a frequency response function of the system. Figure 6 shows a basic VI that calculates the gain of a system based on the acquired stimulus and response. This example obtains the gain by calculating the ratio of the rms value of the response to the rms value of the input. Gain can also be expressed as the ratio of the amplitudes of the stimulus and response signals. This example presents the gain in decibels, a common way to evaluate this response.

  

Figure 6. Calculate system gain based on the rms values of the acquired signals

Interchannel Cross Talk
In general, cross talk is defined as the signal leakage from one channel to another. To perform this measurement, a signal is applied to one of the inputs; then the presence of that signal in other undriven channels is measured. There are several standards that define this type of measurement for different conditions and for specific applications. The measurement is usually presented as the ration of the undriven channel to the driven channel in decibels. Figure 7 shows how to perform cross-talk analysis from two acquired signals.

  

Figure 7. Calclate cross talk from two acquired signals

Total Harmonic Distortion
Harmonic distortion is the undesired addition of signals whose frequencies are integer multiples of the input signal. This form of distortion, usually generated by analog circuitry, is an important measurement when determining audio quality. Harmonic distortion is calculated as the ratio of the level of a single harmonic to the level of the original signal. Total harmonic distortion (THD) is a measure of the total distortion introduced by harmonics of the input signals. LabVIEW includes a harmonic distortion analyzer capable of detecting the fundamental frequency, calculating the amplitude of the harmonic components, measuring THD, and exporting a selected signal. Figure 8 shows the use of the Harmonic Distortion Analyzer.vi in LabVIEW to obtain THD of an input signal. The detected fundamental frequency can be used to verify the measurement conditions.


  

Figure 8. Measure total harmonic distortion with LabVIEW

Signal in Noise and Distortion
Another option to THD measurements is included in the LabVIEW SINAD analyzer.vi. Signal in noise and distortion (SINAD) is the ratio of the energy of the input signal to the sum of the energy found in noise and harmonic distortion. Audio quality is also assessed using SINAD measurements because the result gives us an idea of how dominant the desired signal is compared to the undesired noise and distortion. Figure 9 shows how to perform a SINAD measurement in LabVIEW. The example takes an acquired signal and calculates the frequency of the fundamental frequency detected and calculates the SINAD in dB. As in other examples, this VI works for one channel or multiple channels of acquired data.

  

Figure 9. Measure signal in noise and distortion (SINAD)

Total Harmonic Distortion plus Noise.
Having the SINAD of a signal makes other measurements easy, for example the total harmonic fistortion plus noise (THD+N) can be easily calculated from the SINAD. THD+N is usually presented as a percentage. THD+N in decibels is the negative of SINAD, so a conversion is needed to obtain THD+N as a percentage. It is important to report the actual level of the excitation signal used for the measurement; SINAD and THD+N are dependent on the stimulus applied. The example in Figure 10 shows how to get the THD+N as a percentage from the SINAD value.


  

Figure 10. Calculate THD + N as a percentage from the SINAD value

Dynamic Range
A common specification for audio systems is the dynamic range – the ratio of a full-scale signal to the smallest signal in the system. Dynamic range can be seen as the signal-to-noise ratio because the smallest signal in the system is usually noise, the main difference is that dynamic range is calculated with the noise floor of the system when a signal is present. Dynamic range is usually expressed in decibels, and can also be performed over a weighted noise floor resulting in a weighted dynamic range. Figure 11 computes the dynamic range of a signal containing a single tone. Weighting could be included with the SVT weighting VIs to create an A-weighted dynamic range measurement.

  

Figure 11. Determine the dynamic range of a single-tone signal

View Webcast

LabVIEW Sound and Vibration Toolset Examples

Sound Level Measurement
Probably the most common audio measurement is sound level. The sound level is defined as the dynamic variation of pressure. The measurement is usually referenced to the threshold of human hearing (usually 20 µP) and is presented in dB based on a logarithmic amplitude scale. When performing sound level measurements, you often use a weighting filter and averaging. The SVT is capable of easily performing various types oaf sound level measurements. In Figure 12, we present an example that calculates different sound pressure measurements based on acquired data. It is also possible to do repeated measurements to calculate reverberation times or equivalent noise level during a long time.


  

Figure 12. Calculate several sound level measurements from acquired data using the SVT

Octave Analysis
Fractional-octave analysis is a widely used technique for analyzing audio and acoustical signals because this analysis exhibits characteristics analogous to the response of the human ear. The process consists of sending a time-domain signal through a bank of bandpass filters, calculating the average of the squares of the signals and displaying the values on a bar graph. Specifications for octave analyzers are defined by ANSI and International Electrotechnical Commission (IEC) standards. The properties of the bank filter and the graph are defined by the required frequency band and by the fraction of octaves that are needed. The SVT used with a National Instruments DSA boards is capable of creating a fractional-octave analyzer fully compliant to international standards. SVT includes VIs to comply with both ANSI and IEC standards; they can go from full-octave to 1/24-octave analysis. Figure 13 shows third-octave analysis using the SVT.

  

Figure 13. Perform 1/3-octave analysis based on ANSI standards

Power in Band
Frequency measurements are commonly used in audio applications. As such, the SVT includes powerful tools for frequency analysis. There are tools for baseband FFT, baseband subset analysis and zoom FFT; they can obtain the power spectrum, power spectral density, etc. The SVT Power in band.vi is one of the frequency spectrum analysis VIs. It calculates the aggregate power in a specific frequency range. As shown in the Figure 14, you can get the power in a frequency band from a power spectrum, a power density spectrum, a magnitude spectrum or a coherent output power spectrum. The results are presented with the appropriate units according to the input units.

  

Figure 14. Find the power present in a specific frequency band

Frequency Response
The purpose of performing frequency response analysis is usually to characterize the frequency response function (FRF) of the system under test. The FRF represents the ratio of the output to the input in the frequency domain. FRF curves are a typical specification found in audio equipment. There are different approaches to obtain a FRF; dual-channel frequency analysis is probably the fastest one. Cross-spectral techniques generate a frequency curve that depends on two inputs, usually a stimulus and the response from the unit under test (UUT).

The common setup for frequency response analysis requires the use of a broadband stimulus going into the UUT (usually noise or multitone signals). The stimulus and the response from the UUT are then acquired simultaneously. Dual-channel frequency analysis is performed to obtain the frequency response and phase response of the UUT and coherence of the signals. To improve the FRF measurement, you can average the response; the more FRFs you average, the more accurate the response curve will be. This approach has the advantage of overcoming noise, distortion, and noncorrelated effects. In addition, this technique can be extremely rapid, because it measures all frequencies of interest simultaneously. Its only limitation is that its signal-to-noise ratio can be lower than that of a comparable swept measurement. Figure 15 shows a VI that obtains the Bode plot from an acquired stimulus and response based on the SVT.

  

Figure 15. Obtain the frequency response function with cross spectral techniques

View Webcast

 

Conclusion

The measurements presented here are just an introduction to the possibilities of LabVIEW in audio measurements. Hardware and software integrate to complete the whole measurement process – acquire data, analyze and present. The power and flexibility of LabVIEW can be used to expand the system to generate multiple measurements, automate testing, and report generation, which results in better performance and lower overall cost.

Relevant NI products

Customers interested in this topic were also interested in the following NI products:

For the complete list of tutorials, return to the NI Analog Resource Center.


 

1 ratings | 4.00 out of 5
Print | PDF

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).