add docs for new audio response plugins

This commit is contained in:
Josh de Leeuw 2021-11-23 14:51:55 -05:00
parent 0cc69e0854
commit 5568ca3b26
10 changed files with 494 additions and 20 deletions

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/jspsych@7.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-audio-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-initialize-microphone@1.0.0"></script>
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.0.0/css/jspsych.css">
<style>
.jspsych-btn {margin-bottom: 10px;}
</style>
</head>
<body></body>
<script>
var jsPsych = initJsPsych();
var start = {
type: jsPsychHtmlButtonResponse,
stimulus: '',
choices: ['Run demo']
};
var show_data = {
type: jsPsychHtmlButtonResponse,
stimulus: function() {
var trial_data = jsPsych.data.getLastTrialData().values();
var trial_json = JSON.stringify(trial_data, null, 2);
return `<p style="margin-bottom:0px;"><strong>Trial data:</strong></p>
<pre style="margin-top:0px;text-align:left;">${trial_json}</pre>`;
},
choices: ['Repeat demo']
};
var init_mic = {
type: jsPsychInitializeMicrophone
}
var trial = {
type: jsPsychHtmlAudioResponse,
stimulus: `
<p style="font-size:48px; color:red;">GREEN</p>
<p>Speak the color of the ink.</p>`,
recording_duration: 3500
};
var trial_loop = {
timeline: [trial, show_data],
loop_function: function() {
return true;
}
};
if (typeof jsPsych !== "undefined") {
jsPsych.run([start, init_mic, trial_loop]);
} else {
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
}
</script>
</html>

View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/jspsych@7.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-audio-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-initialize-microphone@1.0.0"></script>
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.0.0/css/jspsych.css">
<style>
.jspsych-btn {margin-bottom: 10px;}
</style>
</head>
<body></body>
<script>
var jsPsych = initJsPsych();
var start = {
type: jsPsychHtmlButtonResponse,
stimulus: '',
choices: ['Run demo']
};
var show_data = {
type: jsPsychHtmlButtonResponse,
stimulus: function() {
var trial_data = jsPsych.data.getLastTrialData().values();
var trial_json = JSON.stringify(trial_data, null, 2);
return `<p style="margin-bottom:0px;"><strong>Trial data:</strong></p>
<pre style="margin-top:0px;text-align:left;">${trial_json}</pre>`;
},
choices: ['Repeat demo']
};
var init_mic = {
type: jsPsychInitializeMicrophone
}
var trial = {
type: jsPsychHtmlAudioResponse,
stimulus: `
<p>Please sing the first few seconds of a song and click the button when you are done.</p>`,
recording_duration: 15000,
allow_playback: true,
on_finish: function(data){
/*fetch('/save-my-data.php', { audio_base64: data.response })
.then((audio_id){
data.response = audio_id;
});*/
// need to fake the server part of this.
data.response = "584j29d01a";
}
};
var trial_loop = {
timeline: [trial, show_data],
loop_function: function() {
return true;
}
};
if (typeof jsPsych !== "undefined") {
jsPsych.run([start, init_mic, trial_loop]);
} else {
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
}
</script>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/jspsych@7.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-audio-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-audio-button-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-initialize-microphone@1.0.0"></script>
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.0.0/css/jspsych.css">
<style>
.jspsych-btn {margin-bottom: 10px;}
</style>
</head>
<body></body>
<script>
var jsPsych = initJsPsych();
var start = {
type: jsPsychHtmlButtonResponse,
stimulus: '',
choices: ['Run demo']
};
var show_data = {
type: jsPsychHtmlButtonResponse,
stimulus: function() {
var trial_data = jsPsych.data.get().last(2).values();
var trial_json = JSON.stringify(trial_data, null, 2);
return `<p style="margin-bottom:0px;"><strong>Trial data:</strong></p>
<pre style="margin-top:0px;text-align:left;">${trial_json}</pre>`;
},
choices: ['Repeat demo']
};
var init_mic = {
type: jsPsychInitializeMicrophone
}
var instruction = {
type: jsPsychHtmlButtonResponse,
stimulus: `
<img src='img/10.gif' style="width:100px; padding: 20px;"></img>
<p>Make up a name for this shape. When you have one in mind, click the button and then say the name aloud.</p>`,
choices: ['I am ready.']
}
var record = {
type: jsPsychHtmlAudioResponse,
stimulus: `
<img src='img/10.gif' style="width:100px; padding: 20px;"></img>
<p>Recording...</p>`,
recording_duration: 1500,
save_audio_url: true
};
var playback = {
type: jsPsychAudioButtonResponse,
stimulus: ()=>{
return jsPsych.data.get().last(1).values()[0].audio_url;
},
prompt: '<p>Click the object the matches the spoken name.</p>',
choices: ['img/9.gif','img/10.gif','img/11.gif','img/12.gif'],
button_html: '<img src="%choice%" style="width:100px; padding: 20px;"></img>'
}
var trial_loop = {
timeline: [instruction, record, playback, show_data],
loop_function: function() {
return true;
}
};
if (typeof jsPsych !== "undefined") {
jsPsych.run([start, init_mic, trial_loop]);
} else {
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
}
</script>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/jspsych@7.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-html-button-response@1.0.0"></script>
<script src="https://unpkg.com/@jspsych/plugin-initialize-microphone@1.0.0"></script>-->
<link rel="stylesheet" href="https://unpkg.com/jspsych@7.0.0/css/jspsych.css">
<style>
.jspsych-btn {margin-bottom: 10px;}
</style>
</head>
<body></body>
<script>
var jsPsych = initJsPsych();
var start = {
type: jsPsychHtmlButtonResponse,
stimulus: '',
choices: ['Run demo']
};
var show_data = {
type: jsPsychHtmlButtonResponse,
stimulus: function() {
var trial_data = jsPsych.data.get().last(1).values();
var trial_json = JSON.stringify(trial_data, null, 2);
return `<p style="margin-bottom:0px;"><strong>Trial data:</strong></p>
<pre style="margin-top:0px;text-align:left;">${trial_json}</pre>`;
},
choices: ['Repeat demo']
};
var init_mic = {
type: jsPsychInitializeMicrophone
}
var trial_loop = {
timeline: [init_mic, show_data],
loop_function: function() {
return true;
}
};
if (typeof jsPsych !== "undefined") {
jsPsych.run([start, trial_loop]);
} else {
document.body.innerHTML = '<div style="text-align:center; margin-top:50%; transform:translate(0,-50%);">You must be online to view the plugin demo.</div>';
}
</script>
</html>

View File

@ -0,0 +1,144 @@
# html-audio-response
This plugin displays HTML content and records audio from the participant via a microphone.
In order to get access to the microphone, you need to use the [initialize-microphone plugin](initialize-microphone.md) on your timeline prior to using this plugin.
Once access is granted for an experiment you do not need to get permission again.
This plugin records audio data in [base 64 format](https://developer.mozilla.org/en-US/docs/Glossary/Base64).
This is a text-based representation of the audio which can be coverted to various audio formats using a variety of [online tools](https://www.google.com/search?q=base64+audio+decoder) as well as in languages like python and R.
**This plugin will generate a large amount of data, and you will need to be careful about how you handle this data.**
Even a few seconds of audio recording will add 10s of kB to jsPsych's data.
Multiply this by a handful (or more) of trials, and the data objects will quickly get large.
If you need to record a lot of audio, either many trials worth or just a few trials with longer responses, we recommend that you save the data to your server immediately after the trial and delete the data in jsPsych's data object.
See below for an example of how to do this.
This plugin also provides the option to store the recorded audio files as [Object URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) via `save_audio_url: true`.
This will generate a URL that is storing a copy of the recorded audio, which can be used for subsequent playback.
See below for an example where the recorded audio is used as the stimulus in a subsequent trial.
This feature is turned off by default because it uses a relatively large amount of memory compared to most jsPsych features.
If you are running an experiment where you need this feature and you are recording lots of audio snippets, you may want to manually revoke the URLs when you no longer need them using [`URL.revokeObjectURL(objectURL)`](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL).
!!! warning
When recording from a microphone your experiment will need to be running over `https://` protocol. If you try to run the experiment locally using the `file://` protocol or over `http://` protocol you will not be able to access the microphone because of [potential security problems](https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/).
## Parameters
In addition to the [parameters available in all plugins](../overview/plugins.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description
----------|------|---------------|------------
stimulus | HTML string | undefined | The HTML content to be displayed.
recording_duration | numeric | 2000 | The maximum length of the recording, in milliseconds. The default value is intentionally set low because of the potential to accidentally record very large data files if left too high. You can set this to `null` to allow the participant to control the length of the recording via the done button, but be careful with this option as it can lead to crashing the browser if the participant waits too long to stop the recording.
stimulus_duration | numeric | null | How long to display the stimulus in milliseconds. The visibility CSS property of the stimulus will be set to `hidden` after this time has elapsed. If this is null, then the stimulus will remain visible until the trial ends.
show_done_button | bool | true | Whether to show a button on the screen that the participant can click to finish the recording.
done_button_label | string | 'Continue' | The label for the done button.
allow_playback | bool | false | Whether to allow the participant to listen to their recording and decide whether to rerecord or not. If `true`, then the participant will be shown an interface to play their recorded audio and click one of two buttons to either accept the recording or rerecord. If rerecord is selected, then stimulus will be shown again, as if the trial is starting again from the beginning.
record_again_button_label | string | 'Record again' | The label for the record again button enabled when `allow_playback: true`.
accept_button_label | string | 'Continue' | The label for the accept button enabled when `allow_playback: true`.
save_audio_url | bool | false | If `true`, then an [Object URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) will be generated and stored for the recorded audio. Only set this to `true` if you plan to reuse the recorded audio later in the experiment, as it is a potentially memory-intensive feature.
## Data Generated
In addition to the [default data collected by all plugins](../overview/plugins.md#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value
-----|------|------
rt | numeric | The time, since the onset of the stimulus, for the participant to click the done button. If the button is not clicked (or not enabled), then `rt` will be `null`.
response | base64 string | The base64-encoded audio data.
stimulus | string | The HTML content that was displayed on the screen.
estimated_stimulus_onset | number | This is an estimate of when the stimulus appeared relative to the start of the audio recording. The plugin is configured so that the recording should start prior to the display of the stimulus. We have not yet been able to verify the accuracy of this estimate with external measurement devices.
audio_url | string | A URL to a copy of the audio data.
## Examples
???+ example "Simple spoken response to a stimulus"
=== "Code"
```javascript
var trial = {
type: jsPsychHtmlAudioResponse,
stimulus: `
<p style="font-size:48px; color:red;">GREEN</p>
<p>Speak the color of the ink.</p>`,
recording_duration: 3500
};
```
=== "Demo"
<div style="text-align:center;">
<iframe src="../../demos/jspsych-html-audio-response-demo1.html" width="90%;" height="600px;" frameBorder="0"></iframe>
</div>
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-html-audio-response-demo1.html">Open demo in new tab</a>
???+ example "Allow playback and rerecording; save data to server immediately"
=== "Code"
```javascript
var trial = {
type: jsPsychHtmlAudioResponse,
stimulus: `
<p>Please sing the first few seconds of a song and click the button when you are done.</p>
`,
recording_duration: 15000,
allow_playback: true,
on_finish: function(data){
fetch('/save-my-data.php', { audio_base64: data.response })
.then((audio_id){
data.response = audio_id;
});
}
};
```
This example assumes that there is a script on your experiment server that accepts the data called `save-my-data.php`. It also assumes that the script will generate a response with an ID for the stored audio file (`audio_id`). In the example, we replace the very long base64 representation of the audio file with the generated ID, which could be just a handful of characters. This would let you link files to responses in data analysis, without having to store long audio files in memory during the experiment.
=== "Demo"
<div style="text-align:center;">
<iframe src="../../demos/jspsych-html-audio-response-demo2.html" width="90%;" height="600px;" frameBorder="0"></iframe>
</div>
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-html-audio-response-demo2.html">Open demo in new tab</a>
???+ example "Use recorded audio as a subsequent stimulus"
=== "Code"
```javascript
var instruction = {
type: jsPsychHtmlButtonResponse,
stimulus: `
<img src='img/10.gif' style="width:100px; padding: 20px;"></img>
<p>Make up a name for this shape. When you have one in mind, click the button and then say the name aloud.</p>
`,
choices: ['I am ready.']
}
var record = {
type: jsPsychHtmlAudioResponse,
stimulus: `
<img src='img/10.gif' style="width:100px; padding: 20px;"></img>
<p>Recording...</p>
`,
recording_duration: 1500,
save_audio_url: true
};
var playback = {
type: jsPsychAudioButtonResponse,
stimulus: ()=>{
return jsPsych.data.get().last(1).values()[0].audio_url;
},
prompt: '<p>Click the object the matches the spoken name.</p>',
choices: ['img/9.gif','img/10.gif','img/11.gif','img/12.gif'],
button_html: '<img src="%choice%" style="width:100px; padding: 20px;"></img>'
}
```
=== "Demo"
<div style="text-align:center;">
<iframe src="../../demos/jspsych-html-audio-response-demo3.html" width="90%;" height="600px;" frameBorder="0"></iframe>
</div>
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-html-audio-response-demo3.html">Open demo in new tab</a>

View File

@ -0,0 +1,45 @@
# initialize-microphone
This plugin asks the participant to grant permission to access a microphone.
If multiple microphones are connected to the participant's device, then it allows the participant to pick which device to use.
Once access is granted for an experiment you do not need to get permission again.
Once the microphone is selected with this plugin it can be accessed with [`jsPsych.pluginAPI.getMicrophoneRecorder()`](dead-link.md).
!!! warning
When recording from a microphone your experiment will need to be running over `https://` protocol. If you try to run the experiment locally using the `file://` protocol or over `http://` protocol you will not be able to access the microphone because of [potential security problems](https://blog.mozilla.org/webrtc/camera-microphone-require-https-in-firefox-68/).
## Parameters
In addition to the [parameters available in all plugins](../overview/plugins.md#parameters-available-in-all-plugins), this plugin accepts the following parameters. Parameters with a default value of *undefined* must be specified. Other parameters can be left unspecified if the default value is acceptable.
Parameter | Type | Default Value | Description
----------|------|---------------|------------
device_select_message | html string | `<p>Please select the microphone you would like to use.</p>` | The message to display when the user is presented with a dropdown list of available devices.
button_label | sting | 'Use this microphone.' | The label for the select button.
## Data Generated
In addition to the [default data collected by all plugins](../overview/plugins.md#data-collected-by-all-plugins), this plugin collects the following data for each trial.
Name | Type | Value
-----|------|------
device_id | string | The [device ID](https://developer.mozilla.org/en-US/docs/Web/API/MediaDeviceInfo/deviceId) of the selected microphone.
## Examples
???+ example "Ask for microphone permission"
=== "Code"
```javascript
var trial = {
type: jsPsychInitializeMicrophone
};
```
=== "Demo"
<div style="text-align:center;">
<iframe src="../../demos/jspsych-initialize-microphone-demo1.html" width="90%;" height="600px;" frameBorder="0"></iframe>
</div>
<a target="_blank" rel="noopener noreferrer" href="../../demos/jspsych-initialize-microphone-demo1.html">Open demo in new tab</a>

View File

@ -24,6 +24,7 @@ Plugin | Description
[external&#8209;html](external-html.md) | Displays an external HTML page (such as a consent form) and lets the subject respond by clicking a button or pressing a key. Plugin can validate their response, which is useful for making sure that a subject has granted consent before starting the experiment.
[free&#8209;sort](free-sort.md) | Displays a set of images on the screen in random locations. Subjects can click and drag the images to move them around the screen. Records all the moves made by the subject, so the sequence of moves can be recovered from the data.
[fullscreen](fullscreen.md) | Toggles the experiment in and out of fullscreen mode.
[html&#8209;audio&#8209;response](html-audio-response.md) | Display an HTML-formatted stimulus and records an audio response via a microphone.
[html&#8209;button&#8209;response](html-button-response.md) | Display an HTML-formatted stimulus and allow the subject to respond by choosing a button to click. The button can be customized extensively, e.g., using images in place of standard buttons.
[html&#8209;keyboard&#8209;response](html-keyboard-response.md) | Display an HTML-formatted stimulus and allow the subject to respond by pressing a key.
[html&#8209;slider&#8209;response](html-slider-response.md) | Display an HTML-formatted stimulus and allow the subject to respond by moving a slider to indicate a value.
@ -32,6 +33,7 @@ Plugin | Description
[image&#8209;button&#8209;response](image-button-response.md) | Display an image and allow the subject to respond by choosing a button to click. The button can be customized extensively, e.g., using images in place of standard buttons.
[image&#8209;keyboard&#8209;response](image-keyboard-response.md) | Display an image and allow the subject to respond by pressing a key.
[image&#8209;slider&#8209;response](image-slider-response.md) | Display an image and allow the subject to respond by moving a slider to indicate a value.
[initialize&#8209;microphone](initialize-microphone.md) | Request permission to use the subject's microphone to record audio and allows the subject to choose which microphone to use if multiple devices are enabled.
[instructions](instructions.md) | For displaying instructions to the subject. Allows the subject to navigate between pages of instructions using keys or buttons.
[maxdiff](maxdiff.md) | Displays rows of alternatives to be selected for two mutually-exclusive categories, typically as 'most' or 'least' on a particular criteria (e.g. importance, preference, similarity). The participant responds by selecting one radio button corresponding to an alternative in both the left and right response columns.
[preload](preload.md) | This plugin loads images, audio, and video files into the browser's memory before they are needed in the experiment, in order to improve stimulus and response timing, and to avoid disrupting the flow of the experiment.

View File

@ -17,7 +17,7 @@
let ar = {
type: jsPsychHtmlAudioResponse,
stimulus: '<p>Speak!</p>',
stimulus: '<div style="width:400px; height: 400px; background-color: red;"></div>',
allow_playback: true,
on_finish: (data) => {
console.log(data);

View File

@ -86,6 +86,7 @@ nav:
- 'external-html': 'plugins/external-html.md'
- 'free-sort': 'plugins/free-sort.md'
- 'fullscreen': 'plugins/fullscreen.md'
- 'html-audio-response': 'plugins/html-audio-response.md'
- 'html-button-response': 'plugins/html-button-response.md'
- 'html-keyboard-response': 'plugins/html-keyboard-response.md'
- 'html-slider-response': 'plugins/html-slider-response.md'
@ -94,6 +95,7 @@ nav:
- 'image-button-response': 'plugins/image-button-response.md'
- 'image-keyboard-response': 'plugins/image-keyboard-response.md'
- 'image-slider-response': 'plugins/image-slider-response.md'
- 'initialize-microphone': 'plugins/initialize-microphone.md'
- 'instructions': 'plugins/instructions.md'
- 'maxdiff': 'plugins/maxdiff.md'
- 'preload': 'plugins/preload.md'

View File

@ -6,22 +6,31 @@ const info = <const>{
/** The HTML string to be displayed */
stimulus: {
type: ParameterType.HTML_STRING,
pretty_name: "Stimulus",
default: undefined,
},
/** How long to show the stimulus. */
stimulus_duration: {
type: ParameterType.INT,
pretty_name: "Stimulus duration",
default: null,
},
/** How long to show the trial. */
recording_duration: {
type: ParameterType.INT,
pretty_name: "Trial duration",
default: 2000,
},
button_label: {
show_done_button: {
type: ParameterType.BOOL,
default: true,
},
done_button_label: {
type: ParameterType.STRING,
default: "Continue",
},
record_again_button_label: {
type: ParameterType.STRING,
default: "Record again",
},
accept_button_label: {
type: ParameterType.STRING,
default: "Continue",
},
@ -29,7 +38,7 @@ const info = <const>{
type: ParameterType.BOOL,
default: false,
},
store_audio_url: {
save_audio_url: {
type: ParameterType.BOOL,
default: false,
},
@ -75,7 +84,9 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
let html = `<div id="jspsych-html-audio-response-stimulus">${trial.stimulus}</div>`;
html += `<p><button class="jspsych-btn" id="finish-trial">${trial.button_label}</button></p>`;
if (trial.show_done_button) {
html += `<p><button class="jspsych-btn" id="finish-trial">${trial.done_button_label}</button></p>`;
}
display_element.innerHTML = html;
}
@ -87,17 +98,20 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
}
private addButtonEvent(display_element, trial) {
display_element.querySelector("#finish-trial").addEventListener("click", () => {
const end_time = performance.now();
this.rt = Math.round(end_time - this.stimulus_start_time);
this.stopRecording().then(() => {
if (trial.allow_playback) {
this.showPlaybackControls(display_element, trial);
} else {
this.endTrial(display_element, trial);
}
const btn = display_element.querySelector("#finish-trial");
if (btn) {
btn.addEventListener("click", () => {
const end_time = performance.now();
this.rt = Math.round(end_time - this.stimulus_start_time);
this.stopRecording().then(() => {
if (trial.allow_playback) {
this.showPlaybackControls(display_element, trial);
} else {
this.endTrial(display_element, trial);
}
});
});
});
}
}
private setupRecordingEvents(display_element, trial) {
@ -165,8 +179,8 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
private showPlaybackControls(display_element, trial) {
display_element.innerHTML = `
<p><audio id="playback" src="${this.audio_url}" controls></audio></p>
<button id="record-again" class="jspsych-btn">Record Again</button>
<button id="continue" class="jspsych-btn">Continue</button>
<button id="record-again" class="jspsych-btn">${trial.record_again_button_label}</button>
<button id="continue" class="jspsych-btn">${trial.accept_button_label}</button>
`;
display_element.querySelector("#record-again").addEventListener("click", () => {
@ -194,7 +208,7 @@ class HtmlAudioResponsePlugin implements JsPsychPlugin<Info> {
estimated_stimulus_onset: Math.round(this.stimulus_start_time - this.recorder_start_time),
};
if (trial.store_audio_url) {
if (trial.save_audio_url) {
trial_data.audio_url = this.audio_url;
} else {
URL.revokeObjectURL(this.audio_url);