0.1.0 • Published 11 months ago

@pcllab/plugin-audio-response v0.1.0

Weekly downloads
-
License
-
Repository
github
Last release
11 months ago

audio-response-plugin

This is an audio response plugin that can accept button and keyboard responses.

It is a combination of jsPsych's audio-keyboard-response and audio-button-response plugins.

Install

With NPM:

npm i @pcllab/plugin-audio-response
import audioResponse from "@pcllab/plugin-audio-response";

With CDN:

Other dependencies (react, react-dom, tailwind) need to loaded separately.

<script src="https://unpkg.com/@pcllab/plugin-audio-response"></script>

Use

const trial = {
  type: audioResponse,
  stimulus: "audio.mp3"
  keyboard: {
    choices: ["y", "n"]
  }
  button: {
    choices: ["Yes", "No"]
  }
};

Parameters

ParameterTypeDescriptionExamples
keyboardobjectAllow keyboard responses(default)undefined{}
keyboard.choicesstring[] | "ALL_KEYS" | "NO_KEYS"Restrict keyboard responses(default)ALL_KEYS["y", "n"]
buttonobjectAllow button responses(default)undefined{}
button.choicesstring[]Button text(default)undefined["y", "n"]
button.htmlstring | string[]One HTML string for all buttons or list of strings to use for each choice, where %choice% is replaced by the corresponding choice.(default)"<button class="jspsych-btn">%choice%</button>"["<button class="custom-class">1. %choice%</button>", "<button class="custom-class">2. %choice%</button>"]
button.margin_verticalstringVertical padding style value(default)"0px""12px"
button.margin_horizontalstringHorizontal padding style value(default)"8px""0px"
prompthtml stringArbitrary HTML to show above the input(default)""<h1>Here is a prompt </h1>

Data Generated

In addition to the default data collected by all plugins, this plugin collects the following data.

NameTypeValue
responsestringThe button choice or key pressed
rtnumberTime in ms between audio starting and response
0.1.0

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago