Headphones measurement tool implemented in...

5
POSTER 2015, PRAGUE MAY 14 1 Headphones measurement tool implemented in Matlab Jaroslav Bouse Dept. of Radioelectronics, Czech Technical University in Prague, Technick´ a 2, 166 27 Praha, Czech Republic [email protected] Abstract. Headphones are widely used in psychoacous- tics’ experiments. To maintain flat frequency response of the headphones, the measurement of them is required. In this study a tool to measure headphones is presented. The tool was tested on the measurement of the Sennheiser HD 650 headphones, which results are included in this study. Keywords Headphones, measurement, tool, Sennheiser, HD 650, artificial ear, Matlab 1. Introduction Headphones are widely used in psychoacoustics’ ex- periments [1]. Notable use of headphones is in binaural lis- tening scenarios [2], where they allow the experimenter to examine just one localization cue without interference from the others. For example, experimenter can observe local- ization based on interaural level differences, without inter- ference of interaural time differences and monaural filtering cues, which could not be achieved by use of loudspeakers. The issue is, how to present to the listener approxi- mately the same sensation level across the audible frequency range using the headphones. It was partly resolved by in- troducing the first models of artificial ear, which had similar acoustical impedance as the human ear [3]. The artificial ear provides the experimenters useful and replicable tool to calibrate headphones in order to maintain flat frequency re- sponse, e.g. in audiometry [4]. However, for some type of experiments, e.g. externalization of a virtual sound [5], the most accurate method is still to measure the headphones’ fre- quency response directly near the listener’s eardrums using probe microphones. In this study we present a headphones measurement tool implemented in MATLAB. The tool is universal by the mean that it can be used to measure directly on human listener or on artificial ear. It employs MATLAB’s built in ASIO/ALSA dsp output, which assures that the output sound will not be affected by the operating system. Thus only MATLAB can affect the signal, but as our future experiments will be implemented in the same enviroment, we can assume that any affection will cancel itself. We used the tool to mea- sure Sennheiser HD 650 headphones, the results are shown in the last section of the article and will be used in future psychoacoustics/audiometry experiments. 2. Structure of the measuring algorithm The algorithm was implemented in MATLAB and for the convenience of the user, the graphical user inter- face(GUI) was made (see Fig. 1). Description of this algo- rithm can be divided into two distinct blocks: obtaining the microphone conversion constant between acoustic pressure and the recorded digital value, and headphone measurement itself. Both blocks are described in the following subsec- tions. Fig. 1. A screenshot of the headphone measurement tool. On the top can be seen parameters of the measurement, in the middle recorded pistonphone signal and on the bottom measured frequency response of the headphones.

Transcript of Headphones measurement tool implemented in...

Page 1: Headphones measurement tool implemented in …radio.feld.cvut.cz/conf/poster2015/proceedings/Section...POSTER 2015, PRAGUE MAY 14 1 Headphones measurement tool implemented in Matlab

POSTER 2015, PRAGUE MAY 14 1

Headphones measurement tool implemented in Matlab

Jaroslav Bouse

Dept. of Radioelectronics, Czech Technical University in Prague, Technicka 2, 166 27 Praha, Czech Republic

[email protected]

Abstract. Headphones are widely used in psychoacous-tics’ experiments. To maintain flat frequency response of theheadphones, the measurement of them is required. In thisstudy a tool to measure headphones is presented. The toolwas tested on the measurement of the Sennheiser HD 650headphones, which results are included in this study.

KeywordsHeadphones, measurement, tool, Sennheiser, HD 650,artificial ear, Matlab

1. IntroductionHeadphones are widely used in psychoacoustics’ ex-

periments [1]. Notable use of headphones is in binaural lis-tening scenarios [2], where they allow the experimenter toexamine just one localization cue without interference fromthe others. For example, experimenter can observe local-ization based on interaural level differences, without inter-ference of interaural time differences and monaural filteringcues, which could not be achieved by use of loudspeakers.

The issue is, how to present to the listener approxi-mately the same sensation level across the audible frequencyrange using the headphones. It was partly resolved by in-troducing the first models of artificial ear, which had similaracoustical impedance as the human ear [3]. The artificialear provides the experimenters useful and replicable tool tocalibrate headphones in order to maintain flat frequency re-sponse, e.g. in audiometry [4]. However, for some type ofexperiments, e.g. externalization of a virtual sound [5], themost accurate method is still to measure the headphones’ fre-quency response directly near the listener’s eardrums usingprobe microphones.

In this study we present a headphones measurementtool implemented in MATLAB. The tool is universal bythe mean that it can be used to measure directly on humanlistener or on artificial ear. It employs MATLAB’s built inASIO/ALSA dsp output, which assures that the output soundwill not be affected by the operating system. Thus onlyMATLAB can affect the signal, but as our future experimentswill be implemented in the same enviroment, we can assume

that any affection will cancel itself. We used the tool to mea-sure Sennheiser HD 650 headphones, the results are shownin the last section of the article and will be used in futurepsychoacoustics/audiometry experiments.

2. Structure of the measuring algorithmThe algorithm was implemented in MATLAB and

for the convenience of the user, the graphical user inter-face(GUI) was made (see Fig. 1). Description of this algo-rithm can be divided into two distinct blocks: obtaining themicrophone conversion constant between acoustic pressureand the recorded digital value, and headphone measurementitself. Both blocks are described in the following subsec-tions.

Fig. 1. A screenshot of the headphone measurement tool. On thetop can be seen parameters of the measurement, in themiddle recorded pistonphone signal and on the bottommeasured frequency response of the headphones.

Page 2: Headphones measurement tool implemented in …radio.feld.cvut.cz/conf/poster2015/proceedings/Section...POSTER 2015, PRAGUE MAY 14 1 Headphones measurement tool implemented in Matlab

2 J. Bouse, Headphones measurement tool implemented in Matlab

2.1. Pistonphone measurement

In the first step of the algorithm we need to find a con-version constant between an acoustic sound pressure level(SPL) and its digital value. We expect the use of measur-ing microphones (flat pressure frequency response), thus wecan assume that the conversion constant is frequency inde-pendent. Second assumption is that the analog-digital (A/D)conversion is a linear process. In such case we can use pis-tonphone, an acoustic source with defined pressure at singlefrequency, record its signal and calculate the conversion con-stant. The time representation of the pistonphone’s signalcan be seen in the GUI. In case of some observable distor-tion, user can select just a part of the record.

For further processing we calculate the amplitude of therecorded signal. We assume the signal is harmonic, thus theamplitude can be calculated from the root mean square valuemultiplied by square of two:

Ap =

√√√√2

N∑n=1

yp(n)

N, (1)

where Ap is calculated piston phone?s amplitude, yp is therecorded piston fon signal, n sample number and N over-all number of samples. Calculating the amplitude from theMRS value has its advantage that it is resistant to impulsenoise and can help to detect limitation at the input of ADconverter. With the amplitude we can calculate the conver-sion constant:

k =Ap

20spp010Lp, (2)

where Ap is the amplitude of pistonphone (from Eq. 1), spis the sensitivity of the microphone preamplifier in V/Pa, p0the reference sound pressure in Pa and Lp is defined soundpressure level of the pistonphone in dB SPL by the manufac-turer.

2.2. Headphone measurement

To measure headphone impulse response, or equivalentfrequency response, we chose a method mentioned in Fa-rina’s article [6]; exponential sweep. However, the proposedMatlab tool is not limited to use only this method.

Generation of the exponential sweep

The exponential sweep function changes its frequencyexponentially with time. Consequently the energy decayswith frequency (about 3dB/oct). The exponential sweep isgenerated according to the following equation [6]

x(t) = As sin

2πf1T

ln(

f2f1

) [e tT ln

(f2f1

)− 1

], (3)

where As is the amplitude of sweep, T is length of thesweep, fs sampling frequency, and f1 and f2 is the lowestand highest measured frequency, respectively. All these pa-rameters of the exponential sweep, except the sampling fre-quency, are accessible to the user through the MATLAB GUI.The user is also able to control the number of transient repe-titions, which can improve signal-to-noise ratio.

Generation of the inverse filter

If we playback the generated exponential sweep (x)through headphones and record the response (y) with micro-phone near the can of the headphone, the record itself doesn’trepresent the impulse response of the headphones (h), but itsconvolution with the sweep

y(t) = x(t) ∗ h(t). (4)

Therefore, we need to construct a proper inverse impulse re-sponse and convolve the record with it. Another option is toprocess the signal in frequency domain that means to con-struct the proper inverse filter(F (f)) and multiply it with theFourier transformed recorded signal (X(f))

The method for a construction of the inverse filter wasintroduced in [7] and is summarized in equation

F (f) =X∗(f)

X∗(f)X(f) + ε(f), (5)

where

ε(f) =

max integer, f ∈ 〈0, f1) ∪

(f2,

fs2

⟩0.000001, f ∈ 〈f1, f2〉 ,

where ε(f) is a small regularization parameter, which is inthe first interval equal to the maximal digital value (dependson the system in use) and ensures that the inversion does notoperate outside the frequency range of the generated sweep.Small value in the second interval prevents division by a nearzero number.

Calculating the frequency response

In Farina’s article [6] was advised to perform the con-volution of the measured signal with the inverse filter in thetime domain. Since the convolution in the time domain canbe very expensive in terms of computation time, we do thisoperation in the frequency domain using circular convolu-tion, which is computationally less demanding (for longersignals) [8]. To obtain the same results as with standard con-volution, we have to prolong both signals by zeros to thelength of L + N − 1, where L and N is the length of thefilter and recorded signal, respectively [8]. The frequencyresponse of the headphones is calculated according to equa-tion

H(f) = F{y(t)

}F (f). (6)

Page 3: Headphones measurement tool implemented in …radio.feld.cvut.cz/conf/poster2015/proceedings/Section...POSTER 2015, PRAGUE MAY 14 1 Headphones measurement tool implemented in Matlab

POSTER 2015, PRAGUE MAY 14 3

Fig. 2. Experimental setup. A - Bruel Kjær Nexus Microphoneconditioner, B - Bruel Kjær Pistonphone type 4220, C -Bruel Kjær artificial ear type 4153

The magnitude spectra in dB SPL is then calculated accord-ing to the following equation

|HSPL(f)| = 20 log10

(As|H(f)|shpok

), (7)

where As is amplitude of generated sweep, sh sensitivity ofthe microphone preamplifier during the headphone measure-ment in V/Pa, p0 the reference sound pressure in Pa and kconversion constant calculated previously in Eq. 2.

3. Experiment: Headphones measure-ment on the artificial ear

The proposed tool was tested by a measurement of theheadphones on an artificial ear. The result of this measure-ment is crucial whether we want use the headphones for theaudiometry and psychoacoustics experiments. We chose tomeasure Sennheiser HD 650 headphones, as they will takeplace in our future experiments as a reference headphones.

Equipment type Model

Artificial ear B&K 4153Computer Standard PCHeadphones Sennheiser HD 650Mic. cartridge in artificial ear B&K 4192Mic. preamplifier B&K NexusPistonphon B&K 4220Sound card RME FIREFACE UCWeight 500 g weight

Tab. 1. List of used equipment during the measurement

3.1. Measurement setup

The measurement was held in a sound insulated boothduring the evening to reduce the noise floor. The IEC 60318-1 compatible artificial ear (Bruel Kjær 4153 with 4192 mi-

crophone) was placed on the test bench together with a mi-crophone conditioner (Bruel Kjær Nexus) connected to mul-tichannel soundcard (RME Fireface UC). The measurementwas controlled by a computer placed outside the booth.

List of all the equipment used during the measurementis presented in the table 1.

3.2. Procedure

The parameters changeable within the GUI, and on mi-crophone preamplifier are all listed in table 2. The parameterf2 was set to 24 kHz, even thought flat frequency responseof the used microphone is ensured only to approximately 20kHz, to reduce artifacts on high frequencies [6].

Parameter Symbol Value

Headphones Mic. sens. sh 3.16 V/PaPiston-phone Mic. sens. sp 31.6 mV/Pa

SPL at 250 Hz Lp 124 dBSweep Amplitude As

f min f1 20 Hzf max f2 24 kHzSamp. freq. fs 48 kHzTrans. averages 1

Tab. 2. List of parameters with values used during the measure-ment

Pistonphone

In the first step of the measurement the upper part ofthe artificial ear was removed and replaced by a piston-phone. The pistonphone was standing tightly around the mi-crophone cartridge (see Fig. 2).

Signal from the pistonphone was then recorded (ap-proximately 5 s long) and saved for the next measurements.

Fig. 3. Experimental setup. A - Bruel Kjær Nexus microphoneconditioner, B - 500g weight, C - measured headphones(Sennheiser HD650), D - Bruel Kjær artificial ear type4153

Page 4: Headphones measurement tool implemented in …radio.feld.cvut.cz/conf/poster2015/proceedings/Section...POSTER 2015, PRAGUE MAY 14 1 Headphones measurement tool implemented in Matlab

4 J. Bouse, Headphones measurement tool implemented in Matlab

Frequency [Hz]20 200 2000 20 000

80

85

90

Mag

nitu

de [d

B S

PL]

80

85

90 Left earphone

Right earphone

Fig.4. Frequency response of the measured headpohones (Sennheiser HD 650), on the top left earphone, on the bottom right ear-phone. Average values of the measured data are depicted with the darker color, their standard deviations with the lightercolor. Red vertical line remarks the frequency point to which the acoustic impedance of artificial ear is defined.

Frequency [Hz]20 200 2000 20 000

Mag

nitu

de [d

B S

PL]

80

82

84

86

88

90

92Left earphoneRight earphone

Fig.5. Average frequency response of the measured headpohones (Sennheiser HD 650). Red vertical line remarks the frequencypoint to which the acoustic impedance of artificial ear is defined.

Headphones

The headphones measurement was performed 15 timesfor each earphone. After every measure the headphones wereremoved from the artificial ear and rearanged, in order toroughly simulate deviation in position of the headphones ona listener’s head. The clamping force of approximately 5 Nwas supplied by a 500 g weight mounted in the top of theearphone. The measurement setup is depicted on Fig. 3.

3.3. Results

In Fig. 4 is depicted the average values of the measureddata (darker colour) and standard deviation across measure-ments (lighter color), for left (top row) and right (bottomrow) headphone’s can. The red vertical line remarks the fre-quency point to which the acoustic impedance of artificialear is defined.

Direct comparison between the left and the right ear-phone’s frequency response is depicted in Fig 5. The inter-channel difference was approximately from 0.5 dB SPL to1.2 dB SPL. This value is actually better than the differ-ence guaranteed by the manufacturer (2 dB). However, ifthe headphones will be used for the experiments includinginteraural level difference (ILD), this interchannel dispari-ties should be corrected, as the human listener can detect thedifference down to 0.4 dB SPL [9].

4. ConclusionA headphone measurement tool implemented in MAT-

LAB were presented in this study. Its function was testedduring the measurement of Sennheiser HD 650 headphoneson artificial ear. The obtained data will be used in psychoa-coustic experiments held at our department.

Page 5: Headphones measurement tool implemented in …radio.feld.cvut.cz/conf/poster2015/proceedings/Section...POSTER 2015, PRAGUE MAY 14 1 Headphones measurement tool implemented in Matlab

POSTER 2015, PRAGUE MAY 14 5

Object of future studies will be obtaining frequencyresponses individually on each listener using probe micro-phones.

AcknowledgementsI would like to thank to Jan Bednar, Libor Husnik,

Frantisek Rund, Dominik Storek and Vaclav Vencovsky.

This work was supported by the Grant Agency ofthe Czech Technical University in Prague, grant No.SGS14/204/OHK3/3T/13.

References[1] J. Blauert and J. S. Allen, Spatial Hearing - The Psychophysics of Hu-

man Sound Localization. Cambridge: MIT Press, rev. ed., 1997.

[2] B. C. J. Moore, An Introduction to the Psychology of Hearing, FifthEdition. Academic Press, Apr. 2003.

[3] P. V. Bruel, E. Frederiksen, and G. Rasmussen, “Artificial ears for thecalibration of earphones of the external type,,” in B&K Technical Re-view Part 1-2 1962/63, Bruel & Kjaer Naerum, Denmark, 1962/63.

[4] S. Gelfand, Essentials of Audiology. Thieme Publishers Series, Thieme,2009.

[5] W. M. Hartmann and A. Wittenberg, “On the externalization of soundimages,” The Journal of the Acoustical Society of America, vol. 99,pp. ASA+, 1996.

[6] A. Farina, “Advancements in Impulse Response Measurements by SineSweeps,” Audio Engineering Society Convention, vol. 122, pp. 4–9,2007.

[7] O. Kirkeby, P. A. Nelson, and H. Hamada, “The ’stereo dipole’: Avirtual source imaging system using two closely spaced loudspeakers,”J. Audio Eng. Soc, vol. 46, no. 5, pp. 387–395, 1998.

[8] L. Rabiner and B. Gold, Theory and application of digital signal pro-cessing. Prentice-Hall signal processing series, Prentice-Hall, 1975.

[9] W. M. Hartmann and Z. a. Constan, “Interaural level differences and thelevel-meter model.,” The Journal of the Acoustical Society of America,vol. 112, no. May 2001, pp. 1037–1045, 2002.

About Authors. . .

Jaroslav Bouse

was born in Prague, Czech Repub-lic in 1988. In 2010 he received hisbachelor diploma from Electronics andTelecommunications program at Fac-ulty of Electrical Engineering (FEE)Czech Technical University (CTU) inPrague. He graduated in the premiumadvanced form of the Communications,Multimedia and Electronics master’s

degree program (a one of 7 students enrolled from total num-ber of 144 students enrolled in the program), focusing onMultimedia Technology, at the same faculty in 2013. He isnow Ph.D. student at the department of radioelectronics atthe same faculty. His research topic is Audio signal process-ing from the psychoacoustic point of view, with the special-ization in spatial hearing models.