Skip to content

Example experiments

This section of the manual will provide you with example experiments to learn from. Often, these will include useful template definitions, to speed up your workflow. These examples can be used or made to fit in your experiment and will hopefully help with saving time while constructing the experiment.

We invite you to share any example experiments you think useful for other researchers to learn from. If you'd like to do so, please send us an email at roleg@let.ru.nl.

Speech comprehensibility

This experiment includes rating the speech comprehensibility of audio files, using choice responses. It makes use of templates where the intended experiment behaviour is repeated. You can open this example in the live editor using the button below, or download it to your computer using this link.

experiment { 
    // ---Template definitions ---
    define_template {
        name = "speechstim"

        max_duration = 5000
        pre_delay = 500

        stimulus {
            text = "The sound is"       
            audio = BOUND
        }
        response {
            choice {
                options = [
                    "Very well comprehensible",
                    "Well comprehensible",
                    "Slightly comprehensible",
                    "Not comprehensible"
                ]
                type = BUTTONS          
            }
        }   
    }

    // --- Experiment contents ---
    // Introduction
    text = "Welcome to this experiment."

    // Sound check
    text = "\
        In the next blocks, you will hear several sounds.\n\
        Click 'Continue' to play an example sound to determine the appropriate volume."
    trial {
        stimulus {
            text = "\
                Change the volume on your headphones until you can hear the voice well without it being unpleasantly loud.\n\
                You can use the playback controls below to play the sound again."
            media {
                audio = "voice_check.mp3"
                show_controls = true            
            }       
        }
        response {
            button = "The volume is okay like this"
        }   
    }

    // Instructions
    text = "\
        Now, we will start the practice round.\n\
        For each played sound, determine how well you can understand its message by checking the appropriate choice box.\n\
        For each sound, you have 10 seconds to make a choice."

    // Practice
    speechstim_template {
        id = "P"
        max_duration = 10000    
        fill_repeated {
            audio = [
                "a1.mp3",
                "a2.mp3",
                "a3.mp3"
            ]
        }
    }

    // Instructions
    trial {
        stimulus {
            text = "\
                Now, we are ready to start the real experiment.\n\
                In the real experiment, you will only have 5 seconds to make a choice."
        }
        response {
            button = "Start"
        }
    }

    pause = 3000

    // Experiment
    speechstim_template {
        id = "E"
        fill_repeated {
            audio = [
                "a1.mp3",
                "a2.mp3",
                "a3.mp3"
            ]
        }
    }

    trial {
        stimulus {
            text = "This is the end of the experiment. Thank you for your participation."
        }
        response {
            button = "Close experiment"
        }
    }

}

Speech recording

This experiment includes recording the speech of participants. It makes use of templates where the intended experiment behaviour is repeated. Furthermore, it uses include files to counterbalance the stimulus presentation across two groups.

You can open this example in the Live Editor by copying and pasting its contents, or download the collection as ZIP to your computer using this link. If you use the Live Editor, you can use the 'Include index' setting at the bottom to indicate which include file to use.

experiment.roleg
experiment {
    // --- Template definitions ---
    define_template {
        name = "textandbutton"

        stimulus {
            text = BOUND
        }
        response {
            button = BOUND
        }
    }
    define_template {
        name = "speech"

        max_duration = 5000
        post_delay = 3000

        stimulus {
            text = BOUND
        }
        response {
            speech {
                max_duration = 4800 // Ensure recording is finished
            }
        }
    }

    // --- Experiment contents ---

    // Introduction
    text = "Welcome to this experiment"
    text = "\
        In this experiment, we will ask you to read certain phrases out loud\n\
        This experiment will record your speech for later analysis.\n\
        This is done in a secure and fashion, and any recordings are anonymous and cannot be traced back to you.\n\
        \n\
        Speech is only recorded during certain sections and recording sessions will be clearly indicated."

    // Microphone test & recording permission request
    textandbutton_template {
        fill {
            text = "\
                We will start with a microphone test, to ensure recording works correctly.\n\
                Please connect a working microphone now and ensure you are sitting in a quiet environment.\n\
                \n\
                When the test starts, your browser will ask you for permission to allow ROLEG to record your audio.\n\
                Please click allow to be able to continue the experiment.\n\
                This permission only lasts for your current browser session."
            button = "Start microphone test"
        }
    }

    trial {
        max_duration = 1000
        stimulus {
            text = "\
                Please grant ROLEG recording permissions, if your browser prompts you.\n\
                \n\
                The experiment will continue automatically afterwards."
        }
        response {
            speech {
                max_duration = 800
            }
        }
    }

    trial {
        max_duration = 3000
        s { text = "Microphone test succeeded." }
    }

    text = "\
        Now, we will proceed to check if the microphone volume is appropriate.\n\
        \n\
        In the next test, please read out loud the  phrase that will appear.\n\
        After 5 seconds, you can listen to your own speech recording."

    trial {
        stimulus {
            text = "\
            'The quick brown fox jumps over the lazy dog.'\n\
            \n\
            Please ensure your recording is clear and not too noisy, by playing it back after 5 seconds.\n\
            If necessary, adjust your microphone settings and record again using the repeat button."
        }
        response {
            speech {
                max_duration = 5000
                max_number_recordings = INFINITY
            }
            button = "The speech recording sounds okay like this."
        }
    }

    textandbutton_template {
        fill {
            text = "\
                Now, we are ready to start the experiment.\n\
                \n\
                Please read out loud the sentences you see appear from now on.\n\
                The experiment will automatically advance after 5 seconds."
            button = "Start experiment"
        }
    }

    // Main experiment (counter-balanced)
    include = ["group1.rolinc", "group2.rolinc"]

    // Ending
    textandbutton_template {
        fill {
            text = "The experiment finished.\nThank you for your participation."
            button = "Close experiment"
        }
    }
}

group1.roleg
include {
    // Use templates from main experiment

    speech_template {
        fill_repeated {
            text = [
                "The quick brown fox jumps over the lazy dog",
                "The brown quick fox jumps over the lazy dog",
                "The lazy quick fox jumps over the brown dog"
            ]
        }
    }
}

group2.roleg
include {
    // Use templates from main experiment

    speech_template {
        fill_repeated {
            text = [
                "The lazy quick fox jumps over the brown dog",
                "The quick brown fox jumps over the lazy dog",
                "The brown quick fox jumps over the lazy dog"
            ]
        }
    }
}

Likert scale

This experiment includes rating statements using a slider response as Likert scale. It makes use of templates where the intended experiment behaviour is repeated. You can open this example in the live editor using the button below, or download it to your computer using this link.

experiment {
    // --- Template definitions ---
    define_template {
        name = "likert"
        stimulus {
            text = BOUND
        }
        response {
            slider {
                steps = 5
                labels = ["Strongly disagree", "Strongly agree"]
            }
            // Instead of a slider, one could also use the `choice` response option

            button = "Continue"
        }
    }

    // --- Experiment contents ---
    likert_template {
        id = "L"

        fill_repeated {
            text = [
                "I like dogs",
                "I like cats",
                "I like spinach"
            ]
        }
    }
}

Back to top