-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRhythm-Experiment.html
269 lines (249 loc) · 8.79 KB
/
Rhythm-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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html>
<html>
<head>
<script src="jspsych/jspsych.js"></script>
<script src="jspsych/plugins/jspsych-forced-choice-audio.js"></script>
<script src="jspsych/plugins/jspsych-html-button-response.js"></script>
<script src="jspsych/plugins/jspsych-html-keyboard-response.js"></script>
<script src="jspsych/plugins/jspsych-survey-text.js"></script>
<script src="jspsych/plugins/jspsych-survey-multi-select.js"></script>
<script src="jspsych/plugins/jspsych-audio-keyboard-response.js"></script>
<script src="js/serverComm.js"></script>
<link rel="stylesheet" href="jspsych/css/jspsych.css"></link>
</head>
<body></body>
<script>
var list = [
'patterns/Rhythm-0.mp3',
'patterns/Rhythm-1.mp3',
'patterns/Rhythm-2.mp3',
'patterns/Rhythm-3.mp3',
'patterns/Rhythm-4.mp3',
'patterns/Rhythm-5.mp3',
'patterns/Rhythm-6.mp3',
'patterns/Rhythm-7.mp3',
'patterns/Rhythm-8.mp3',
'patterns/Rhythm-9.mp3',
'patterns/Rhythm-10.mp3',
'patterns/Rhythm-11.mp3',
'patterns/Rhythm-12.mp3',
'patterns/Rhythm-13.mp3',
'patterns/Rhythm-14.mp3',
'patterns/Rhythm-15.mp3',
'patterns/Rhythm-16.mp3',
'patterns/Rhythm-17.mp3',
'patterns/Rhythm-18.mp3',
'patterns/Rhythm-19.mp3',
'patterns/Rhythm-20.mp3',
'patterns/Rhythm-21.mp3',
'patterns/Rhythm-22.mp3',
'patterns/Rhythm-23.mp3',
'patterns/Rhythm-24.mp3',
'patterns/Rhythm-25.mp3',
'patterns/Rhythm-26.mp3',
'patterns/Rhythm-27.mp3',
'patterns/Rhythm-28.mp3',
'patterns/Rhythm-29.mp3',
'patterns/Rhythm-30.mp3',
'patterns/Rhythm-31.mp3',
'patterns/Rhythm-32.mp3',
'patterns/Rhythm-33.mp3',
'patterns/Rhythm-34.mp3',
'patterns/Rhythm-35.mp3',
'patterns/Rhythm-36.mp3',
'patterns/Rhythm-37.mp3',
'patterns/Rhythm-38.mp3',
'patterns/Rhythm-39.mp3',
'patterns/Rhythm-40.mp3',
'patterns/Rhythm-41.mp3',
'patterns/Rhythm-42.mp3',
'patterns/Rhythm-43.mp3',
'patterns/Rhythm-44.mp3',
'patterns/Rhythm-45.mp3',
'patterns/Rhythm-46.mp3',
'patterns/Rhythm-47.mp3',
'patterns/Rhythm-48.mp3',
'patterns/Rhythm-49.mp3',
'patterns/Rhythm-50.mp3',
'patterns/Rhythm-51.mp3',
'patterns/Rhythm-52.mp3',
'patterns/Rhythm-53.mp3',
'patterns/Rhythm-54.mp3',
'patterns/Rhythm-55.mp3',
'patterns/Rhythm-56.mp3',
'patterns/Rhythm-57.mp3',
'patterns/Rhythm-58.mp3',
'patterns/Rhythm-59.mp3',
'patterns/Rhythm-60.mp3',
'patterns/Rhythm-61.mp3',
'patterns/Rhythm-62.mp3',
'patterns/Rhythm-63.mp3',
'patterns/Rhythm-64.mp3',
'patterns/Rhythm-65.mp3',
'patterns/Rhythm-66.mp3',
'patterns/Rhythm-67.mp3',
'patterns/Rhythm-68.mp3',
'patterns/Rhythm-69.mp3',
'patterns/Rhythm-70.mp3',
'patterns/Rhythm-71.mp3',
'patterns/Rhythm-72.mp3',
'patterns/Rhythm-73.mp3',
'patterns/Rhythm-74.mp3',
'patterns/Rhythm-75.mp3',
'patterns/Rhythm-76.mp3',
'patterns/Rhythm-77.mp3',
'patterns/Rhythm-78.mp3',
'patterns/Rhythm-79.mp3',
'patterns/Rhythm-80.mp3',
'patterns/Rhythm-81.mp3',
'patterns/Rhythm-82.mp3',
'patterns/Rhythm-83.mp3',
'patterns/Rhythm-84.mp3',
'patterns/Rhythm-85.mp3',
'patterns/Rhythm-86.mp3',
'patterns/Rhythm-87.mp3',
'patterns/Rhythm-88.mp3',
'patterns/Rhythm-89.mp3',
'patterns/Rhythm-90.mp3',
'patterns/Rhythm-91.mp3',
'patterns/Rhythm-92.mp3',
'patterns/Rhythm-93.mp3',
'patterns/Rhythm-94.mp3',
'patterns/Rhythm-95.mp3',
'patterns/Rhythm-96.mp3',
'patterns/Rhythm-97.mp3',
'patterns/Rhythm-98.mp3',
'patterns/Rhythm-99.mp3'
];
var sample = jsPsych.randomization.sampleWithoutReplacement(list, 10);
var prolific_pid = jsPsych.data.getURLVariable('prolific_pid');
var judgement_condition = jsPsych.randomization.sampleWithoutReplacement(['typicality', 'preference'], 1)[0];
jsPsych.data.addProperties({
prolific_pid: prolific_pid,
conditions: judgement_condition
});
if (judgement_condition=='typicality'){
var key_phrase = "sounds more unusual"
} else {
var key_phrase = "you like more"
};
var timeline = [];
timeline.push({
type: 'html-keyboard-response' ,
stimulus: "<div style='max-width:700px;'><p>For this experiment, you will listen to 5 pairs of rhythms" +
" and choose which rhythm in each pair "+key_phrase+".</p>" +
"<p>You will need to be able to hear audio in order to complete the experiment.</p>"+
"<p>Press any key to continue.</p>"
});
timeline.push({
timeline: [{
type: 'audio-keyboard-response',
stimulus: 'base64.wav',
prompt: '<p>Listen to the audio for instructions.</p>',
trial_duration: 5500,
choices: ['w'],
post_trial_gap: 0,
}],
loop_function: function(data){
if(data.values()[0].key_press == 87){
return false;
}
return true;
}
})
timeline.push({
type:'forced-choice-audio' ,
stimulus: [
sample[8],
sample[5]
],
prompt: "<p>This is a practice round.</p>"+
"<p>Click the play buttons to listen to the rhythms.</p>" +
"<p>Once you listen to both rhythms, choose which rhythm "+key_phrase+".</p>"
});
timeline.push({
type: 'forced-choice-audio',
stimulus: [
sample[0],
sample[1]
],
prompt: "<p>Choose the rhythm that "+key_phrase+". (1 of 5)</p>"
});
timeline.push({
type: 'forced-choice-audio',
stimulus: [
sample[2],
sample[3],
],
prompt: "<p>Choose the rhythm that "+key_phrase+". (2 of 5)</p>"
});
timeline.push({
type: 'forced-choice-audio',
stimulus: [
sample[4],
sample[5],
],
prompt: "<p>Choose the rhythm that "+key_phrase+". (3 of 5)</p>"
});
timeline.push({
type: 'forced-choice-audio',
stimulus: [
sample[6],
sample[7],
],
prompt: "<p>Choose the rhythm that "+key_phrase+". (4 of 5)</p>"
});
timeline.push({
type: 'forced-choice-audio',
stimulus: [
sample[8],
sample[9],
],
prompt: "<p>Choose the rhythm that "+key_phrase+". (5 of 5)</p>"
});
timeline.push({
type: 'html-keyboard-response' ,
stimulus: "<p>Now you will answer a few questions.</p>" + "<p>Press any key to continue.</p>"
});
timeline.push({
type: 'survey-text',
questions: [
{prompt: "In the past three days, about how many hours did you spend listening to or playing music?", name: 'HowManyHours'},
{prompt: "How many years of musical training have you had (including music theory, choir, instruments, etc.)?" , name: 'HowManyYears'}
]
});
timeline.push({
type: 'survey-multi-select' ,
questions: [
{
prompt: "Describe your music education experience. Check all that apply:",
options: ["I took/take general music in primary school.", "I took/take private music lessons.", "I took/take instrumental/choir classes in high school.", "I took/take music classes in college.", "I was/am a music major in college.", "I am pursuing/have received a graduate's degree.", "I was/am a professional musician / composer."] ,
vertical: true
}
]
});
timeline.push({
type: 'html-keyboard-response' ,
stimulus: "<p> You have completed the experiment. </p>" +
"<p> Press any key to learn what this experiment is about.</p>",
on_start: function(){
serverComm.save_data(jsPsych.data.get().values());
}
});
timeline.push({
type:'html-keyboard-response' ,
stimulus: "<div style='max-width:700px;'><p> The purpose of this research is to investigate the" +
" connection between the unusualness of rhythms and preference for rhythms. " +
" You have been asked to rate either your preference for or the unusualness of certain rhythmic patterns. Other participants will be asked to rate the other characteristic. " +
" The data collected for the two characteristics will be compared to each other. We expect that moderately unusual rhythms will be the ones that are preferred most often.</p>"+
" <p>Thank you for participating! Click <a href='https://app.prolific.co/submissions/complete?cc=88HJ018C'>this link</a> to return to Prolific and complete the experiment. You do not need a completion code.</p>"+
"</div>",
choices: jsPsych.NO_KEYS
});
jsPsych.init({
timeline: timeline,
use_webaudio: false,
default_iti: 500
});
</script>
</html>