Skip to content

Response Block

The response block provides the ability to request a response from the participant to a provided stimulus block. The structure of this block is summarised below.

Parameters

Note

Take note that these response parameters are both optional itself and have an optional value. Not including the parameter at all excludes it from your trial, whereas specifying the parameter without value, includes it in your experiment with its default value.

button

Optional, default value is localised 'Continue'.
Adds a button to the trial that will advance the trial if possible.
Optional String that specifies the text on the button to be shown to the participant.

Example: button = "Submit answer" or simply button to use the default value instead.

keyboard

Optional, default value is [SPACE].
Adds a keyboard listener that will advance the trial if possible.
Optional list of Strings or Keywords that specifies character keys that can be used to advance the trial.

Example: keyboard = ["f", "j", ENTER] or simply keyboard to use the default value instead.

keyboard has the following available Keywords: SPACEBAR, ENTER, ARROW_LEFT, ARROW_UP, ARROW_RIGHT and ARROW_DOWN. Like all Keywords, these are used without surrounding quotes.

Members

choice
Optional.
choice response that presents a number of choices.
slider
Optional.
slider response that presents a slider.
speech
Optional.
speech response that presents an audio recording response.
textfield
Optional.
textfield response that presents a textfield to type in.

Shorthands

textfield

Optional String that specifies a textfield response with the placeholder set to the provided String.

Example: textfield = "Write your answer here" or simply textfield to use the default placeholder instead.

This shorthand with an optional value differs from the textfield member of a response block. A shorthand always has a single value if any, whereas a member is a block with its own parameters for greater control.

choice

List of Strings that specifies a choice response with the options set to the provided List.

Example: choices = ["High", "Moderate", "Low"].

Example usage

The code below illustrates how a response block might be used.

experiment {
    trial {
        stimulus {
            text = "Press the 'F' key for female speech and 'M' for male speech"
        }
        response {
            button
        }
    }

    trial {
        stimulus {
            audio = "audio_sample.mp3"
        }
        response {
            keyboard = ['F', 'M']
        }
    }
}
Back to top