錄製標註者的音訊回答
讓標註者為每個條目錄制、回放並重新錄製一段口頭音訊,然後把這些音訊轉成條目,供其他人評分。
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 式評分
- 跟拍 - 在音訊播放時按音訊的時間記錄的輕觸
- 音訊標註 - 對已有音訊分段並新增標籤
- 有聲思考模式 - 與其他答案一起轉寫的口頭理由
- 實例顯示 - 在方案上方顯示包括音訊在內的條目欄位
有關實現細節,請參閱源文件。