Recording Audio Responses from Annotators
Have annotators record, play back, and re-record one spoken clip per item, then turn the clips into items for other people to rate.
New in v2.15.0
The record_audio scheme has each annotator record a short clip for an item, listen to the clip, and record again until satisfied. Use the scheme when the data you collect is speech that participants produce, such as a phrase read in an assigned context or a spoken answer to a question. Potato saves every clip as an audio file under the study's output directory. The potato recordings export command then copies the clips into a second task for other people to rate.
Configuration
The config below asks each annotator to say a phrase as the annotator would say the phrase in the situation the item describes. A 15-second limit leaves room for one sentence, and min_seconds: 0.5 throws away a take stopped before the annotator spoke:
annotation_task_name: "Say it in context"
task_dir: .
data_files:
- data/phrases.jsonl
item_properties:
id_key: id
text_key: text
output_annotation_dir: annotation_output
user_config:
allow_all_users: true
annotation_schemes:
- annotation_type: record_audio
name: production
description: "Record the phrase above as you would say it in this situation"
max_seconds: 15
min_seconds: 0.5
allow_rerecord: true
label_requirement:
required: trueEach line of data/phrases.jsonl has one phrase and the phrase's context. Potato shows the item's text above the scheme, and Instance Display can show other item fields as well:
{"id": "phrase_1", "text": "\"Oh, it's you.\" You open the door expecting a delivery, and it is an old friend you have not seen in ten years."}Options
record_audio option | Default | Meaning |
|---|---|---|
name | required | Scheme name, also the key the answer is stored under |
description | required | The instruction shown above the Record button |
max_seconds | 60 | Longest take, in seconds. Recording stops by itself at the limit. Potato accepts at most 600 |
min_seconds | 0 | Shortest take kept, in seconds. The page discards a shorter take and asks the annotator to record again. Must be less than max_seconds |
allow_rerecord | true | With false, the Record button disappears once a take is saved, and the server refuses a second take for the same item |
label_requirement | none | required: true keeps the annotator on the item until a take is saved |
Recording a take
The scheme shows a Record button and a timer, and adds an audio player once a take exists. One take goes through three steps:
- The annotator presses Record. On the first take, the browser asks for permission to use the microphone.
- The annotator speaks, then presses Stop. During the take, the timer shows the length so far against
max_seconds. - The take uploads and appears in the player. Record again replaces the take with a new take.
Browsers give a page the microphone only over https or on localhost. A study served over plain http from another host cannot record. potato deploy up and potato share both serve a study over HTTPS (see Running Potato Locally or in the Cloud), and a reverse proxy that terminates TLS works as well. When an annotator blocks the microphone, the scheme shows "Recording needs access to a microphone" and records nothing. The annotator can then allow the microphone in the browser's site settings and press Record again.
Clip storage and access
Potato saves each take as a file under <output_annotation_dir>/recordings/<annotator>/, in the format the browser records. Chrome and Firefox record WebM or Ogg Opus, and Safari records MP4. Potato keeps the three latest takes for each item and deletes the oldest take when a fourth arrives. The annotation is a small JSON string that names the latest take, stored under the label recording:
{"production": {"recording": "{\"file\": \"alice_3f2a9c01de/phrase_1__production__9b31c0de__20261201T140312004118.webm\", \"duration\": 3.42, \"mime\": \"audio/webm\", \"takes\": 2}"}}file is the take's path under the recordings folder, and the folder name joins the username to a short hash. duration is the take's length in seconds, and takes counts how many times the annotator recorded the item.
Recordings of voices are personal data. The server plays a recording only to the annotator who made the recording and to admins. Any other signed-in annotator gets a 403, and a request with no session gets a 401. A saved answer must name one of the annotator's own recordings, or the server refuses the save. Keep the output directory as private as the rest of your participants' data, and say in the consent text that voices are recorded and how the recordings will be used.
The server refuses an upload in five cases:
- The take is larger than 25 MB.
- The take is more than two seconds longer than
max_seconds, or shorter thanmin_seconds. - The bytes are not in the audio format the browser declared.
- The item is not in the study.
allow_rerecordisfalseand the annotator already has a take for the item.
The page then shows the server's message, or "The recording could not be saved" when the upload did not reach the server.
Rating the recordings in a second task
potato recordings export copies every recording into another task's folder and writes one item per recording. Run the command from the study's folder with the study's own config, because the command finds the clips through the config's output_annotation_dir:
potato recordings export config.yaml --to ../rating-taskThe command writes ../rating-task/recordings.jsonl and copies the audio into ../rating-task/media/recordings/. Each item has the fields below:
{"id": "rec_6b1f0c2d9a7e", "audio": "/media/recordings/rec_6b1f0c2d9a7e.webm", "source_id": "phrase_1", "schema": "production", "recorded_by": "speaker_1", "duration": 3.42, "prompt": "\"Oh, it's you.\" You open the door expecting a delivery, and it is an old friend you have not seen in ten years."}recorded_by is a stable pseudonym (speaker_1, speaker_2, and so on). Pass --names to put each annotator's username in the field instead. source_id and schema name the item and scheme the clip answered, and prompt copies the source item's text. Raters see neither the pseudonym nor the username unless the rating task displays recorded_by.
The rating task below shows the prompt, plays the clip, and asks for a rating on a five-point Likert scale. Save the config in ../rating-task and start Potato from the same folder:
annotation_task_name: "Rate the productions"
task_dir: .
output_annotation_dir: annotation_output
media_directory: media
data_files:
- recordings.jsonl
item_properties:
id_key: id
text_key: prompt
user_config:
allow_all_users: true
instance_display:
fields:
- key: prompt
type: text
- key: audio
type: audio
annotation_schemes:
- annotation_type: likert
name: fit
description: "How well does the way it is said fit the situation?"
size: 5
min_label: Not at all
max_label: Perfectlymedia_directory: media serves the copied clips at the /media/recordings/ paths the items name. After more people have recorded, run the export again. The command rewrites recordings.jsonl and copies any new clips.
Example
Potato's release includes a phrase-recording example. Start the example from the root of a Potato checkout, open http://localhost:8000 in the browser, and press Record:
potato start examples/audio/record-audio/config.yaml -p 8000Further reading
- Listening Tests - MUSHRA and P.808-style ratings of audio clips
- Tap-Along - Taps recorded in time with audio as the audio plays
- Audio Annotation - Segmenting and labeling existing audio
- Think-Aloud Mode - Spoken rationales transcribed alongside other answers
- Instance Display - Showing item fields, including audio, above the schemes
For implementation details, see the source documentation.