Bioacoustics Project S2, 2008 Hydrophonic doppler speed determination: Objective: To use passive recordings of underwater sound in the Swan River to determine the speed of passing motorised watercraft. Theory: The engine of a motorised boat produces a sound of a roughly constant frequency that can be recorded using a hydrophone (underwater microphone) and digital recorder (DAT) and the signal analysed using Fourier techniques. The doppler frequency shift due to the relative motion between the source (the engine) and the observer (the hydrophone) provides a way to calculate the speed of the boat relative to the land. Consider a boat passing along the linear path A B. Let B be closest point to observer at O. Speed of sound in water = c. d b tan a sin For a ferry traveling at constant speed vo producing a constant source frequency fo the frequency at the observer f is given by the doppler relation: frequency ratio: r f fo c c vo sin Let the time origin (t = 0) be when boat is at B: boat: x(t) = vo t , y = b observer: x = 0, y=0 v t ( t ) tan 1 o b Sound leaving the boat at time t reaches the observer at: a t t t c Thus: t r ( t t ) vo t 2 b2 c c c vo sin ( t ) c v t c vo sin arctan o b The extremes of the ratio r correspond to the limiting cases of approach (t - ) and retreat (t + ): maximum ratio: rmax minimum ratio: rmin relative difference: f fo c c vo c c vo c c c vo c vo 2 c vo c vo 2 2 If c and f are known then v can be found: v c 2 1 1 where we define f fo For a particular recording then if the extreme frequencies are f1 (appraoching) and f2 (retreating) we have: fo f1 f 2 2 and 2 f1 f 2 f1 f 2 FFT constraints: To detect a frequency shift of f requires a sampling frequency fs and number of points N such that: f fs 1 N T where T is the time of the sample to which the FFT is applied to determine f1 and f2. Speed of sound measurements: Using Igor Pro: SOS_08.pxp 1) From the Menu select Data/Load Waves/Load sound WAV file... browse to find and select sound files sosNmk.wav where N = 1, 2, 3, ... 8; and k = 1,2 2) From the Menu "macros" select 'start' this displays two tables and panel: parameters: p_name: ppp: describes each variable used in calculations contains parameter values for each variable values can be entered directly or from the 'master' control panel some are internally generated (written as * =) results: show stored values and parameter settings (see below) master: 'select sound file' pop-up menu displays all sound files starting with 's' selecting a particluar sound file (eg: sos6m1) copies the stereo data to ch_L (left channel) displayed in top graph ch_R (right channel) displayed below on the top graph 'left' are are diplayed two vertical lines green for start of region of interest blue for end adjust start and end on 'master' panel to restrict to data subset click on blue 'extract' button to copy the chosen subset to new graph: eg: for sos6m1: start = 67680, end = 67960 the 'adjust zero' checkbox adjusts the initial few points of each subset to zero as determined by ppp[5] the 'gap (cm)' control allows for time compensation for the sound from the brass rod crossing the air-gap to the air microphone. extracted selection: this graph shows the left and right selected subsets adjust the 'master' controls: L pt and R pt to correspond to first positive peak on each trace. the speed of sound (c) is then automatically calculated and displayed in the yellow box from the time difference between the two traces in accordance with the hydrophone-rod distance (automatically read from the sound file name – eg: 6 m for the file sos6m1.wav) as well as the air-gap distance (assuming speed of sound in air as 340 m/s) as set in ppp[13]. The green 'store' button writes the parameters and result into the 'results' table: file_name: selected data file P_start: start point of extract P_end: end point of extract P_L: L pt P_R: R pt distance: in m, from file name sos: speed of sound (c) in m/s air_gap_cm: chosen value for estimate of bar-microphone distance The number to the right of the store button shows the current location for writing results (called 'flag' and shown also in ppp[11]) The purple 'clear last' button undoes the last stored values from the results table. The red 'reset' button clears all previously stored values (NOTE: can't undo this step so be careful!) _____________________________________________________ Doppler sound analysis: Implementation in Igor Pro: RiverSoundAnalysis08.pxp ________________________________________________________________ Instructions for use: 1) Load sample: sound should be mono 16 bit *.wav Menu: Data/Load Waves/Load WAV Sound File ... Name can be changed – must be alpha-numeric, can't start with number, can use _ instead of 'space'. Menu: Macros/start brings up graphs and a table: parameters: p_name describes global variables in ppp ppp contains current value for variables - can be set by direct typing into ppp - or from controls on graphs - sometimes calculated internally (indicated by * =) sample: displays sample to be analysed select sound file from pop-up menu top right set start point and FFT size (multiple of 2 for speed) set sampling frequency (rate) in Hz optional Hanning filter - not required for noise - good to identify signals selection: displays the selection from the sound sample as determined by - controls on graph 'sample' spectrum: displays power spectrum (in dB) of selection from sample Update by clicking on purple 'FFT' button Can smooth spectrum by clicking 'smooth' checkbox and choosing number to the right of it. Bigger number more smoothing. For noise can reduce number of frequency bins by factor in 'bin' pop-up eg: FFT size = 8192, bin = 1 4096 2) Sonagram: Once a sound file is loaded and FFT size and smoothing is chosen, a sonagram can be performed on a specified portion of the sample wave. Controls on the Spectrum graph determine: - start: point number for start of first spectrum - end: point number for end of sonagram analysis - overlap (%): amount of overlap between successive spectra in sonagram For these values the number of individual spectra in the sonagram (called 'slices') are calculated and displayed on the spectrum graph. There may be some points at the end of the specified range that are excluded depending on the FFT size chosen etc. Click on the red button 'sonagram' to perform the analysis. When the calculations are completed two new graphs are displayed: sonagram: with frequency as the y-axis and time (of the start of each separate slice) as the x-axis. A colour scale indicates the spectrum values in dB. 3) ________________________________________________________________ Other Graphs and Tables: Window/GraphMacros/g_ends ends: displays the start (green) and end (blue) points in the selection number of points included is set by ppp[3] Window/GraphMacros/g_spec_extracted extracted spectrum: displays individual slices of the sonagram as a spectrum shows time for point at start of slice Window/TableMacros/t_SPL_values SPL values: contains data calculated for dBA, dBC and dBF vs t_axis for each slice of the sonagram.