录制标注者的音频回答
让标注者为每个条目录制、回放并重新录制一段口头音频,然后把这些音频转成条目,供其他人评分。
v2.15.0 新增
record_audio 方案让每位标注者为一个条目录制一段简短的音频,听一遍,并重新录制,直到满意为止。当你收集的数据是参与者产生的语音时,请使用这个方案,例如在指定情境中朗读的短语,或对问题的口头回答。Potato 把每段音频保存为研究输出目录下的一个音频文件。随后 potato recordings export 命令把这些音频复制到第二个任务中,供其他人评分。
配置
下面的配置要求每位标注者按自己在条目所描述的情境中会说的方式说一个短语。15 秒的限制足够说一个句子,min_seconds: 0.5 会丢弃在标注者开口之前就停止的一次录音:
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: truedata/phrases.jsonl 的每一行包含一个短语及其情境。Potato 把条目的文本显示在方案上方,实例显示也可以显示其他条目字段:
{"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."}选项
record_audio 选项 | 默认值 | 含义 |
|---|---|---|
name | 必填 | 方案名称,也是答案存储时使用的键 |
description | 必填 | 显示在"录制"按钮上方的说明 |
max_seconds | 60 | 最长的一次录音,单位为秒。到达上限时录音自动停止。Potato 最多接受 600 |
min_seconds | 0 | 保留的最短录音,单位为秒。页面会丢弃更短的录音,并请标注者重新录制。必须小于 max_seconds |
allow_rerecord | true | 设为 false 时,一次录音保存之后"录制"按钮消失,服务器会拒绝同一条目的第二次录音 |
label_requirement | 无 | required: true 让标注者停留在条目上,直到保存了一次录音 |
录制一次
方案显示一个"录制"按钮和一个计时器,一旦有录音就加上一个音频播放器。一次录音要经过三个步骤:
- 标注者按下 Record。第一次时,浏览器会请求使用麦克风的权限。
- 标注者说话,然后按下 Stop。录音期间,计时器显示到目前为止的长度,并与
max_seconds对照。 - 录音上传并出现在播放器中。Record again 用新的录音替换这一次录音。
浏览器只在 https 或 localhost 下把麦克风交给页面。通过普通 http 从另一台主机提供的研究无法录音。potato deploy up 和 potato share 都通过 HTTPS 提供研究(见在本地或云端运行 Potato),终止 TLS 的反向代理也可以。标注者屏蔽麦克风时,方案显示"Recording needs access to a microphone",且不录制任何内容。标注者随后可以在浏览器的站点设置中允许麦克风,再按下 Record。
音频的存储与访问
Potato 把每次录音以浏览器录制的格式保存为 <output_annotation_dir>/recordings/<annotator>/ 下的文件。Chrome 和 Firefox 录制 WebM 或 Ogg Opus,Safari 录制 MP4。每个条目保留最新的三次录音,第四次到来时最早的一次被删除。标注是一个很小的 JSON 字符串,指向最新的一次录音,存放在标签 recording 下:
{"production": {"recording": "{\"file\": \"alice_3f2a9c01de/phrase_1__production__9b31c0de__20261201T140312004118.webm\", \"duration\": 3.42, \"mime\": \"audio/webm\", \"takes\": 2}"}}file 是该次录音在 recordings 文件夹下的路径,文件夹名由用户名加一个短哈希组成。duration 是该次录音的长度,单位为秒,takes 统计标注者为该条目录制了多少次。
声音的录音属于个人数据。服务器只向录制者本人和管理员播放录音。任何其他已登录的标注者会得到 403,没有会话的请求会得到 401。保存的答案必须指向标注者自己的某段录音,否则服务器会拒绝保存。请让输出目录与参与者的其他数据一样保持私密,并在同意书文字中说明会录制声音,以及这些录音将如何使用。
在下面五种情况下,服务器会拒绝上传:
- 录音大于 25 MB。
- 录音比
max_seconds长出两秒以上,或短于min_seconds。 - 字节不属于浏览器声明的音频格式。
- 条目不在研究中。
allow_rerecord为false,而标注者已经有该条目的一次录音。
随后页面会显示服务器的消息,上传没有到达服务器时则显示"The recording could not be saved"。
在第二个任务中为录音评分
potato recordings export 把每段录音复制到另一个任务的文件夹中,并为每段录音写出一个条目。请在研究的文件夹中用研究自己的配置运行该命令,因为命令是通过该配置的 output_annotation_dir 找到音频的:
potato recordings export config.yaml --to ../rating-task命令写出 ../rating-task/recordings.jsonl,并把音频复制到 ../rating-task/media/recordings/。每个条目如下所示:
{"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 保存一个稳定的化名(speaker_1、speaker_2,依此类推)。传入 --names 可以改为在该字段中写入每位标注者的用户名。source_id 和 schema 给出这段音频所回答的条目和方案,prompt 复制来源条目的文本。除非评分任务显示 recorded_by,评分者既看不到化名,也看不到用户名。
下面的评分任务显示提示、播放音频,并要求给出五点李克特量表上的评分。把配置保存在 ../rating-task 中,并从该文件夹启动 Potato:
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 在条目所指的 /media/recordings/ 路径下提供复制过来的音频。更多人录音之后,请再次运行导出。该命令会重写 recordings.jsonl,并复制新的音频。
示例
Potato 的发行版包含一个短语录制示例。请在 Potato 检出目录的根目录下启动示例,在浏览器中打开 http://localhost:8000,然后按下 Record:
potato start examples/audio/record-audio/config.yaml -p 8000延伸阅读
- 听力测试 - 音频片段的 MUSHRA 和 P.808 式评分
- 跟拍 - 在音频播放时按音频的时间记录的轻触
- 音频标注 - 对已有音频分段并添加标签
- 有声思考模式 - 与其他答案一起转写的口头理由
- 实例显示 - 在方案上方显示包括音频在内的条目字段
有关实现细节,请参阅源文档。