2
MATLAB Toolbox for the Comprehension of Acoustic Measurement and Signal Processing Pascal Dietrich, Bruno Masiero, Martin Pollow, Roman Scharrer, Markus M¨ uller-Trapet Institute of Technical Acoustics, RWTH Aachen University, 52056 Aachen, Germany Email: [email protected] Introduction A platform-independent MATLAB toolbox called ITA-Toolbox is presented that offers functionality for a wide range of acoustic measurement and signal processing tasks. Students have access to the source code of most functions which enables them to follow and comprehend all parts of the signal processing chain. Using MATLAB scripts based on the ITA-Toolbox func- tions and the special data structure, signal processing tasks can be fully automated. This allows students to perform tasks like measuring directivities or calculating reverberation times and acoustic source power. Meta data like physical units, channel names and sampling rates are always kept consistent. In order to facilitate the use of the toolbox, a modular graphical user interface based on the command line functions was developed as well. Object-Oriented Programming To make MATLAB code generation as easy as possi- ble, the ITA-Toolbox is designed to provide an intu- itive handling. With MATLAB’s rather new feature of object-oriented programming it is possible to structure data and methods to encapsulated class objects (such as audio data, measurement settings, spatial information) giving them an intelligent behavior. Simple and known built-in routines and operators of MATLAB can be rede- fined specifically for that class by overloading their func- tions (polymorphism) [1]. The ITA-Toolbox thus defines specific operators for time and frequency domain (e.g., * for frequency multiplication and .* for time multipli- cation), as well as well-known MATLAB function names (such as plot, mean, conj) for various kind of objects. A further benefit of object-oriented programming is en- hanced structure for the entire software project. New data types can be introduced and the functionality added without the need of large modifications in the exist- ing code (inheritance). Nevertheless, students using the ITA-Toolbox can focus on their actual work, as the ab- stract programming concepts are transparent and do not need to be fully understood to allow the student to work with the ITA-Toolbox . Graphical User Interface In addition to the usual MATLAB command line usage, a graphical user interface (GUI) lightens the first experi- ences with MATLAB, the ITA-Toolbox , and signal pro- cessing itself. The GUI consists of a main window, dis- playing the current signal in the selected domains and a menu, which gives access to the most common signal pro- cessing routines. The GUI uses the standard MATLAB user workspace. All audio objects in the user workspace can be displayed and further processed. The results will be saved back to the user workspace. This usage of the user workspace enables the students to work with a com- bination of a graphical user interface and the command line. Switching between both handling methods when- ever necessary or wanted is seamless and eases the stu- dents adaption to the ITA-Toolbox . The input parameters of signal processing functions are retrieved in a parametrized interface, making it easy for students to generate a GUI for their own routines, like the one in Fig. 1. Only required inputs and options need to be defined, all the rest (including GUI generation, data- type verification and compatibility checks) is handled by a parametric GUI routine. Figure 1: Example of a parametric GUI window Application in Acoustics Laboratory The ITA-Toolbox is gradually replacing older measure- ment systems used on laboratory and exercise courses offered at ITA with the advantage that students have di- rect access to the data being processed, e.g. while mea- suring transfer functions [2]. Since MATLAB code does not require compilation, the ITA-Toolbox is a very com- fortable framework to provide the students with scripts missing important parts. First the students have to com- plete the missing parts of the script to later use it for the tasks required in the courses. An example where the toolbox has been successfully used is the new experiment on binaural hearing offered since winter semester 2009 as part of the laboratory course on technical acoustics. At this experiment the students are presented to the principles of binaural hearing through the analysis of head related transfer functions (HRTFs) DAGA 2010 - Berlin 517

MATLAB Toolbox for the Comprehension of Acoustic ...pub.dega-akustik.de/DAGA_2010/data/articles/000433.pdf · a wide range of acoustic measurement and signal processing tasks. Students

  • Upload
    ledan

  • View
    226

  • Download
    1

Embed Size (px)

Citation preview

Page 1: MATLAB Toolbox for the Comprehension of Acoustic ...pub.dega-akustik.de/DAGA_2010/data/articles/000433.pdf · a wide range of acoustic measurement and signal processing tasks. Students

MATLAB Toolbox for the Comprehension of

Acoustic Measurement and Signal Processing

Pascal Dietrich, Bruno Masiero, Martin Pollow, Roman Scharrer, Markus Muller-TrapetInstitute of Technical Acoustics, RWTH Aachen University, 52056 Aachen, Germany

Email: [email protected]

Introduction

A platform-independent MATLAB toolbox calledITA-Toolbox is presented that offers functionality fora wide range of acoustic measurement and signalprocessing tasks. Students have access to the sourcecode of most functions which enables them to followand comprehend all parts of the signal processing chain.Using MATLAB scripts based on the ITA-Toolbox func-tions and the special data structure, signal processingtasks can be fully automated. This allows students toperform tasks like measuring directivities or calculatingreverberation times and acoustic source power. Metadata like physical units, channel names and samplingrates are always kept consistent. In order to facilitatethe use of the toolbox, a modular graphical user interfacebased on the command line functions was developed aswell.

Object-Oriented Programming

To make MATLAB code generation as easy as possi-ble, the ITA-Toolbox is designed to provide an intu-itive handling. With MATLAB’s rather new feature ofobject-oriented programming it is possible to structuredata and methods to encapsulated class objects (such asaudio data, measurement settings, spatial information)giving them an intelligent behavior. Simple and knownbuilt-in routines and operators of MATLAB can be rede-fined specifically for that class by overloading their func-tions (polymorphism) [1]. The ITA-Toolbox thus definesspecific operators for time and frequency domain (e.g.,* for frequency multiplication and .* for time multipli-cation), as well as well-known MATLAB function names(such as plot, mean, conj) for various kind of objects.

A further benefit of object-oriented programming is en-hanced structure for the entire software project. Newdata types can be introduced and the functionality addedwithout the need of large modifications in the exist-ing code (inheritance). Nevertheless, students using theITA-Toolbox can focus on their actual work, as the ab-stract programming concepts are transparent and do notneed to be fully understood to allow the student to workwith the ITA-Toolbox .

Graphical User Interface

In addition to the usual MATLAB command line usage,a graphical user interface (GUI) lightens the first experi-ences with MATLAB, the ITA-Toolbox , and signal pro-cessing itself. The GUI consists of a main window, dis-

playing the current signal in the selected domains and amenu, which gives access to the most common signal pro-cessing routines. The GUI uses the standard MATLABuser workspace. All audio objects in the user workspacecan be displayed and further processed. The results willbe saved back to the user workspace. This usage of theuser workspace enables the students to work with a com-bination of a graphical user interface and the commandline. Switching between both handling methods when-ever necessary or wanted is seamless and eases the stu-dents adaption to the ITA-Toolbox .

The input parameters of signal processing functions areretrieved in a parametrized interface, making it easy forstudents to generate a GUI for their own routines, like theone in Fig. 1. Only required inputs and options need tobe defined, all the rest (including GUI generation, data-type verification and compatibility checks) is handled bya parametric GUI routine.

Figure 1: Example of a parametric GUI window

Application in Acoustics Laboratory

The ITA-Toolbox is gradually replacing older measure-ment systems used on laboratory and exercise coursesoffered at ITA with the advantage that students have di-rect access to the data being processed, e.g. while mea-suring transfer functions [2]. Since MATLAB code doesnot require compilation, the ITA-Toolbox is a very com-fortable framework to provide the students with scriptsmissing important parts. First the students have to com-plete the missing parts of the script to later use it for thetasks required in the courses.

An example where the toolbox has been successfully usedis the new experiment on binaural hearing offered sincewinter semester 2009 as part of the laboratory course ontechnical acoustics. At this experiment the students arepresented to the principles of binaural hearing throughthe analysis of head related transfer functions (HRTFs)

DAGA 2010 - Berlin

517

Page 2: MATLAB Toolbox for the Comprehension of Acoustic ...pub.dega-akustik.de/DAGA_2010/data/articles/000433.pdf · a wide range of acoustic measurement and signal processing tasks. Students

Laboratory

Measurement/SimulationLMS Virtual Lab, BK PulseSysnoise, MonkeyForestUniversal File Format; ASCII.dat, .spk, .mat, .csv, .uff, .unv, .wav

Import Data/Results/GeometryUniversal File Format, CSV,Wave, mp3, PDF (3D), native MATLAB[Measurement Reports]

Export

Audio/TP/GeometryTime History, Cmplx.Spectrum,Spectrogram, CepstrumDirectivitiy/Balloon/IsobarPlot2D-DistributionWebCam

Plots

Parametric GUI concept:Modular Enhancement of Command-Line Functions

Main Window: Connecting Modular GUIs and Plot Routines

GUI

PortAudio/PortMediaASIO/CoreAudio/ALSAMeasurement/StimulusContinious Level Meter

Audio IO

Signals/TP/CoordinatesExcitation Signals:Sweep/MLSImpedances:Loudspeaker,Plate Two-Port:Mass-Spring-DamperRoom Impulse ResponsesGeometry/Mesh

Synthesis

Hardware/Motor ControlRS232 Communication:Turntable/Arm, X-Y-BenchBK Nexus, Laser VibrometerMIDI Communication:Preamp/Amp/ModulITA

Remote

OperatorsClassesUnits

Kernel

Transformationnormalized FFTCepstrum, Hilbert

Filtering/WindowingFractional OctavesZero/Minimum-PhaseShelving/Low-High-Pass

CalibrationMeasurement ChainsPistonphone/SensorsBroadband/LatencyActuator Compensation

Directivityspherical/cylindricalharmonic calculation

Level/ShapingLoudnessdB(A)/dB(C)

PlatformsWindows,Linux,Mac OS X

www.akustik.rwth-aachen.de/toolbox

Applications

deve

loper

user

Loudspeakerel.Impedance/Two-PortThiele-Small ParametersEquivalent Circuit Diagram

Room Acoustics ISO 3382, Reverberation TimeClarity, Definition, IACC

Sound PowerFree-FieldReverberation Chamber

Acoustic ImpedanceKundt’s TubeIn-Situ: p-u/p-p

Source LocalizationBeamforming, NAHSurface Velocity

Laboratory on AcousticsScripts to be completed by students:Sound Power Calculation3 Microphone Kundt’s TubeFilter Design/CTC

Binarual ProcessingAuditory ModelHRTF, CTC

Figure 2: Structural overview of the ITA-Toolbox and its functionality, divided into developer section (functions maintainedby developers) and user section with applications (using the basic functionality provided, thus leading to an intuitive scriptingon a high abstraction layer).

and of binaural reproduction through the concept ofcrosstalk cancellation filters (CTC).

The ITA-Toolbox is used by students in all tasks of thisexperiment. First, the main GUI is used to measure theHRTF of a dummy head in several directions which isused later on. A comparison of the measured HRTF intime and frequency domain by supplied transformationand plotting routines helps to understand the effects onvariation of the incidence angle. In a second task thestudents are required to complete three scripts in orderto a) calculate the CTC filters, b) filter a binaural signalwith a CTC filter and c) estimate the achievable chan-nel separation. By using the object-oriented frameworkprovided, scripts can be written in a compact and intu-itive manner. Once the codes are complete, the studentsapply them to the measured HRTFs to first obtain aCTC filter. They then filter a given binaural signal withthe computed CTC filter and play it back through theITA-Toolbox , thus being able to subjectively analyze theCTC filter designed.

Other examples of applications are an experiment withthe Kundt’s tube and an experiment about wall isolation.In both cases the multichannel measurement allows forfast data acquisition and students have to complete the

codes for data processing, gaining a broader knowledgeabout the subject under study. The toolbox is also usedby students during their bachelor and master projectsfor a wide range of measurement and signal processingapplications, as presented in Fig. 2.

Acknowledgment

The authors would like to thank Prof. Michael Vorlanderand Dr. Gottfried Behler for their support. Furthermore,the discussions with Dr. Swen Muller [3] are highly ap-preciated. PortMusic and playRec were used to realizestable audio data acquisition with MATLAB.

References

[1] Register, A. H.: A Guide to MATLAB Object-Oriented Programming. Chapman & Hall/CRC, 2007

[2] Fingerhuth, S.; Dietrich, P. and Kaldenbach, R.:Mess-’Blackbox’ zum Verstandnis des Ubertragungs-verhaltens und der akustischen Messtechnik,Fortschritte der Akustik - DAGA, 2010

[3] Muller, S. and Massarani, P.: Transfer-Function Mea-surement with Sweeps. Journal of the Audio Engi-neering Society, 2001

DAGA 2010 - Berlin

518