ita-toolbox an open source matlab toolbox for acousticians

2
ITA-Toolbox – An Open Source MATLAB Toolbox for Acousticians Pascal Dietrich, Martin Guski, Martin Pollow, Markus M¨ uller-Trapet, Bruno Masiero, Roman Scharrer, Michael Vorl¨ander Institute of Technical Acoustics, RWTH Aachen University, Neustraße 50, 52056 Aachen Website: http://www.ita-toolbox.org — Email: [email protected] Introduction Recently, a toolbox for MATLAB has been developed to solve common post-processing tasks in the field of acous- tic research, including data import and export as well as different graphical representations of the data. This toolbox has also been successfully applied to laboratory exercises and measurement tasks within the institute as well as at partner universities, as already published by the authors [1, 2, 3]. In the past, a license was available only for academic and/or educational purpose, exclud- ing potential users from the industry. In 2011 the con- ditions for using the ITA-Toolbox were changed to an open-source license in order to provide a larger audience with the taylor-made framework for acoustical signal pro- cessing in MATLAB. Concept – Object Orientation Acoustical measurement or simulation data is commonly stored numerically in vector or matrix format. Associ- ated with the data is the need to store meta information, e.g. sampling rates, comments, coordinates, domain or physical units. Programming a container for all these different types of data can be realized efficiently by using the concept of object-orientated programming (OOP). Even if still not very common, new versions of MATLAB support the basic concepts of OOP. Based on the need to itaValue a. a.channelCoordinates a.display binaural = music*HRTF FRF = measurement/sweep Figure 1: Object-orientation for the ITA-Toolbox using MATLAB. calculate with physical symbols including their physical unit a class called itaValue has been developed. The objects of the class store the value along with a physi- cal unit. It is capable of calculating values and units for multiplication and division of two variables. Coordinates are a good example to show the benefit of using OOP for transformation purposes, e.g. from cartesian to cylindri- cal or spherical coordinates or vice versa. The object stores the data along with the information of the domain it is stored in (itaCoordinates). By simply using .cart for cartesian or .sph for spherical representation the data is converted according to its current and the target rep- resentation. Audio data is commonly much more complicated than single values or coordinates. The same concept is there- forused and extended towards a class called itaAudio that stores equidistantly sampled audio data from mea- surements or simulations in either time or frequency do- main. The time domain data can always be accessed by .time and the frequency data by .freq. The according time stamps or the frequency vector for plots are cal- culated by .timeVector and .freqVector respectively. Furthermore, simple mathematical operations, e.g. mul- tiplication (*), division (/), summation and subtraction (+,-) are implemented for these audio objects. This en- ables the user to directly write formulation in a text book manner. Hence, multiplications and divisions are realized in the frequency domain. Some basic syntax can be seen in Figure 1, Figure 2 show OOP as one of the of the fundamental concepts. www.ita-toolbox.org windows|mac os|linux Import&Export Measurement/Simulation LMS Virtual Lab, BK Pulse, ArtemiS, Sysnoise, MonkeyForest, ANSYS Universal File Format, ASCII OOP Metadata units, sampling rate Classes itaAudio / itaResult Overloaded Operators + – * / ’ .’ Knowledge Documentation in-line help HTML and PDF Tutorial demos, test routines Data IO PortAudio/playrec Playback / Record Acoustic Measurement MIDI, RS232 Processing Convolution Filtering/Windowing Levels dB(A)/dB(C) Transformations STFT/cepstrum/hilbert Plots/GUI Time/Frequency GLE (export) Geometry/Mesh Balloon–Directivity Parametric GUI script-based generator Figure 2: Overview of the functionality of the ITA-Toolbox for MATLAB. DAGA 2012 - Darmstadt 151

Upload: others

Post on 17-Apr-2022

50 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ITA-Toolbox An Open Source MATLAB Toolbox for Acousticians

ITA-Toolbox – An Open Source MATLAB Toolbox for Acousticians

Pascal Dietrich, Martin Guski, Martin Pollow, Markus Muller-Trapet,Bruno Masiero, Roman Scharrer, Michael Vorlander

Institute of Technical Acoustics, RWTH Aachen University, Neustraße 50, 52056 Aachen

Website: http://www.ita-toolbox.org — Email: [email protected]

Introduction

Recently, a toolbox for MATLAB has been developed tosolve common post-processing tasks in the field of acous-tic research, including data import and export as wellas different graphical representations of the data. Thistoolbox has also been successfully applied to laboratoryexercises and measurement tasks within the institute aswell as at partner universities, as already published bythe authors [1, 2, 3]. In the past, a license was availableonly for academic and/or educational purpose, exclud-ing potential users from the industry. In 2011 the con-ditions for using the ITA-Toolbox were changed to anopen-source license in order to provide a larger audiencewith the taylor-made framework for acoustical signal pro-cessing in MATLAB.

Concept – Object Orientation

Acoustical measurement or simulation data is commonlystored numerically in vector or matrix format. Associ-ated with the data is the need to store meta information,e.g. sampling rates, comments, coordinates, domain orphysical units. Programming a container for all thesedifferent types of data can be realized efficiently by usingthe concept of object-orientated programming (OOP).Even if still not very common, new versions of MATLABsupport the basic concepts of OOP. Based on the need to

itaValue

a.a.channelCoordinates

a.display

binaural = music*HRTFFRF = measurement/sweep

Figure 1: Object-orientation for the ITA-Toolbox usingMATLAB.

calculate with physical symbols including their physicalunit a class called itaValue has been developed. Theobjects of the class store the value along with a physi-cal unit. It is capable of calculating values and units formultiplication and division of two variables. Coordinatesare a good example to show the benefit of using OOP fortransformation purposes, e.g. from cartesian to cylindri-

cal or spherical coordinates or vice versa. The objectstores the data along with the information of the domainit is stored in (itaCoordinates). By simply using .cart

for cartesian or .sph for spherical representation the datais converted according to its current and the target rep-resentation.

Audio data is commonly much more complicated thansingle values or coordinates. The same concept is there-forused and extended towards a class called itaAudio

that stores equidistantly sampled audio data from mea-surements or simulations in either time or frequency do-main. The time domain data can always be accessed by.time and the frequency data by .freq. The accordingtime stamps or the frequency vector for plots are cal-culated by .timeVector and .freqVector respectively.Furthermore, simple mathematical operations, e.g. mul-tiplication (*), division (/), summation and subtraction(+,-) are implemented for these audio objects. This en-ables the user to directly write formulation in a text bookmanner. Hence, multiplications and divisions are realizedin the frequency domain. Some basic syntax can be seenin Figure 1, Figure 2 show OOP as one of the of thefundamental concepts.

www.ita-toolbox.org

windows|mac os|linux

Import&Export

Measurement/SimulationLMS Virtual Lab, BK Pulse, ArtemiS, Sysnoise, MonkeyForest, ANSYSUniversal File Format, ASCII

OOP

Metadataunits, sampling rate

ClassesitaAudio / itaResult

Overloaded Operators+ – * / ’ .’

Knowledge

Documentationin-line helpHTML and PDF

Tutorialdemos, test routines

Data IO

PortAudio/playrecPlayback / RecordAcoustic Measurement

MIDI, RS232

Processing

ConvolutionFiltering/WindowingLevels dB(A)/dB(C)TransformationsSTFT/cepstrum/hilbert

Plots/GUI

Time/FrequencyGLE (export)

Geometry/MeshBalloon–Directivity

Parametric GUIscript-based generator

Figure 2: Overview of the functionality of the ITA-Toolboxfor MATLAB.

DAGA 2012 - Darmstadt

151

Page 2: ITA-Toolbox An Open Source MATLAB Toolbox for Acousticians

Functionality

The basic functionality is shown in Figure 2 divided intodifferent groups, with the concept of OOP already ex-plained. The remaining circles are described in clockwisedirection: the import and export routines are summa-rized in two functions ita read and ita write that arecapable of reading and writing common data formats,e.g. .wav, .uff, .unv, .csv, .mat. The import rou-tine automatically searches for meta data and integratesthis information into the audio objects. Once data isstored in the itaAudio format various plot routines aredirectly available by using, e.g. .plot freq, .plot time

and .plot spectrogram for frequency, time and spectro-gram domain plots as shown in Figure 3. Additionally,some basic GUIs to import data into the ITA-Toolboxformat are shown. For post processing of the data sev-eral standard routines are available. The advantage ofusing m-files of the ITA-Toolbox lies in the meta datastored along with the audio data. There is no need tospecify the sampling rate when filtering the data, as it isautomatically read from the object itself. All functions,methods and properties of the classes can be accessedvia the command line of MATLAB, with direct access todata in both time and frequency domain always possiblewithout explicit Fourier transform.

%% Read from HDD (data included in ITA−Toolbox)h = ita read('loudspeaker response raw.ita');% plot the frequency domainh.plot freq

%% Generate a nice standard sweeps = ita generate sweep();

%% Adapt the sweep to your needss = ita generate sweep('freqRange',[30 16000]);% or (these options appear in pairs)s = ita generate sweep('mode','linear');

%% get the compensation for the sweepcomp = ita invert freq(s,[30 16000])% or with an extra filter (this parameter is bool)comp = ita invert freq(s,[30 16000],'filter')

%% calculate the ideal impulse responseh = s * comp;

In order to enable a quick and easy start with the ITA-Toolbox some basic MATLAB knowledge is beneficial.An introductory tutorial comes as a MATLAB m-file andalso as HTML using MATLAB’s new help functionality.Each section starts with an explanation and is followedby an example that can be run out of the box. User tasksare included to directly apply the new approach hands-on. Additionally a Getting Started PDF document isincluded to explain basic concepts and syntax for newITA-Toolbox users.

Interfaces are available for simultaneous multi-channelaudio recording and playback realized using playrec andPortAudio and MIDI sysex communication via RTmidi.

Users of the ITA-Toolbox can easily implement measure-ment or post-processing tasks in a script-based manner.There is some additional support for so called Applica-

a.bar

a.plot_freq_phase

a.plot_spectrogram ita_toolbox_gui

a.plot_time_dB

a = ita_read

ita_filter_fractional_octaves

-1.0

-0.5

0.0

0.5

1.0

Amplitud

e

0 0.005 0.01 0.015 0.02 0.025 0.03

Time in seconds

Time Window [1]Time Window [1]LS with reflecting floor [Pa]

ita_time_window

GLE export

Figure 3: Various standard plots and basic GUI functionalityalong with the corresponding simple command line syntax.

tions. Applications use the kernel functions but extendthe functionality, e.g. by room acoustic parameter calcu-lation or psychoacoustic evaluation. These applicationsoften regard the specific scientific work and are thus notincluded in the open-source version. Nevertheless, usersare encouraged to write their own applications for in-house application only or in order to contribute to theproject.

System requirements and License

A copy of the ITA-Toolbox can be downloaded atwww.ita-toolbox.org. It is published under the origi-nal BSD-License, allowing the free use of the software,any modifications and the usage in commercial or non-commercial software, as long as credits to our institutionare given. The ITA-Toolbox is compatible with any oper-ating system running MATLAB R2010a or higher. Thesignal processing toolbox is required for spectral band-bass or fractional octave band filtering and time windows.

Acknowledgments

The authors would like to thank the co-workers at the Insti-tute of Technical Acoustics and all users of the ITA-Toolboxfor their valuable feedback and contributions. Special thanksto Dr. Swen Muller and Dr. Gottfried Behler for discussionsabout signal processing and measurements.

References

[1] P. Dietrich, B. Masiero, M. Muller-Trapet, M. Pollow, andR. Scharrer, “MATLAB-Toolbox zum Verstandnis dig-italer Messtechnik und Signalverarbeitung – MATLABToolbox for the Comprehension of Acoustic Measure-ment and Signal Processing,” in Fortschritte der Akustik– DAGA, 2010.

[2] P. Dietrich, B. Masiero, R. Scharrer, M. Muller-Trapet,M. Pollow, and M. Vorlander, “Application of the MAT-LAB ITA-Toolbox: Laboratory Course on Cross-talk Can-cellation,” in Fortschritte der Akustik – DAGA, 2011.

[3] S. Paul and P. Dietrich, “Measurements of electrical trans-fer characteristics of soundcards as classroom activity,” inASA meeting, San Diego, no. 2aEDa11. ASA, 2011.

DAGA 2012 - Darmstadt

152