-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudio_experiment.html
81 lines (72 loc) · 2.52 KB
/
audio_experiment.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html>
<head>
<title>My experiment</title>
<script src="jspsych-6/jspsych.js"></script>
<script src="jspsych-6/plugins/jspsych-html-keyboard-response.js"></script>
<script src="jspsych-6/plugins/jspsych-audio-keyboard-response.js"></script>
<script src="jspsych-6/plugins/jspsych-audio-button-response.js"></script>
<script src="jspsych-6/plugins/jspsych-audio-slider-response.js"></script>
<link href="jspsych-6/css/jspsych.css" rel="stylesheet" type="text/css"></link>
</head>
<body></body>
<script>
var welcome_page = {
type: "html-keyboard-response",
stimulus: "Welcome to the Seara's experiment. Press any key to begin, and be ready to be amazed. "
};
var test_stimuli = [
{
stimulus: './mp3s/SEVENTEEN_Dont_Wanna_Cry.mp3'
},
{
stimulus: "./mp3s/CelineDion1.mp3"
}
];
var trials = {
stimulus: jsPsych.timelineVariable('stimulus'),
data: jsPsych.timelineVariable('data'),
type: "audio-button-response",
choices: ['1','2','3','4','5','replay'],
button_html: '<button class="jspsych-btn">%choice%</button>',
prompt: '<p>How acceptable is the music , rating from 1 to 5<\p> <p>press replay to hear it again</p>',
argin_vertical: '0px',
margin_horizontal : '8px',
}
var trial = {
type: "audio-button-response",
choices: ['1','2','3','4','5','replay'],
button_html: '<button class="jspsych-btn">%choice%</button>',
prompt: '<p>How acceptable is the music , rating from 1 to 5<\p> <p>press replay to hear it again</p>',
argin_vertical: '0px',
margin_horizontal : '8px',
stimulus:'./mp3s/SEVENTEEN_Dont_Wanna_Cry.mp3',
}
var loop_node = {
timeline: [trials],
loop_function: function(data){
//if(jsPsych.pluginAPI.convertKeyCharacterToKeyCode('r') == data.values()[0].key_press){
if("5" == data.values()[0].button_pressed){
return true;
} else {
return false;
}
}
}
var test_procedure = {
timeline: [loop_node],
timeline_variables: test_stimuli,
repetitions: 1
}
var debrief_block = {
type: "html-keyboard-response",
stimulus: "<p>Press any key to exit the experiment. Thank you!</p>",
on_finish: function () { window.close()}
};
var audio = ['./mp3s/SEVENTEEN_Dont_Wanna_Cry.mp3', "./mp3s/CelineDion1.mp3"]
jsPsych.init({
timeline: [welcome_page,test_procedure,debrief_block],
preload_audio: audio
});
</script>
</html>