forked from jspsych/jsPsych
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjspsych-audio-button-response.html
45 lines (39 loc) · 1.25 KB
/
jspsych-audio-button-response.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<script src="../jspsych.js"></script>
<script src="../plugins/jspsych-audio-button-response.js"></script>
<script src="../plugins/jspsych-html-button-response.js"></script>
<link rel="stylesheet" href="../css/jspsych.css"></link>
</head>
<body></body>
<script>
var timeline = [];
timeline.push({
type: 'html-button-response',
stimulus: 'Recent versions of Chrome require the user to interact with a page before it can play audio. '+
'Clicking the button below counts as an interaction. Be aware of this when planning audio experiments if '+
'you want the first trial to include audio.',
choices: ['Continue']
});
timeline.push({
type: 'audio-button-response',
stimulus: 'sound/speech_green.mp3',
choices: ['Green', 'Blue', 'Red'],
prompt: "<p>What word was said?</p>"
});
timeline.push({
type: 'audio-button-response',
stimulus: 'sound/speech_red.mp3',
choices: ['Green', 'Blue', 'Red'],
trial_duration: 2000,
response_ends_trial: false,
prompt: "<p>What word was said? (trial ends after 2s)</p>"
});
jsPsych.init({
timeline: timeline,
use_webaudio: false,
on_finish: function(){jsPsych.data.displayData();}
});
</script>
</html>