・音を再生する課題がブラウザ上で動かない
jsPsych.initに
use_webaudio: false,
を入れると動いた
・一つのtrialに複数の処理を入れたい(音を2秒提示したのちに反応取得課題)
var stroop = {
timeline:[
{ /*ひとつめの処理*/
type: 'audio-keyboard-response',
stimulus: 'cry1.MP3',
trial_duration: 2000,
prompt:"<p style=font-size:60pt;'>+</p>",
choices: jsPsych.NO_KEYS,
trial_ends_after_audio: true
},
{ /*ふたつめの処理*/
type: "html-keyboard-response",
choices: ["d","f","j","k"],
trial_duration: 2000,
response_ends_trial: true,
stimulus: jsPsych.timelineVariable('stimulus'),
prompt: '赤色ならd,青色ならf,黄色ならj,緑色ならk',
data: jsPsych.timelineVariable('data'),
on_finish: function(data){
var correct = 0;
if(data.correct_key_press == data.key_press){
correct = 1;
}
data.correct = correct;
},
post_trial_gap: function() {
return Math.floor(Math.random() * 1000) + 500;
}
}],
timeline_variables: stimuli,
/*sample: {type: 'fixed-repetitions',size: 2},*/
};
基本的にこちらのサイトが大変わかりやすかった(以上のコード、以下の実験も大変参考にさせていただきました)
https://kunisatolab.github.io/main/how-to-jspsych2.html
(congruentとincongruentがばらばらなので注意)
泣き声+ストループ課題(Dudek et al., 2016, PloS Oneの試作)