PETRDOSTÁLEK,VLADIMÍRVAŠEK,JANDOLINAY DepartmentofAutomationandControlEngineering TomasBataUniversityinZlín,FacultyofAppliedInformatics NadStráněmi4511,76005Zlín CZECHREPUBLIC {dostalek;vasek;dolinay}@fai.utb.czhttp://www.fai.utb.cz Abstract: PaperdealswithacousticsourcelocalizationusingmicrophonearrayusingtimeCdelayestimationmethod.It describesmainrequirements,hardwaredesignofthemicrophoneunitswithautomaticgaincontrolpreamplifierswith integratedantiCaliasingfiltersandfinallyitsconnectiontostandardpersonalcomputerequippedwithAdvantechPCIC 1716 multifunction data acquisition card. Next part of the paper describes timeCdelay estimation method of the direction of arrival of the sound wave and its software implementation for realCtime evaluation. Created software applicationforaudiodataanalysisanddirectionofarrivalcomputationsprovidesuserCfriendlygraphicaluserinterface whichisabletovisualizerecordedsoundwavesandfrequencyspectrainsoundanalyzermodeanddirectionofarrival ofsoundwaveinlocatormode.Allacquireddatafrommicrophoneunitscanbesavedtothestandarduserspecifiable wavfilesforfurtherinvestigationandanalysis. Key Words: audiosourcelocalization,microphonearray,directionofarrival,timeCdelayestimation. The first device designed by human for audio localization was created in 1880 by Professor Mayer. Thisinstrument for navigation improvement infog was calledbyitsauthorMayer’stopophone.Onthebasisof its construction originate number of similar devices but withquestionablepracticalusage.Thebiggestinterestin audio location systems occurs in the period between World War 1 and World War 2. They were primarily used for detection a localization of the aircraft engine sound. Measured data about aircraft position was directlytransferredtoairCdefenseartillerywhichcanaim at target before visual contact. Constructions and dimensions of these systems were very various but the basicconceptisbasedonMayer’stopophoneimproved with next two horns oriented in vertical plane. Due to state of electronics then minimally two people were requiredforsoundanalysisoriginatedfromhornsystem. Since it was impossible to continuously enlarge horn dimensions for better gain achieving, static dishes and walls based on spherical reflection surface was developed.Thesesystemswereabletodetectaircraftsat longer distances. After radio locator invention in 1934 audiolocationdeviceswerenotfurtherdevelopedinthis areabecausetheywerecompletelyreplacedbyRADAR systemswithbetterdetectionandrangingproperties[4]. Nowadays very dynamical development in electronics and computer science enables applying of the sound localization systems in areas where it was impossible due to technical and economical aspects several years ago. These areas include applications in security, teleconferencing, robotic systems and other else where information is coded in audio signal source position. Thispaperdealswithbothdesignoftheinputpartofthe eachlocalizationsystemwhichissensorysystembased on microphone array and software implementation of detectionalgorithms.Firstpartdescribescircuitsolution ofthemicrophonepreampunits,automaticgaincontrol amplifier and output antiCaliasing filter which are necessary for signal conditioning to correct voltage levelsbeforeanalogCtoCdigitalconversionprocessindata acquisition card. Second part of the paper describes timeCdelayestimationmethodofthedirectionofarrival ofthesoundwaveanditssoftwareimplementation. Microphonesensorysystemwasdesignedwitharespect toeasyportability,configurabilityandconnectivitywith evaluation unit.These requirements best fulfill modular architectureschematicofwhichisdepictedinfigure1.It consists of the following main components: three microphoneunitswithintegratedpreamplifier,3Cchannel automaticgaincontrol(AGC)amplifierwithoutputantiC aliasingfilterandevaluationunit–inthiscasestandard personal computer equipped with multifunction AdvantechPCIC1716dataacquisitioncard.Components are connected together with shielded cables to avoid interference leakage to acquired signal. In case of need systemcanbeupgradedupto16audiochannelsperone dataacquisitioncard. Proceedings of the 13th WSEAS International Conference on CIRCUITS ISSN: 1790-5117 141 ISBN: 978-960-474-096-3 Fig.1.Blockschematicsofthesensorysystem Sound field is measured with three microphone units each equipped with three omnidirectional electret condenser microphone cartridges. They are installed on the small triangular base from fiberglass cooper coated board with the side size of 20mm. This construction improves sensitivity and signalCtoCnoise ration. Each microphone is connected with summing preamplifier with the gain of 23dB which is mounted inthe baseof themicrophoneunit.Outputsignallevelissufficientfor transmission through shielded cable to distance about 10m.Preamplifierschematicisdepictedinthefigure2. It is build around lowCnoise dual operational amplifier NE5532. First stage is 3Cchannel inverting summing amplifierwithgainof10followedbyinvertingamplifier with gain of 1.5. Input part of preamplifier includes simplepowersupplyforelectretmicrophonesMCE100 whichisseparatedfromsummingamplifierbycoupling capacitors. Due to usage of nonCsymmetrical voltage source it is necessary to create virtual ground for operational amplifiers using two voltage dividers (parts R 1 , R 2 and R 5 , R 6 ). Photograph of the completed three microphoneunitsisinthefigure3. Fig.2.Microphonepreamplifierschematics Fig.3.Completedmicrophoneunits ! Thispartofthesensorysystemiscomposedoftwomain components: three channel automatic gain control amplifiercombinedwith4 th orderantiCaliasingfilter.The purposeofthislastamplificationstageistoadaptsignal voltagelevelstotheappropriatelevelsuitableforanalog inputsofthedataacquisitioncard.Inthecasethatinput signalhastoohighvoltagelevelthegainoftheamplifier is automatically lowered to prevent overdriving of the card inputs. Function of the amplifier part is obvious fromfigure4.Itusessamedualoperationalamplifieras microphone preamplifier. First stage is inverting amplifier with userCadjustable gain up to 50. Second stage works as comparator which output is near V+ when output voltage is higher then demanded. In this case diode D 1 is opened and capacitor C 4 is charged through resistor R 8 . Rising capacitor voltage opens transistorsT 1 andT 2 whichdrainspartoftheinputsignal toground–gainofthecircuitisautomaticallylowered. On the other hand low input signal level cause comparatoroutputvoltagenearVC.ThendiodeD 1 isin reversedpolarityandcapacitorC 4 isdischargedthrough R 7 toground–transistorsT 1 andT 2 areclosingandgain ofthecircuitisrevertingbacktoitsnominalvalue. Fig.4.AGCamplifier–amplifierpart MU2 MU3 M U1 PC Microphone preamplifier Automaticgaincontrol amplifierwithoutput antiCaliasingfilter Microphoneunit Proceedings of the 13th WSEAS International Conference on CIRCUITS ISSN: 1790-5117 142 ISBN: 978-960-474-096-3 Amplifier stage is followed by 4 th order lowCpass filter with Sallen–Key topology implemented by operational amplifiers(Fig.5). Fig.5.AGCamplifier–filterpart ItisusedasantiCaliasingfilterwhichrestrictsbandwidth of the signal to satisfy sampling theorem. Filter parts was designed using Bessel approximation with cutoff frequencyof20kHzandgainof3dB.Thistypeofthe filter was chosen due to linear curve of the phase characteristic in the wide frequency range and advantageousstepresponsewithsmallovershot.Onthe otherhanditsdrawbackissmallerslopeofthestopCband part of the frequency characteristic in comparison with Chebyshev or Butterworth approximations. Main characteristics of above mentioned 4 th order normalized filters with transfer functions (1), (2) and (3) simulated inMatlab6.5environmentarecomparedinthefigures6 and7. ( ) 5.258 12 11 07 10 731 4 258 5 2 3 4 + + + + = s s s s s G Bessel (1) 1 613 2 414 3 613 2 1 ) ( 2 3 4 + + + + = s s s s s G h Butterwort (2) ( ) 287 0 775 0 484 1 984 0 287 0 2 3 4 + + + + = s s s s s G Chebyshev (3) ! " Fig.6.Filterstepresponsecomparison. # #$ # #$ $ %&' # # #( #) # #* +& ' ,&'& - . !&/ ! " Fig.7.FilterBodefrequencyresponsecomparison. "# $ This method is very often used in microphone sensory systems due to its simple implementation in hardware and software. It is based on audio samples analysis acquired from each microphone unit in an array. Analysis takes place usually in two basic steps – timeC delay determining of each data samples acquired from different microphones following by computation of the soundsourcepositiononthebasisofmicrophonearray geometricalorganization[3]. On assumption that sound source is in much larger distancethaniseachsensorspacingd S ,sphericalsurface ofthesoundwavecanbeconsideredasaflatsurface.It considerably simplifies evaluation of the direction of arrivalofthesoundwave.Thisassumptionandresulting simplificationisobviousfromfigure8. Fig.8.Soundwaveimpactingmicrophonearray. Then sound wave arrival angle α impacting one pairof microphoneunitscanbedeterminedbyequation(4). = S d d arcsin α (4) MIC1 MIC2 Distantsound source α α d d S Proceedings of the 13th WSEAS International Conference on CIRCUITS ISSN: 1790-5117 143 ISBN: 978-960-474-096-3 Difference of the sound wave trajectory Ud can be computed as product of estimated timeCdelay Ut and soundwavespeedc.Arrivalanglecanbethencomputed usingfollowingequation: ⋅ = S d c t arcsin α (5) FortimeCdelayestimation tcanbeveryadvantageously used crossCcorrelation analysis which is defined by equation (6). Where x 1 is acquired signal from microphone 1, x 2 from microphone 2 and N number of acquireddatasamples. [ ] [ ] [ ] ∑ − − = + = 1 0 2 1 2 1 1 ˆ k n x x k n x n x k R (6) During the computation x 1 is reference signal and x 2 compared signal. CrossCcorrelation of two same shifted signals resulting in coefficients representing conformity of these two signals. Maximum value of correlation coefficient and corresponding shift of k samples indicates relative shift of these signals. TimeCdelay t canbecomputedusingformula: [ ] ( ) k R f t x x vz 2 1 ˆ max arg 1 = (7) wheref vz issamplingfrequency. %& $ Sensoryandevaluationsystemfunctionalitywasverified withmicrophonearrayconsistingof3microphoneunits in triangular configuration with size of d S = 1m. Microphone array was connected with evaluation unit represented by standard personal computer equipped with data acquisition card. For realCtime audio data analysisanddirectionofarrivalcomputationwascreated software equipment in MS Visual C++ development environment. % $ ! $ $ ! Evaluation system is based on standard personal computerwithprocessorAMDAthlon64equippedwith multifunctiondataacquisitioncardAdvantechPCIC1716 dedicated for PCI bus interface with full plug and play capability. This card provides sixteen analog inputs in singleCendedoreightanaloginputsindifferentialmode withinputimpedanceof100M .Eachinputisthrough analog multiplexor connected to analogCtoCdigital converterwith16Cbitresolutionandmaximumsampling rate equal to 250 kHz. Integrated FIFO memory with capacity of 1024 samplesenablesefficient data transfer from the card to the system memory without excessive CPU utilization. It is also equipped with two analog outputs, sixteen digital inputs and outputs with TTL compatible logic and finally with 16Cbit timer with referencefrequencyof10MHz[1]. Inputvoltagerangesarefullysoftwareprogrammablein therangesshownintable1.Connectionwithmeasured object is realized via universal screw terminal module ADAMC3968 suitable for DIN rail mounting. Data acquisitioncardisconnectedwithADAMmoduleusing 68CpinshieldedSCSICIIcablePCLC10168C1. Table1.AdvantechPCIC1716inputvoltageranges ' ()* Unipolar N/A 0~10 0~5 0~2.5 0~ 1.25 Bipolar ±10 ±5 ±2.5 ±1.25 ±0.625 % + Softwareapplicationforaudiosignalanalysisandaudio sourceanalysiswascreatedinMicrosoftVisualC++as Win32 application with utilization of MFC library. Program can be divided to the four following logical partsthatperformseachspecializedtasks: C DataacquisitionusingAdvantechPCIC1716driver C Fast Fourier Transform computation using FFTW library C Correlationanddirectionofarrivalcomputation C Datavisualizationandarchivinglayer %# , Advantech provides software support for variety of programming environments and languages including VisualBasic,Delphi,VisualC/C++,BorlandCandC++ Builder.Forhighspeedconversionsduringwhichlarge amount of data are present can be very advantageously used functions utilizing DMA transfers for data acquisition. Due to low CPU utilization during data transfers from buffer to main memory there is enough freecomputingpowerfortasksrelatedtoFFTandcross correlation computations and data visualization. Acquired audio data are stored in raw format to appropriate buffers corresponding to scanned channels fromwheretheyareprocessedbyFFTWlibrary.During the processing stage new data are acquired and transferred by driver using bus master DMA transfer. Due to this operation mode no data are lost even maximumsamplerateischosen. %- Insoundanalyzermodeprogramuseforcomputingthe discrete Fourier transforms FFTWlibrary developedby authors Matteo Frigo and Steven G. Johnson which is releasedundertheGNUGeneralPublicLicense.Library Proceedings of the 13th WSEAS International Conference on CIRCUITS ISSN: 1790-5117 144 ISBN: 978-960-474-096-3 supports both oneCdimensional and multiCdimensional transforms with real or complex input data. Due to SSE/SSE2/3dNow! and Altivec support provides very highprocessingspeed. Usage of the FFTW library is very intuitive – can be splittothesemainsteps: C Memory allocation for input and output arrays (fftw_malloc) C Create a plan containing all data needed for DFT computation (fftw_plan_dft_1d for oneCdimensional DFTwithrealinputdataandcomplexoutputdata) C Startcomputationusingcreatedplan(fftw_execute) C Processcomputeddata C Freetheplan(fftw_destroy_plan) C Freeallocatedmemory(fftw_free) FFTW use its own data type fftw_complex which is defined as array of two double type elements. Element withindex0isrealpartandwithindex1imaginarypart ofcomplexnumber[2]. Inaudiolocatormodeprogramcomputesusingformula (6)crosscorrelationbetweenallmicrophonepairsinthe array.Thenusingequation(7)arecomputedtimeCdelays which are inputs for direction of arrival computation algorithm. %". Main window of the developed application “Audio analyzer” is depicted in the figure 9 (signal analysis modeactivated)andfigure10(locatormodeactivated). Main dialog window integrates all necessary program components. In the main part are seven systems of coordinates for data analysis visualization originating from three independent analog channels. In the bottom part of the window is listCbox which informs about currentprogram status and itssettings. In the right part are placed buttons for program control and configuration. Fig.9.AudioanalyzerSW–signalanalysismode Fig.10.AudioanalyzerSW–locatormode /- Paper deals with acoustic source localization using microphonearrayusingtimeCdelayestimationmethod.It describes main requirements, hardware design of the microphoneunits,preamplifierandfinallyitsconnection tostandardpersonalcomputerequippedwithAdvantech PCIC1716 multifunction data acquisition card. Designed sensory system has modular architecture which enables easy portability, configurability and connectivity with evaluation unit. Developed software application for audio signal acquisition and analysis can work in two modes of operation. In analyzer mode it performs frequency analysis of all active audio channels and visualizesresultsingraphicalforminthemainwindow. Inlocatormodeprogramcomputestimedelaysbetween eachmicrophonepairsandresultingdirectionofarrival presentsinpolargraph. 01! The work was performed with financial support of researchprojectMSM7088352102.Thissupportisvery gratefullyacknowledged. References: [1] Advantech, PCI 1716 250kS/s, 16 bit High Resolution Multifunction Card ,2001.Availablefrom WWW:http://www.advantech.com [2]Frigo,M.,Johnson,S.G., FFTW3 ,2006.Available fromWWW:http://www.fftw.org/#documentation [3] Rajmic, P., Prostá metoda časových posunů a modifikovaná metoda časových posunů pro detekci směru přicházejícího zvuku , 2002. Available from WWW:http://www.elektrorevue.cz [4] Self. D., Acoustic Location and Sound Mirrors ., 2004. Available from WWW: http://www.dself.dsl. pipex.com/museum/comms/ear/ear.htm#steer Proceedings of the 13th WSEAS International Conference on CIRCUITS ISSN: 1790-5117 145 ISBN: 978-960-474-096-3