Inteligibility task: audio and survey text plugin! #1802
Replies: 1 comment
-
Hi @gustavoestivalet! Sorry for the super-slow response. 😦 If you don't want the audio and survey-text parts to go one after another, then the best way to do this is to create a new plugin. If it were me, I would probably start with the audio-keyboard-response plugin, and modify it to (1) add a Add a jsPsych/plugins/jspsych-survey-text.js Lines 20 to 63 in e917fab The preamble , button_label and autocomplete parameters will probably be useful too. But note that the preamble parameter here is similar to the prompt parameter from the audio plugin, so you just want to keep one of the two.jsPsych/plugins/jspsych-survey-text.js Lines 64 to 82 in e917fab In plugin.trial, set question defaults: jsPsych/plugins/jspsych-survey-text.js Lines 87 to 101 in e917fab Create an HTML string variable that contains the form element, question prompt(s) and text input box(es): jsPsych/plugins/jspsych-survey-text.js Lines 109 to 142 in e917fab Focus on the first input text box when the page loads: jsPsych/plugins/jspsych-survey-text.js Line 146 in e917fab Create an event listener for the form's submit event that validates the response (i.e. produces a pop-up on the page if a question is required but nothing is entered), saves the question names and responses, and ends the trial. You might want to add other information to the trial data here, like the audio stimulus: jsPsych/plugins/jspsych-survey-text.js Lines 148 to 182 in e917fab In the audio plugin that you're modifying, the form/question HTML would go inside of the setupTrial function and would be added to the page somewhere around here. Instead of these lines, you would just have display_element.innerHTML = html; . (You could keep the audio plugin's prompt parameter instead of the preamble , but you would still need to change this so that the prompt is added to your larger HTML string variable that also contains the form etc.):jsPsych/plugins/jspsych-audio-keyboard-response.js Lines 107 to 110 in e917fab And you could delete the audio plugin's end_trial function (since this is now handled by the form's submit event handler) as well as the keyboard listener in these lines:jsPsych/plugins/jspsych-audio-keyboard-response.js Lines 136 to 206 in e917fab Sorry if this is a bit of a pain, but it's probably not as difficult as it seems - just a lot of copy/pasting and deleting code. I think we're planning to add an audio extension in a future release (see #1640) that would allow people to play audio on top of any existing plugin, which will make this much easier. |
Beta Was this translation helpful? Give feedback.
-
Hello, guys,
How are you going? I am fine, and doing new and cool experiments with jsPsych!
Simple question: How can I play an audio in a survey text? Or put a survey text in an audio playin?
I mean, I want to make an inteligibility task. The participant has to listen an audio and write what s/he heard. Thus, I need a mix of audio-button-response/survey-text. I could do it using both plug-ins in a procedure, but I would like to have the space to write already in the onset of the audio, thus, participants can start to write even before the audio finishes, providing better precision for the writing RT.
Thank you very much for your attention and efforts!
Best regards,
Gustavo Estivalet
Beta Was this translation helpful? Give feedback.
All reactions