MATLAB Python

easyVoice

Syntax

datastruct = easyVoice(datastruct [,'onset'] [,'stim'] [,'cond'] [,'cresp'] [,'trial_dur'] [,'respmap'] [,'nesting'] [,'next_window'] [,'info'] [,'draw_func_args'] [,'trial_summary_func_args'] ) [] = optional parameters '' = parameter-value pairs

Description

EASYVOICE is intended as a quick way to gather and organize keypress response data. Each call to the function is a 'trial' in which more data are collected. It builds and logs a structure prepared by initEasyVoice that can be easily saved and later analyzed in matlab, and which contains much of the important information you would normally hope to collect upon prompting for a response. It also attempts to reduce the burden of gathering a response by assuming the format of your test question will remain the same across instances: most parameters are set once using initEasyVoice and can then be forgotten. The function saves all of its information after each resposne is logged (to both a matlab and text file) in case disaster strikes in your matlab session. It can also optionally report helpful output to the console so you can see how your participant is doing.

Usage

D = easyVoice(S) returns a datastruct using EASYVOICE default values. S is a test-specific data structure prepared by running initEasyVoice to specify test-related parameters like recording quality, maximum time duration, etc. D = easyVoice(datastruct,param1,val1,param2,val2...) sets various optional parameters. Parameters are case-insensitive, and each string parameter must be followed by a value as indicated: 'onset' Numeric Scalar. Start time of the trial. It is better to use the time returned by, e.g., your draw command than the onset of this function for more accurate measurement. However, if you leave this field empty, the duration will begin from the time this function is launched. Default: output of GetSecs command 'stim' String. A string describing the stimulus presented in this trial. Specify here to store the information in your datastruct and enhance console and text-file data-logging. If omitted or repeated, a generated string containing repeat count will be used in its place. stim is used as a row name for the trial table. Default: '---' 'cond' Scalar positive integer, NaN, string, or string cell array. Specifies the condition to which the current trial belongs. If omitted, left empty, or set to NaN, condition -1 will be recorded. It can be specified either by a positive integer, NaN, or by string name. If a condmap was specified in initEasyVoice, a corresponding condition string will be reported. When there are multiple condition factors, can be supplied as a numeric array or cell array of strings where each entry corresponds to a different condition factor; in this case, there must be an equal number of condmap entries supplied to initEasyVoice, and each entry of cond must be the same type. As a shortcut with multiple condition factors, cond can be supplied as a single string (conditions delimited by underscores) which will be compared to row names of the master condmap to determine which conditions to assign for each factor. If no condition in a condmap matches the string, the condition will be appended to the condmap. Default: -1 'cresp' Cell array of strings or NaN's. The strings that should be treated as being correct responses. If there is no one correct answer, omit this parameter, and all valid responses will be treated as correct (unless you specified a default_cresp with initEasyVoice). NaN indicates that a null response is correct. If there is more than one correct response, specify default_cresp as a cell array of strings (with NaN as a valid element as well). Default: {} 'trial_dur' Numeric positive scalar. The maximum period, specified in seconds, for which you would like to present participants with the initial promptscreen while waiting for a response. Specify a duration of 0 to sample for a current keypress and then exit. If you did not provide a default prompt_dur during initialization, you will be required to enter one here. Default: [] 'nesting' Numeric vector of positive integers. Used to specify the nested structure of trials in an experiment. Hierarchy is represented in descending order from left to right, e.g., block 2, subblock 1, trial 4 would be represented as [2 1 4]. This information will be retained in the datastruct trials table, and is also used to create depth-specific summaries in easyScore. The supplied vector can be of any length, but the nesting vector must be of consistent length across all trials of an experiment. If the nesting structure has more than one layer (i.e. more than one element in the nesting vector), this parameter must be explicitly supplied for each trial in the experiment. If a single-element nesting vector is supplied to the first trial, this parameter does not need to be supplied with each call, and will be instead incremented by one automatically from the previous trial nesting value. Default: [trial] 'next_window' Window pointer. If a pre-drawn psychtoolbox window is supplied to the function, then easyKeys will present it immediately after the specified prompt/trial duration has elapsed. If a listen_dur was specified in initEasyKeys, then easyKeys will continue to listen for responses during that interval (while this next_window is on the screen) before exiting, and a pre-drawn window will be a required argument. Default: [] 'info' Any data type. Populate this field with any kind of meta-data about the trial. It will be associated with that trial and remain available for later reference in the datastruct, including by trial_summary_funcs. Default: {} 'respmap' Table mapping strings to numeric values and labels. Defines the semantic and numerical "meaning" of a set of anticipated vocal responses. Although auditory easyVoice responses cannot be matched to text inputs (at least not without future-tech text recognition that we don't have at our disposal), this respmap is also displayed by easyCode, and may facilitate manual response scoring. Use makeMap to generate this map. Default: empty table 'draw_func_args' Cell array. If you would like easyVoice to draw options for you, set this parameter. You must have provided a parent window and drawing style to initEasyKeys using draw_func. This optional parameter is not needed for drawing, but can be used to control the display. It is formatted as one or more elements of a cell array, each of which can be left empty for defaults. Position (1) can contain a text label to be printed your choices. Position (2) can contain a cell array of possible options for the participant to vocalize. For images, a complete filepath should be provided as each "descriptor" to the respmap (image data can also be supplied directly). For text, the complete string to be displayed should be provided. Position (3) of the array can control the grid display size with [rows cols]. Note that if no "onset" parameter is specified at runtime (see above), an onset value from the "flip" command generated by draw_func is used instead. Default: {[],[],[]} 'trial_summary_func_args' Cell array. A cell array of optional arguments that will be passed on to each call of the scoring function. Default: {}

Output

datastruct: a data structure containing the various parameters that were provided to the initEasyVoice initialization function, as well as response data from each call to easyVoice. Fields corresponding to absent optional parameters are set to default values.