From Phonlab

Jump to: navigation, search

The Phonology Lab has two EGG-D800 electroglottograph from Laryngograph for performing EGG and aerodynamic studies. It has two pressure transducers to complement the microphone and EGG signals, as well as four OroNasal masks from Glottal Enterprises, which isolate oral and nasal airflow (two Child size and two Adult size). Consult with Susan Lin for permission to use one of these systems.


Data acquisition workflow

The standard way to acquire EGG and aerodynamic data is to run a configuration utility for the EGG-D800 and then record with any audio recording software. Postprocessing of the output file is required when aerodynamic channels are included in the recording.

At present the EGG-D800 is supported on Windows systems only.

Connect the EGG-D800

The first step is to install the EGG-D800. Once this step is completed, it no longer

  1. Attach the EGG-D800 to the host Windows computer with a USB cable. It will automatically connect to the host computer as a USB Audio device.

Configure the EGG-D800

Configure the EGG-D800 with the eggrec utility.

  1. Audio and EGG signals are always acquired by the EGG-D800. If you also require aerodynamic signals, use the aero parameter to turn on the pressure transducers:
 eggrec --aero

You can also adjust the microphone gain. For maximum gain do:

 eggrec --aero --mic-gain 24

Valid microphone gain values range from -24 to 24, corresponding to 0.5dB increments ranging from -12.0dB to +12.0dB.

By default the EGG signal is adjusted by automatic gain control. You can override this behavior by setting a fixed gain in a manner similar to the microphone gain, using the same range:

 eggrec --aero --mic-gain 24 --lx-gain -24

The preceding command sets the microphone gain at +12.0dB and the EGG gain at -12.0dB.

The pressure transducers are set at a fixed gain and cannot be adjusted.

Try eggrec --help for additional detail on how to use the eggrec utility.

In our experience the EGG-D800 will automatically be installed as the default input audio device. If it is not the default it will be necessary to use the Windows mixer to make it the default, or you will have to select the EGG-D800 as the input device in your recording software.

Make a recording

Once the EGG-D800 has been configured you can make a recording with any audio recorder you wish. The important thing is to make sure the recording parameters match the data stream coming from the EGG-D800. Normally this means you should record two channels of 16-bit audio at 48,000 samples/sec. For example, to record with the sox alias rec:

 rec -c 2 -b 16 -r 48000 somefile.wav         # Use Ctrl-C to stop recording

This command creates a new file named somefile.wav with the correct format.

It is very important that you record in stereo and that the sample rate be half the EGG-D800's total data rate (its default total rate: 96,000 samples/sec).


No postprocessing is necessary if you did not enable the aerodynamic channels of the EGG-D800. Your output .wav file contains two channels, with the microphone signal in the first (left) channel and the EGG signal in the second (right) channel. The sample rate for each channel is normally 48,000 samples/sec.

If the aerodynamic channels were enabled, then your output .wav file contains two channels, with the microphone signal interleaved with the P2 signal in the first (left) channel, and the EGG signal interleaved with the P1 signal in the second (right) channel. The audio/EGG signals are the even-numbered samples in their channels, and the aerodyanmic signals are the odd-numbered samples. The effective sample rate for each of the signals is normally 24,000 samples/sec.

Viewing the recording

Use the eggdisp utility to view the recorded signal. This command allows you to view the audio, p1, and p2 channels separately, but side-by-side. somefile.wav

Separating channels

Use the eggsep utility to separate each of the signals into separate files. This command separates somefile.wav into, somefile.lx.wav, somefile.p1.wav, and somefile.p2.wav:

 eggsep somefile.wav

eggsep also has a seek mode that searches a directory tree for .wav files and attempts to separate the signals. By default it will not attempt to separate signals that have already been separated by eggsep. This means you can keep all your acquisitions in a single parent directory and safely run eggsep in seek mode in that directory after every acquisition session:

 eggsep --seek C:\myacqdir

If you follow the strategy of running eggsep multiple times on your base acquisition directory, then you should not create any .wav files in that directory other than by recording with the EGG-D800 in aerodynamic mode or as the output of eggsep.

Postprocessing with Python

If you wish you can skip postprocessing with eggsep and deinterleave the signals in Python. Simply read the .wav and use demux() from the eggd800 library. Don't forget that the effective sample rate for each channel is half of the .wav file's reported sample rate.

   import numpy as np
   from scipy import stats
   from eggd800.signal import demux, butter_lowpass_filter

   (rate, data) =
   (au, lx, p1, p2) = demux(data)
   rate /= 2            # effective sample rate is half the original rate (one quarter of the EGG-D800's total rate)

You can use butter_lowpass_filter() to smooth the aerodynamic channels:

   cutoff = 100     # lowpass filter cutoff in Hz
   order = 3        # lowpass filter order
   p1_lp = butter_lowpass_filter(p1, cutoff, rate, order)
   p2_lp = butter_lowpass_filter(p2, cutoff, rate, order)

To calibrate a signal you start with your calibration measurements and reference inputs. In this example we have P1 and P2 readings for reference flow rates of -1.0, -0.5, 0.0, 0.5, and 1.0 liters/sec.

   refinputs = [-1.0, -0.5, 0.0, 0.5, 1.0]
   p1_measurements = [-2063.64, -196.70, 839.24, 1780.47, 3695.19]
   p2_measurements = [-272.29, -114.77, -2.05, 110.27, 266.41]

If we can we remove the zero offset from the signal, then calibrate based on linear regressions of the measurements corresponding to the reference inputs:

       zero_index = refinputs.index(0.0)
       p1_offset = p1_measurements[zero_idx]
       p2_offset = p2_measurements[zero_idx]
   except IndexError:
       p1_offset = 0.0
       p2_offset = 0.0
   p1_regression = stats.linregress(
       np.array(p1_measurements) - p1_offset,
   p2_regression = stats.linregress(
       np.array(p2_measurements) - p2_offset,
   p1_lp_cal = (p1_lp - p1_offset - p1_regression.intercept) * p1_regression.slope
   p2_lp_cal = (p2_lp - p2_offset - p2_regression.intercept) * p2_regression.slope
Personal tools