Skip to content

Audio Response Block

An audioresponse block defines a slide that records a participant's speech. The participant is presented with text, an image or sound and can respond verbally.

Informing the participant

The first time audio recording starts for your experiment, the user will unavoidably be asked to grant audio recording permissions to the ROLEG website. If the participant denies this request, an error message will be displayed and the participant will be asked to refresh the page to restart the experiment in order to grant the required recording permissions. Only after the participant grants permission, the trial starts. Therefore, it is important to properly inform your participant prior to presenting a audioresponse trial. It is recommended to first include an info block to explain the recording procedure and the upcoming permission request, followed by a mock audioresponse trial that allows a user to practice recording audio with enabled playback controls in order to verify their microphone works correctly. See example usage for an example.

Furthermore, the participant will be shown a red, filled circle when audio recording is in progress. When recording is inactive, this circle will be unfilled. This indicator cannot be disabled. If relevant, make sure to inform your participant that this red circle is not part of the stimulus.

Caution

Recording audio also requires the participant to have a functioning microphone, and a browser that supports recording audio, such as most major browsers (Google Chrome, Firefox, Safari, Microsoft Edge). If these conditions are not met, the participant will be presented with an error message and asked, in English, to verify their microphone is working or to attempt the experiment on another browser and start the experiment again. In these cases, the experiment will not continue. It is therefore strongly recommended to include a practice recording trial early on in your experiment, to avoid asking the participant to redo prior trials and obtaining duplicate results.

Note

The audio quality of the recording is dependent on the microphone of the participant. To avoid background noise, a microphone close to the speaker is recommended. ROLEG acquires and stores audio recordings in WAV format and does not apply compression.

Parameters

The parameters of the audioresponse block are summarised below.

id
Optional.
String that identifies this block in later analysis of results.
display
Conditionally required, an audioresponse block must always contain either a display, image or sound element.
String that specifies the text or question shown to the participant.
image
Conditionally required, an audioresponse block must always contain either a display, image or sound element. image and sound cannot be combined.
String that specifies the filename of the image file as included in the experiment package that should be displayed. ROLEG supports .png, .gif and .jpg image files. Example: image = "apple.png".
sound
Conditionally required, an audioresponse block must always contain either a display, image or sound element. image and sound cannot be combined.
String that specifies the filename of the sound file, as included in the experiment package, that should be played. ROLEG supports .wav and .mp3 audio files. Example: sound = "beep.mp3".
allow_playback
Optional, defaults to false.
Boolean that specifies whether, after recording the audio, playback controls are shown so that the participant may listen to the recorded audio prior to submission. This also gives the participant the ability to re-record their audio on their leisure. Example: allow_playback = true.
stimulus_duration
Optional, defaults to the full slide duration.
Float that indicates the maximum number of seconds after which the slide stimulus is hidden. If this value exceeds that of showtime, it will not have an effect.
recording_delay
Optional, defaults to 0 seconds.
Float that indicates the number of seconds the experiment will delay recording audio. Alternatively if sound is set, this value can also be specified as Keyword "sound" to delay recording until after the provided audio file finishes playing.
showtime
Optional, defaults to 4 seconds.
Float that indicates the number of seconds the experiment will record audio. If playback controls are enabled, after this duration the controls are presented together with the opportunity to rerecord the audio or a button to accept the current audio. If playback controls are disabled, the slide ends immediately. Any time spent on granting recording permissions is not taken into account. Alternatively if sound is set, this value can also be specified as Keyword "sound" to end the experiment after the provided audio file finishes playing.

Warning

Audio recordings may be a little shorter than showtime, as it takes a little time for recording to start. To compensate for this, you can add a small amount to showtime.

font
Optional.
font that specifies the font used for the current block.

Example usage

The code below illustrates how the audioresponse block might be used.

experiment {
    info {
        display = "This experiment makes use of speech recording during certain sections.\n\
        Speech recording will be indicated by a large red, filled circle.\n\
        Please advance to the next slide to practice recording and to verify your microphone works correctly.\n\
        You will first be asked to allow ROLEG to record your audio, please grant this permission to take part in the experiment."
    }

    audioresponse {
        display = "Say something to practice speech recording."
        allow_playback = true
        showtime = 3
    }
}
Back to top