Topics Map > Resources for collaborators

SMNG Code: Quick Start Guide

This page provides you with some basic context for running experiments and performing data analysis with the Speech Motor Neuroscience Group's code base. It also links out to many other resources on similar topics.

Data collection

Data collection for compensation-style experiment

Unless otherwise stated, any code referenced is in the carrien/free-speech repository on GitHub: https://github.com/carrien/free-speech

For data collection of a compensation experiment, run the function templates/modelExpt/run_modelComp_expt.m. That is our "wrapper" function that sets up a file expt.mat. At the end, it calls a function templates/modelExpt/run_modelComp_audapter.m. That is our "engine" function that actually runs Audapter and goes through all of the trials of the experiment. That's the basics, at least.

The results of these functions are two primary files: expt.mat, which stores metadata, and data.mat, which stores the audio recordings and other Audapter output.

Data collection for adaptation-style experiment

Essentially the same as for compensation-style experiment, but the functions are templates/modelExpt/run_modelExpt_expt.m and templates/modelExpt/run_modelExpt_audapter.m

Data analysis

After data collection, there are two main methods of extracting the relevant formant data. Both result in a file called dataVals.mat, which is needed for the next step.

The quick n' dirty method. Just run experiment_helpers/gen_dataVals_from_audapterdata.m. It uses Audapter's formant data, which, since it is calculated online, isn't super accurate and doesn't have the benefit of looking at the trial holistically. (NOTE: See item #1 in the "Before you go" section.)

The more time intensive and reliable method. Our typical pipeline for data analysis includes several steps using various tools. It uses Praat to find formant values and allows you to configure parameters during formant analysis. That whole process is documented here

Plotting

For plotting and further data analysis, a file fmtMatrix.mat is useful and can be derived from dataVals.mat. Use the wrapper templates/modelExpt/gen_fmtMatrix_modelComp.m to generate fmtMatrix.mat. 

Then, see resources in the free-speech/plotting/ folder, but the most simple is plotting/plot_fmtMatrix.m. If you are in the data folder in Matlab, and your fmtMatrix file is called "fmtMatrix.mat", you can run it with plot_fmtMatrix([], 'fmtMatrix.mat')

Other resources

More basic info and terminology used in our code is in this README.md file: https://github.com/carrien/free-speech/tree/master/templates/modelExpt#reference-guide-to-modelexpt . Note that this document was written specifically for modelExpt (the adaptation experiment), not modelComp (the compensation experiment)

At the top of this page, you can click the "Resources for collaborator" hyperlink to find all pages with that tag. Some relevant ones are:

Before you go

  1. If this Github issue is still open, there is a limitation with the quick n' dirty method of generating dataVals.mat (in step 2a). If you use the quick n' dirty method and then get errors when running gen_fmtMatrix_modelComp in step 3:
    1. Open the dataVals.mat file in Matlab
    2. See if there are any rows (ie, trials) where the 'dur'ation column is less than 0.1 seconds.
    3. If there are, set the bExcl column to 1. Save dataVals_audapter.mat.
    4. Those short trials will be excluded when generating fmtMatrix.mat
  2. In our KB documents, some hyperlinks may direct you to a version of a page which has "internal" in the URL, and it will show up to you as "this page doesn't exist." Try removing "/internal" from the URL to see if a non-internal version of that page exists.


Keywordscode, git, github, programming, coding, free-speech, expt, data   Doc ID133635
OwnerChris N.GroupSMNG Lab Manual
Created2023-12-18 14:08:43Updated2023-12-18 14:34:38
SitesSpeech Motor Neuroscience Group
Feedback  0   0