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

Document Type: Tutorial
NI Supported: Yes
Publish Date: Jan 7, 2010

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

Modern software and hardware technologies empower engineers to analyze many aspects of a sound signal. Programming software such as LabVIEW gives us the ease of use, performance, and powerful functionality needed to develop complex measurements in a short time. This paper describes the steps to develop an audio measurement system based on LabVIEW industry-standard measurement software that delivers better productivity while providing scalability.



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 toolkit 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 NI Sound and Vibration Toolkit. 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 4461 devices offer both 24-bit analog-to-digital converters (ADCs) and 24-bit digital-to-analog converters (DACs) to simultaneously acquire and generate analog signals over a bandwidth from DC to 92 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 17 synchronized NI 4461 devices in a single PXI system, with over 1,000 synchronized channels possible in a multi-chassis system.  The acquired data is then plotted in a graph.

Figure 1. Acquire and plot up 1,000s of channels simultaneously at 24 bits per sample

Signal Scaling

The NI Sound and Vibration Toolkit 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 (Pa), 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 Sound and Vibration Toolkit 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 NI Sound and Vibration Toolkit

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 Sound and Vibration Toolkit 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 Sound and Vibration Toolkit 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 Sound and Vibration Toolkit

 

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 Sound and Vibration Toolkit.

Single-Tone Information

Several standard methods for audio measurements require the excitation and analysis of a single tone. The NI Sound and Vibration Toolkit offers an Express VI to extract important information about a tone found in a signal. The Tone Measurement Express VI finds the tone with the highest amplitude on the signal and calculates the amplitude and frequency. This VI also has the option to export a spectrum and additional tone analysis. For better performance, this VI can also narrow the search to a specified frequency band. Figure 4 shows the Tone Measurement Express VI analyzing a noisy sine wave and reporting the values. This example was limited to a single-channel analysis, but this VI is capable of analyzing several channels simultaneously.



[+] Enlarge Image

Figure 4. Extract the frequency and amplitude 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. The NI Sound and Vibration Toolkit 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 Amplitude and Level Express 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.



[+] Enlarge Image

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 the Gain and Phase VI in the Sound and Vibration Toolkit that calculates the gain of a system based on the acquired stimulus and response. Gain can be expressed either in a linear scale or in decibels, a common way to evaluate this response.

Figure 6. Calculate system gain based on the acquired signals

Interchannel Crosstalk

In general, crosstalk 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 the Crosstalk VI included in the Sound and Vibration Toolkit.       

Figure 7. Calculate crosstalk 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.

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.

Total Harmonic Distortion plus Noise

Having the SINAD of a signal makes other measurements easy, for example the total harmonic distortion 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.

Figure 8 below shows the use of the Tone Measurements Express VI in the Sound and Vibration Toolkit to obtain the THD, SINAD, and THD+N of an input signal.



[+] Enlarge Image

Figure 8. Measure total harmonic distortion (THD), signal in noise and distortion (SINAD), and total harmonic distortion plus noise (THD+N) with LabVIEW

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 9 computes the dynamic range of a signal containing a single tone. Weighting could be included with the Sound and Vibration Toolkit weighting VIs to create an A-weighted dynamic range measurement.


[+] Enlarge Image

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

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 Sound and Vibration Toolkit is capable of easily performing various types of sound level measurements. In Figure 10, 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 10. Calculate several sound level measurements from acquired data using the Sound Level  Express VI in the Sound and Vibration Toolkit

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 Sound and Vibration Toolkit used with a National Instruments DSA boards is capable of creating a fractional-octave analyzer fully compliant to international standards. Sound and Vibration Toolkit includes VIs to comply with both ANSI and IEC standards; they can go from full-octave to 1/24-octave analysis. Figure 11 shows third-octave analysis using the Sound and Vibration Toolkit.



[+] Enlarge Image

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

Power in Band

Frequency measurements are commonly used in audio applications. As such, the Sound and Vibration Toolkit 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 Sound and Vibration Toolkit 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 12, 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.


[+] Enlarge Image

Figure 12. 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 multi-tone 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 non-correlated 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 13 shows a VI that obtains the Bode plot from an acquired stimulus and response based on the Sound and Vibration Toolkit.


[+] Enlarge Image

Figure 13. 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 with the NI Sound and Vibration Toolkit 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/).