Guide

Voice recording

Collect participant audio with automatic S3 upload, using a copy-paste AI prompt.

Collect read-aloud or free-speech audio from participants. Recordings upload to S3 automatically; trial data stores an audio_s3_key reference rather than raw bytes.

Preview mode does not upload audio. Test recordings in a real participant session after publishing.

How it works

  1. 1

    Open your experiment in the editor

    Go to Dashboard → your project → open an experiment. Use the AI panel on the right to describe changes.

    Voice uploads work in real participant sessions, not in Preview mode.

  2. 2

    Paste the AI prompt below

    Copy the prompt from this page into the AI chat. It tells the builder how to record audio and upload to S3 using the platform protocol.

  3. 3

    Review the generated code

    The AI should add upload helpers and jsPsych trials with a recording UI. Adjust prompts and fields in config.js as needed.

  4. 4

    Publish and test with a real session

    Publish your project and run it via /take/:projectId (not preview). Allow microphone access when prompted. Trial data will include audio_s3_key pointing to the recording in S3.

AI prompt

Voice recording prompt

Paste this into the experiment editor AI chat. It implements the platform upload protocol correctly.

Add voice recording trials to this experiment using the VibeMyExpt platform audio upload protocol.

Requirements:

1. In experiment.js, add these helper functions (use window.opener || window.parent for postMessage):
   - requestAudioUploadUrl(filename, contentType): sends vibemyexpt:request_upload_url with a unique request_id; listens for vibemyexpt:upload_url_ready or vibemyexpt:upload_url_error; returns { uploadUrl, s3Key }.
   - uploadAudioBlob(blob, filename, contentType): calls requestAudioUploadUrl, then PUTs the blob to uploadUrl with the Content-Type header set to the contentType argument; returns s3_key.
   - recordAudio(maxDurationMs): uses navigator.mediaDevices.getUserMedia({ audio: true }) and MediaRecorder. You may record with audio/webm;codecs=opus when supported, but return the Blob with type "audio/webm" — new Blob(chunks, { type: "audio/webm" }).

2. Content type must be "audio/webm" (no codec suffix) at all three points: the content_type in the upload-URL request, the PUT header, and the Blob type. The signed URL requires them to match, so always pass the literal "audio/webm" — never blob.type.

3. Add jsPsych voice-recording trials as described in my prompt:
   - UI: Start Recording / Stop Recording buttons (or equivalent).
   - On stop: upload with uploadAudioBlob(blob, "recording.webm", "audio/webm").
   - On trial finish, set the data fields the researcher needs (e.g. prompt, audio_s3_key, recording_duration_ms). Use custom field names/values in CONFIG — define them based on my prompt, do not invent fixed enums unless I specify them. If upload fails, set upload_error.

4. Do NOT send raw audio bytes in trial JSON — only store audio_s3_key after S3 upload.

5. Keep prompts, durations, and labels in config.js on CONFIG. Reference CONFIG in experiment.js.

6. Ensure initJsPsych already has on_data_update posting vibemyexpt:trial_data and on_finish posting vibemyexpt:experiment_complete.

Allowed upload types: audio/webm with filename recording.webm.

What gets saved in trial data

  • audio_s3_key — S3 path to the recording (required).
  • Any other fields you define (e.g. prompt , recording_duration_ms , custom labels in CONFIG).