diff --git a/HeadphoneCheck.js b/HeadphoneCheck.js index aa6a8d4..ad014d2 100644 --- a/HeadphoneCheck.js +++ b/HeadphoneCheck.js @@ -29,6 +29,7 @@ Contact Ray Gonzalez raygon@mit.edu or Kevin J. P. Woods kwoods@mit.edu // NOTE: DON'T CHANGE VALUES HERE. Use a similar config object to // override any default values you wish to change. var headphoneCheckDefaultConfig = {jsonPath: undefined, + audioVolume: 1.0, totalTrials: 6, trialsPerPage: 3, correctThreshold: 5/6, @@ -306,9 +307,9 @@ Contact Ray Gonzalez raygon@mit.edu or Kevin J. P. Woods kwoods@mit.edu //add in the audio source $('', { - id: 'hc-audio-' + stimID, - src: stimFile - }).appendTo($('#' + divID)); + id: 'hc-audio-' + stimID, + src: stimFile + }).appendTo($('#' + divID)); if (headphoneCheckConfig.debug) { $('
', { @@ -437,6 +438,7 @@ Contact Ray Gonzalez raygon@mit.edu or Kevin J. P. Woods kwoods@mit.edu $('#hc-play-button-border-' + stimID).css('border-color', trialBackgroundColor); // play and set state + $('#' + stimFile).get(0).volume = headphoneCheckConfig.audioVolume; $('#' + stimFile).get(0).play(); st_isPlaying = true; // hack to disable responding during playback @@ -466,6 +468,7 @@ Contact Ray Gonzalez raygon@mit.edu or Kevin J. P. Woods kwoods@mit.edu st_isPlaying = false; $('#hc-calibration-continue-button').prop('disabled', false); }); + $('#' + calibrationID).get(0).volume = headphoneCheckConfig.audioVolume; $('#' + calibrationID).get(0).play(); st_isPlaying = true; } diff --git a/README.md b/README.md index 37350ec..cdd846a 100644 --- a/README.md +++ b/README.md @@ -152,6 +152,7 @@ To customize the headphone check, you can pass in an object of property:value pa headphoneCheckDefaultConfig = { jsonPath: undefined, // URL to json file containing stimulus/resource URLs. + audioVolume: 1.0, // Volume of the stimuli and the calibration sound, relative to their default (e.g., a setting of 0.5 plays the sounds at half volume). totalTrials: 6, // Total number of trials. trialsPerPage: 3, // Number of trials to render on a single page. correctThreshold: 5/6, // Minimum percentage of correct responses required to pass the headphone screening.