We use Scicon R&D’s PCquirerX software and pneumotachograph machine to record aerodynamic data in the phonology lab to address questions which involve analyzing airflow and/or pressure from the nose and mouth during speech. Although collecting aerodynamic data is the most obvious application, it can also accept data from any source which utilizes a DC electrical current within the right range. Audio is recorded simultaneously with airflow and pressure, but the oral airflow mask distorts amplitudes above 1000 Hz.
The transducer interface (EIPF-4) should be connected to the main machine (in Figure 1) using the 8-pin mini DIN cable. The nasal mask is connected directly to the transducer interface channel 3 (nasal flow) via the nylon tubing; be careful when connecting the tube. The main unit is connected to a USB port of the host using a USB cable and is connected to a power outlet by its power cable. It has a battery backup which must be charged for a full 15 hours before battery operation usage.
Recording oral/nasal airflow and pressure
Setting up the airflow machine
The PCquirerX airflow machine is located in the large soundbooth. To turn on the airflow machine, press the button on the back, below the power cord and a red LED will light up on the front. To prepare your participant to record oral flow and pressure:
- Participants should hold the oral mask/transducer to their face such that no air is leaking.
- Nasal airflow is obtained using the CPAP mask which can be secured to the wearer’s head using the velcro straps. Ensure that the CPAP mask is fitted with even pressure on the face so that no air is seeping out from the seal. It can be used comfortably with or without the oral mask.
- If you are recording both oral and nasal flow/pressure, the oral mask should fit under the nasal mask without air leakage.
- Finally, check that all plastic tubes are properly connected to the masks and transducer.
Remember to clean and sanitize the masks before and after each use, including the parts that touch the user’s face as well as the insides (except for the mesh window where air escapes). Allow the equipment to dry before use.
Setting up the software
Scicon’s PCquirerX software is installed on PC #1 (the machine outside booth 1). The X516 hardware requires a digitally unsigned device driver, which 64-bit Windows would ordinarily object to. To get the hardware to work, it is necessary to disable driver signature enforcement each time the computer is rebooted. It’s possible that this was done the last time it was rebooted, so you should try using PCquirerX first.
Right-click on PCquirerX and run it as administrator to start the recording software. You can close the status window which will open up first. Click the red record symbol at the top toolbars for the window in Figure 3 to display.
Once PCquirerX is running and the airflow machine is on, follow these steps to make your recording:
- Hit the red “record” icon to open up the channels in “scope mode.” No data is actually being recorded at this time. At this point, your set-up should resemble that in Figure 3 above.
- To set the parameters for the collection of aerodynamic data, first select the channels you wish to record by checking the appropriate boxes according to your needs: Ch1. Oral flow; Ch2. Oral pressure; Ch3. Auxiliary/nasal flow; and Ch4. Auxiliary/nasal pressure.
- Adjust the sampling rate, filter, and gain accordingly. It is helpful to have ask your participant to produce practice utterances (e.g., “pa” and “ma” or other appropriate implosives/ejectives to make sure that extreme sounds aren’t going to exceed the range of the airflow/pressure channels) while you choose these parameters.
- Choose values for the gains for each channel to avoid clipping but which still provide a strong signal (and hence information). When clipping occurs, you will see flat areas in red at the high or low end of the range, where the signal looks like it hit a wall and couldn’t go any farther.
- Adjust the gain for the audio using the USBPre in a similar manner, ensuring that levels stay within the green and yellow range on the pre-amplifier.
- When you are ready, hit the white “record” button to begin recording data and the “save” button when you have finished recording. Do NOT hit the red “X” if you intend to save your signals. It is helpful to leave the timer visible while your participant is providing data so that you don’t go over the maximum of 10 minutes.
- From the File menu, select “Export Channel as Wave” to save the recordings, naming each individual channel accordingly.
- Turn off the PCquirerX machine when you are finished recording.
If you don’t see channels 1-4 or if there is no audio input at all: This is how you know to reboot and disable driver signature enforcement. Restart the computer and then repeatedly press F8 before the Windows logo comes up. This will open an advanced boot menu. Choose the “Disable Driver Signature Enforcement” option and then let it continue booting.
Important notes: Recordings must be under 10 minutes long or they will not save and you will lose all of your data. Make sure that you take note of each of the parameters you chose for calibration purposes and for writing up your methods for data collection. Keep in mind that you can downsample and filter afterwards, but that the sampling rate at this time should be at least twice the value of your filter (read about the Nyquist frequency and Nyquist rate).
Units of measurement
The purpose of the flow and pressure transducers is to convert the relevant property of the air into something that can be transmitted through a wire. The transducers generate a DC current whose voltage is manipulated to reflect flow rate or pressure. PCquirerX receives a DC electrical current from each of the data sources it is attached to. Since it does not know how the transducers converted from physical parameters to voltage, or even what physical parameters they were measuring, PCquirerX’s default is to display each channel’s voltage in millivolts (mv). This directly expresses what the transducers are doing on the other end, but voltage is not the most meaningful way to discuss airflow and pressure.
In order to display the commonly used units of airflow (milliliters per second) and pressure (centimeters of H20), PCquirerX needs to be told how to convert millivolts back into these units. We must use the PCquirerX’s calibration device to find the functions for converting a given voltage v (in millivolts) into airflow and pressure units.
- CH1: oralairflow (ml/s) = 0.000667x² + 0.0001667x + 0.075
- CH3: nasalairflow (ml/s) = 0.000667x² + 0.00667x + 0.05
The resulting formulas for calibration represent properties of the equipment, not the speaker. Pressure measured on channel 4 would be treated identically to channel 2, but airflow is different, because the oral and nasal masks offer different amounts of resistance to airflow (the same amount of airflow will produce a higher voltage via the nasal airflow mask and transducer, because the nasal airflow mask is not as leaky as the oral airflow mask. The functions are not linear, because the way the masks respond to airflow (how much air it leaks, etc.) depends on the rate of airflow. The pressure function is linear, so the coefficient of v² is zero. The only reason these formulas would change is if the equipment changes.
Processing airflow data
Upload the zipped files to your directory on the server using WinSCP. From here you can process them using MATLAB and/or R on one of the workstations (if you don’t need a GUI) or download them to your personal computer or another local directory. You can follow much of the same workflow for interacting with your files on the server as described in the Ultrasound data processing section of the lab manual.
Additionally, you will likely want to segment your resulting aerodynamic signals by creating a TextGrid file; because the system automatically records an audio signal simultaneously, it is simple to use this wav file plus a transcript of the recording and the P2FA force-aligner to automatically segment your airflow and pressure signals. You can follow the instructions in the Sound Recording page, but the important terminal command to know is:
python /phon/p2fa/align.py -s 60 -e 120 wavfile.wav transcript.txt output.TextGrid
As previously mentioned, the oral mask interferes with the speech signal in ways which the forced aligner is not been trained to deal with. Keep this in mind when working with your aligned acoustic signals.
MATLAB has a lot of useful built-in functions for doing signal processing that make it convenient to use when dealing with aerodynamic data. It’s possible to do a lot of things solely via the terminal (i.e., without a graphical interface), which means using ssh to log into one of the two workstations in the lab (cox-515-5 or cox-515-4). Or you can use the Linux workstations locally. MATLAB is also installed on computers in the Tompkins Linguistics Lab.
To start MATLAB via terminal:
ssh unityID@cox-515-5.chass.ncsu.edu add matlab81 matlab -nodisplay -nosplash -nodesktop
If you have any MATLAB scripts that you will be using, these will be need to be added to your path each time you start MATLAB. For example, we may want to enter the following into the MATLAB console to add the
/phon/MATLAB/ path for this session:
To get the wav files into your MATLAB workspace, you can either simply drag them into the workspace if you’re working with a GUI, or use the MATLAB console:
[nasal,fs] = wavread('/yourpath/nasal.wav'); [oral,fs] = wavread('/yourpath/oral.wav');
Check duration of the signals using the length of ‘data’ and dividing it by the sampling rate of the sound file. The sampling rate is the variable ‘fs’ in your workspace. All sound files should have the same duration. It’s also a good idea to double-check that the sampling rate is what you expect it to be! You can check its value by referencing the variable ‘fs’ in your workspace.
Similarly, you can check the total number of samples by multiplying the value above by the sampling rate:
fs * length(oral_data)/fs
Filtering the signal
Chances are, you will want to use a filter on the aerodynamic signals which eliminates unwanted high-frequency portions of the signal and leaves the parts which are relevant for analysis. Filtering following data collection, as opposed to during it, allows you to have greater control over this process rather than relying on PCQuirerX’s filter.
In MATLAB, we can use a fifth-order Butterworth lowpass filter by defining the following variables and filtering using the subsequent parameters using the MATLAB functions
cutoff_frequency = 60; cutoff_filt = cutoff_frequency/(fs/2); %fs = sampling rate, must be in workspace [b,a] = butter(5,cutoff_filt,'low'); oral_filt = filtfilt(b,a,oral_data); nasal_filt = filtfilt(b,a,nasal_data);
Note that “%” is the comment character in MATLAB and anything after this symbol will not be run. It’s a good idea to visually inspect the filters in Praat or MATLAB to ensure that you haven’t filtered too much or too little. Ideally with airflow data, you will smooth out “noise” from glottal pulsing. If you’re not satisfied with your filter, change the parameters of the Butterworth filter (e.g., the cutoff frequency or the order).
Plotting data in MATLAB
In order to visually inspect your signal in MATLAB (e.g., to check the filter process) using the plotting function (GUI only), MATLAB needs a meaningful reference for interpreting time. You can set the units to seconds or milliseconds depending on your preference, though milliseconds is probably most useful. Save these function as separate .m files to your path to use them on your data:
function [ my_time ] = plot_time( data, sample_rate ) %% creates a time series vector; useful for plotting (meaningful x-axis). %% units = seconds my_time = 0:1/sample_rate:length(data)/sample_rate; my_length = length(my_time); my_time(my_length) = [ ]; end function [ my_time ] = plot_time_ms( data, sample_rate ) %% creates a time series vector; useful for plotting (meaningful x-axis). %% units = milliseconds my_time = 0:1/(sample_rate/1000):length(data)/(sample_rate/1000); my_length = length(my_time); my_time(my_length) = [ ]; end
Once you have saved this function in your path, run it in the MATLAB command window:
Use the zoom icon and select a window to zoom in on your signal. To zoom out, you only need to click on the plot window using the zoom out icon. The command
clf will clear the current plot.
Depending on your research questions, you may be interested in calculating and plotting differentials of the filtered oral and nasal signals to look at things like velocity, acceleration, jerk, etc. Calculate the first differential (velocity) of the oral signal and plot it first alone and then according to time (ms) by entering these lines into command window:
oral_diff = diff(oral_filt,1); nasal_diff = diff(nasal_filt,1); plot(oral_diff) clf % clears current plot plot(plot_time_ms(oral_diff,fs),oral_diff);hold on plot(plot_time_ms(nasal_diff,fs),nasal_diff,'Color','r')
In the differentials, peaks correspond to the moments of fastest change over time in the raw signals. To plot ‘Nasal Velocity’ and ‘Nasal Flow’ on the same plot using
yyplot, we need to adjust the y-axis scale because units are different for both variables.
% First assign the respective time vectors to their own variables. diff_x = plot(plot_time_ms(nasal_diff,nasal_fs)); signal_x = plot(plot_time_ms(nasal_data,nasal_fs)); % Plot the nasal differential and the nasal airflow together: yy_plot = plotyy(diff_x,nasal_diff,signal_x,nasal_data); set(get(yy_plot(1),'Ylabel'),'String','Nasal Velocity') set(get(yy_plot(2),'Ylabel'),'String','Nasal Flow')
If you want to analyze the data in R, you can write any of the vectors to a comma-delimited text file using
dlmwrite. These lines write the vectors containing the filtered signals of the oral and nasal signals as well as the time-series vector:
Note: These will be very large text files if you do not downsample your signal first which you may want to do in either MATLAB or Praat. To write a wav file rather than a text file, use