This example shows how to apply weighting filters to measure sound pressure. A user interface (UI) allows the user to control various parameters while the simulation is running.
In many applications involving acoustic measurements, the final sensor is the human ear. Thus, most acoustic measurements try to represent the ear's subjective perception of a sound. Instrumentation devices are built to provide a linear response, but the ear is a nonlinear sensor. Special filters known as weighting filters, are used to account for these non-linearities.
This example uses weightingFilter System object to implement A-weighting and C-weighting filters. The pressure is computed by calculating the RMS value of the audio samples, referenced to a sound pressure of 20e-6 Pascals.
For more design details on these audio weighting filters, see Audio Weighting Filter example.
soundPressureMeasurementExampleApp is the function containing the algorithm's implementation. It instantiates, initializes and steps through the components forming the algorithm.
Execute soundPressureMeasurementExampleApp to run the simulation and plot the results on scopes. Note that the simulation runs for as long as the user does not explicitly stop it.
soundPressureMeasurementExampleApp launches a UI designed to interact with the simulation. The interface allows you to select an audio source and a filter, and the results are reflected in the simulation instantly. For example, selecting a filter changes the RMS pressure. Notice how the corresponding plot in the
SpectrumAnalyzer reflects this change. There is also a Stop button on the UI that ends the simulation. The interaction between the interface and the simulation is performed using UDP.