Reputation: 11
Does anyone know how to specify the button_html, so it also allows for the participant to press 'r' on the keyboard to repeat the sound/trial? R doesn't need to be shown as a button on the screen it only needs to be possible to press it to repeat.
This is the code I've used:
var sound_trial = {
type: jsPsychAudioButtonResponse,
stimulus: 'sound/Centrifuge.mp3',
choices: ['img/test1.png', 'img/test2.png', 'img/test3.png', 'img/test4.png', 'r'],
prompt: "<p>Hvilket billede passer til ordet?</p>",
button_html: '<img src="%choice%" /></button>',
name: 'soundtrial',
on_finish: function (data) {
jsPsych.data.addProperties({ sound: data.response });
//jsPsych.data.displayData();
}
};
var loop_node = {
timeline: [sound_trial],
loop_function: function(data){
if(jsPsych.pluginAPI.compareKeys(data.values()[0].response, 'r')){
return true;
} else {
return false;
}
}
};
timeline.push(loop_node);
Thank you in advance!
Upvotes: 1
Views: 109