This automated guide takes you through the steps of adding a Headphones Check to your study hosted on Pavlovia. It assumes that you have made your study using PsychoPy, and used the Export HTML feature of PsychoPy to produce the Javascript file.
This is designed for PsychoPy
versions 2020.2.10 and 2021.1.1 or newer. Other versions of PsychoPy may not be compatible.
Depending on the features of your study and the version of PsychoPy that you are using, your JavaScript file might not be compatible with this guide.
For the methodology of the Headphones Check, see this paper. The JavaScript implementation and documentation are on GitHub.
1. Check your PsychoPy study for name clashes
Make sure that your study does not have anything named
HeadphonesCheck
or similar. This includes any component names and variables.
Any clashes are likely to result in unrecoverable errors and loss of data.
This guide adds code to import the
HeadphonesCheck
class, create an instance of the class called
headphonesCheck
,
and add a function called
handleHeadphonesCheckResult
to handle the result of the check. If you choose to save the results, the results are saved in a column called
HeadphonesCheckResults
in JSON format.
Please ensure that you do not use any of these names in your study.
2. Export HTML from PsychoPy
Open your study in the
PsychoPy Builder, then go to
File >
Export HTML.
If successfully exported, you will have a new JavaScript file in your folder where your PsychoPy study is saved.
The JavaScript file is typically called
name of your study.js
The file ending in
-legacy-browsers.js
that PsychoPy creates at the same time is not compatible with this automated guide.
If you wish to use the Headphones Check with this file specifically, refer to
the documentation on GitHub to manually add it to your
-legacy-browsers.js
file.
You can still continue to use this guide for the non-legacy file.
3. Upload your
name of your study.js
to add the Headphones Check code
Open the folder where your PsychoPy study is saved, and Drag and Drop your
name of your study.js
file into the box below.
Alternatively, open your file, copy the entirety of its contents, click
Paste contents and paste it into the text box that appears.
4. Customize your Headphones Check
5. Choose what happens if the Headphones Check is failed
6. Download your new JavaScript file
Review and download your new Headphones Check.
7. Replace your original
name of your study.js
file with the new file
Make sure that the file names are identical when replacing the original file.
8. Put your sound files in the correct location
The
stimuli_HugginsPitch
folder containing the sound files should be next to your
index.html
file.