An easy-to-use platform for EEG experimentation in the classroom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

streaming jsPsych marker with lsl

authored by

Yury Shevchenko and committed by
Teon L Brooks
977a9c6b 7714c36a

+11 -13
+11 -13
app/utils/jspsych/functions.js
··· 15 15 16 16 // create and open an outlet to stream data 17 17 const info = lsl.create_streaminfo( 18 - 'Dummy', 18 + 'jsPsych', 19 19 'Marker', // type 20 20 1, // number of channels 21 - 10, // sample rate in 1 sec. 21 + 0, // irregular sample rate 22 22 lsl.channel_format_t.cft_float32, 23 - 'Dummy Marker Device' 23 + 'jspsych_brainwaves' // source_id 24 24 ); 25 25 const desc = lsl.get_desc(info); 26 - lsl.append_child_value(desc, 'manufacturer', 'Random Inc.'); 26 + lsl.append_child_value(desc, 'manufacturer', 'BrainWaves'); 27 27 const channels = lsl.append_child(desc, 'channels'); 28 28 const channel = lsl.append_child(channels, 'channel'); 29 29 lsl.append_child_value(channel, 'type', 'Marker'); ··· 140 140 if (trial.id === 'trial') { 141 141 return { 142 142 ...trial, 143 - on_start: e => { 144 - if (e) { 145 - const correctResponse = parseFloat(e.correct_response); 146 - lsl.push_sample_ft( 147 - outlet, 148 - new lsl.FloatArray([correctResponse]), 149 - lsl.local_clock() 150 - ); 151 - } 143 + on_start: () => { 144 + const eventType = jsPsych.timelineVariable('eventTypeVar')() || 0; 145 + lsl.push_sample_ft( 146 + outlet, 147 + new lsl.FloatArray([eventType]), 148 + lsl.local_clock() 149 + ); 152 150 eventCallback( 153 151 jsPsych.timelineVariable('eventTypeVar')(), 154 152 new Date().getTime()