Skip to content

音訊標註

使用波形視覺化和播放控制元件標註音訊檔案。

Potato 2.0 提供強大的音訊標註功能,包括由 Peaks.js 驅動的波形視覺化、片段標註和全面的鍵盤快捷鍵。

用例

  • 語音轉錄和稽核
  • 說話人分離
  • 音樂分析
  • 音訊事件檢測
  • 語音情感識別
  • 呼叫中心品質保證

啟用音訊支援

在配置中新增 audio_annotation 部分:

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: audio_segments
    description: "Segment and label the audio"
    labels:
      - Speech
      - Music
      - Silence
      - Noise

操作模式

Potato 支援三種音訊標註模式:

標籤模式

分割音訊併為每個片段分配類別標籤:

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: speaker_diarization
    mode: label
    description: "Identify speakers in the audio"
    labels:
      - Speaker A
      - Speaker B
      - Overlap

問題模式

為每個片段新增標註問題:

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: speech_quality
    mode: questions
    description: "Evaluate speech segments"

混合模式

將標籤與每片段問題結合:

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: full_analysis
    mode: both
    description: "Label and analyze audio segments"
    labels:
      - Speech
      - Music
      - Noise

配置選項

基本設定

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: segments
    description: "Create audio segments"
    labels:
      - Label A
      - Label B
 
    # Optional constraints
    min_segments: 1
    max_segments: 50

鍵盤快捷鍵

標籤可以使用數字鍵 1-9 分配:

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: speakers
    labels:
      - Speaker A  # Press 1
      - Speaker B  # Press 2
      - Overlap    # Press 3

標籤顏色

自定義片段顏色:

yaml
annotation_schemes:
  - annotation_type: audio_annotation
    name: segments
    labels:
      - Speech
      - Music
      - Silence

波形效能

為了在長音訊檔案中獲得最佳效能,請安裝 BBC audiowaveform 工具:

bash
# macOS
brew install audiowaveform
 
# Ubuntu/Debian
sudo apt-get install audiowaveform
 
# Or build from source
# https://github.com/bbc/audiowaveform

這將啟用伺服器端波形生成。沒有它,將使用客戶端生成(適用於 30 分鐘以內的檔案)。

波形快取

配置快取以獲得更好的效能:

yaml
audio_config:
  cache_dir: "audio_cache/"
  precompute_depth: 100  # Pre-generate waveforms for first N items
  client_fallback_max_duration: 1800  # 30 minutes in seconds

資料格式

簡單音訊引用

json
[
  {"id": "1", "audio_path": "audio/recording_001.wav"},
  {"id": "2", "audio_path": "audio/recording_002.wav"}
]
yaml
data_files:
  - "data/audio_data.json"
 
item_properties:
  id_key: id
  audio_key: audio_path

帶轉錄文本

json
[
  {
    "id": "1",
    "audio_path": "audio/call_001.wav",
    "transcript": "Hello, how can I help you today?"
  }
]

輸出格式

標註與片段時間戳一起儲存:

json
{
  "id": "audio_1",
  "annotations": {
    "segments": [
      {
        "start": 0.0,
        "end": 2.5,
        "label": "Speaker A",
        "questions": {
          "clarity": 4,
          "emotion": "Neutral"
        }
      },
      {
        "start": 2.5,
        "end": 5.2,
        "label": "Speaker B"
      }
    ]
  }
}

鍵盤快捷鍵

Potato 提供豐富的鍵盤快捷鍵以實現高效標註:

快捷鍵操作
Space播放/暫停
[在當前位置設定片段起點
]在當前位置設定片段終點
1-9為當前片段分配標籤
Delete刪除當前片段
Left Arrow後退 5 秒
Right Arrow前進 5 秒
Up Arrow放大
Down Arrow縮小
Home跳到開頭
End跳到結尾
+加快播放速度
-減慢播放速度

示例配置

說話人分離

yaml
task_name: "Speaker Diarization"
task_dir: "."
port: 8000
 
data_files:
  - "data/recordings.json"
 
item_properties:
  id_key: id
  audio_key: audio_path
 
annotation_schemes:
  - annotation_type: audio_annotation
    name: speakers
    mode: label
    description: "Identify who is speaking"
    labels:
      - Speaker 1
      - Speaker 2
      - Speaker 3
      - Overlap
      - Silence
    min_segments: 1
 
audio_config:
  cache_dir: "audio_cache/"
  precompute_depth: 50
 
output_annotation_dir: "output/"
output_annotation_format: "json"
allow_all_users: true

轉錄稽核

yaml
task_name: "Transcription Quality Review"
task_dir: "."
port: 8000
 
data_files:
  - "data/transcripts.json"
 
item_properties:
  id_key: id
  text_key: transcript
  audio_key: audio_path
 
annotation_schemes:
  - annotation_type: audio_annotation
    name: errors
    mode: questions
    description: "Mark transcription errors"
 
  - annotation_type: radio
    name: overall_accuracy
    description: "Overall transcript accuracy"
    labels:
      - Accurate
      - Minor errors
      - Major errors
      - Unusable
 
output_annotation_dir: "output/"
output_annotation_format: "json"

呼叫中心品質保證

yaml
task_name: "Call Center Quality Assurance"
task_dir: "."
port: 8000
 
data_files:
  - "data/calls.json"
 
item_properties:
  id_key: call_id
  audio_key: recording_path
 
annotation_schemes:
  # Segment-level annotation
  - annotation_type: audio_annotation
    name: conversation
    mode: both
    description: "Segment the conversation"
    labels:
      - Agent
      - Customer
      - Hold
      - Silence
 
  # Call-level assessment
  - annotation_type: likert
    name: professionalism
    description: "Agent professionalism"
    size: 5
    min_label: "Poor"
    max_label: "Excellent"
 
  - annotation_type: likert
    name: resolution
    description: "Issue resolution"
    size: 5
    min_label: "Unresolved"
    max_label: "Fully resolved"
 
  - annotation_type: multiselect
    name: issues
    description: "Select any issues observed"
    labels:
      - Long hold time
      - Agent interrupted
      - Incorrect information
      - Missing greeting
      - Unprofessional language
 
  - annotation_type: text
    name: notes
    description: "Additional observations"
    rows: 4
 
output_annotation_dir: "output/"
output_annotation_format: "json"

支援的音訊格式

  • WAV(推薦,品質最佳)
  • MP3
  • OGG
  • FLAC
  • M4A
  • WebM

效能提示

  1. 安裝 audiowaveform - 對長音訊檔案至關重要
  2. 啟用快取 - 使用 cache_dir 儲存預生成的波形
  3. 使用 WAV 以保證品質 - 壓縮格式可能引入偽影
  4. 預處理音訊 - 標準化音量、裁剪不必要的靜音
  5. 注意檔案大小 - 大檔案會減慢載入速度
  6. 使用預計算 - 為初始實例預生成波形

故障排除

波形未載入

  • 檢查音訊檔案路徑是否正確
  • 驗證檔案格式是否支援
  • 為長檔案安裝 audiowaveform
  • 檢查瀏覽器控制台的錯誤資訊

效能緩慢

  • 安裝 audiowaveform 工具
  • 啟用波形快取
  • 減小音訊檔案大小
  • 使用 precompute_depth 設定

片段未儲存

  • 確保輸出目錄可寫
  • 檢查標註格式配置
  • 驗證片段有起始和結束時間