탐색으로 건너뛰기

멀티채널 텍스트 음성 변환

이 가이드에서는 텍스트 음성 변환 API에서 멀티채널 전사 모드를 사용하는 방법을 안내합니다.

사용 방법 가이드 · 텍스트 음성 변환 빠른 시작을 완료했다고 가정합니다.

개요

멀티채널 텍스트 음성 변환 기능을 사용하면 각 채널에 서로 다른 화자가 포함된 오디오 파일을 전사할 수 있습니다. 화자가 별도의 오디오 채널로 분리되어 녹음된 경우에 특히 유용하며, 화자 분리 없이도 더 깔끔한 전사 결과를 제공합니다.

각 채널은 독립적으로 처리되며 채널 번호를 기준으로 화자 ID가 자동 할당됩니다(채널 0 → speaker_0, 채널 1 → speaker_1 등). 시스템은 입력 오디오 파일에서 개별 채널을 추출하고 병렬로 전사합니다. 기본적으로 API는 채널당 하나의 전사문을 반환합니다. 대신 모든 채널을 시작 시간순으로 정렬된 하나의 목록으로 병합하고 각 단어에 channel_index를 태그하려면 multichannel_output_style=combined를 설정하세요.

일반적인 사용 사례

  • 스테레오 인터뷰 녹음 - 왼쪽 채널에는 인터뷰어, 오른쪽 채널에는 인터뷰이
  • 멀티트랙 팟캐스트 녹음 - 각 참가자를 별도 트랙에 녹음
  • 콜센터 녹음 - 상담원과 고객을 서로 다른 채널로 분리
  • 회의 녹음 - 개별 참가자를 별도 채널로 분리
  • 법정 절차 녹음 - 여러 당사자를 각기 다른 채널에 녹음

요구 사항

  • API 키가 있는 ElevenLabs 계정
  • 멀티채널 오디오 파일(WAV, MP3 또는 기타 지원 형식)
  • 오디오 파일당 최대 5개 채널
  • 각 채널에는 화자가 한 명만 포함되어야 함

작동 방식

1

멀티채널 오디오 준비

오디오 파일에서 화자가 별도 채널로 분리되었는지 확인하세요. 멀티채널 기능은 최대 5개 채널을 지원하며, 각 채널은 특정 화자에 매핑됩니다.

  • 채널 0 → speaker_0
  • 채널 1 → speaker_1
  • 채널 2 → speaker_2
  • 채널 3 → speaker_3
  • 채널 4 → speaker_4
2

API 파라미터 구성

음성 텍스트 변환 요청을 할 때 다음을 설정해야 합니다.

  • use_multi_channel: true
  • diarize: false(멀티채널 모드가 채널을 통해 화자를 분리)

필요에 따라 다음 설정으로 응답 형식을 제어할 수 있습니다.

  • multichannel_output_style: separate(기본값)는 채널당 하나의 전사문을 반환합니다. combined는 모든 채널을 시작 시간순으로 정렬된 단일 전사문으로 병합하며, 각 단어에 channel_index가 포함됩니다. 이는 표준 단일 채널 응답 형식과 일치합니다. combined에는 타임스탬프가 필요하며(timestamps_granularity는 none일 수 없음), 웹훅 전송 또는 엔터티 감지/마스킹과 함께 지원되지 않습니다.

화자 수는 채널 수에 따라 자동으로 결정되므로 num_speakers 파라미터는 멀티채널 모드에서 사용할 수 없습니다. 멀티채널 모드는 채널당 정확히 한 명의 화자가 있다고 가정합니다. 더 많은 화자가 있으면 해당 채널의 모든 화자에 동일한 화자 ID를 할당합니다.

3

응답 처리

기본값인 multichannel_output_style=separate에서는 멀티채널 오디오가 단일 채널과 다른 응답 형식을 반환합니다.

use_multi_channel: true를 설정했지만 단일 채널(모노) 오디오 파일을 제공하면 멀티채널 형식이 아닌 표준 단일 채널 응답을 받습니다. 멀티채널 응답 형식은 오디오 파일에 실제로 여러 채널이 포함된 경우에만 반환됩니다.

{
"language_code": "en",
"language_probability": 0.98,
"text": "Hello world",
"words": [...]
}

multichannel_output_style=combined를 사용하면 응답은 단일 채널 전사와 동일한 평면 구조(최상위 text 및 words, transcripts 배열 없음)를 사용하며, 모든 채널이 시작 시간순으로 정렬된 하나의 목록으로 병합됩니다. 모든 단어에는 채널을 식별하는 channel_index(및 speaker_id)가 포함됩니다.

구현

기본 멀티채널 전사

두 명의 화자가 포함된 스테레오 오디오 파일을 전사하는 전체 예시입니다.

from elevenlabs import ElevenLabs
elevenlabs = ElevenLabs(api_key="YOUR_API_KEY")
def transcribe_multichannel(audio_file_path):
with open(audio_file_path, 'rb') as audio_file:
result = elevenlabs.speech_to_text.convert(
file=audio_file,
model_id='scribe_v3',
use_multi_channel=True,
diarize=False,
timestamps_granularity='word'
)
return result
# Process the response
result = transcribe_multichannel('stereo_interview.wav')
if hasattr(result, 'transcripts'): # Multichannel response
for transcript in result.transcripts:
channel = transcript.channel_index
text = transcript.text
print(f"Channel {channel} (speaker_{channel}): {text}")
else: # Single channel response (fallback)
print(f"Text: {result.text}")

대화 전사문 만들기

시간순 대화 형식 전사문을 가장 쉽게 얻는 방법은 multichannel_output_style=combined를 요청하는 것입니다. API는 시작 시간순으로 정렬된 단일 words 목록을 반환하며, 각 단어에는 channel_index와 speaker_id가 포함됩니다.

결합된 출력(권장)
with open("stereo_interview.wav", "rb") as audio_file:
result = elevenlabs.speech_to_text.convert(
file=audio_file,
model_id="scribe_v3",
use_multi_channel=True,
multichannel_output_style="combined",
diarize=False,
timestamps_granularity="word",
)
for word in result.words:
if word.type == "word":
print(f"speaker_{word.channel_index}: {word.text}")

기본 separate 출력을 사용 중이라면 클라이언트 측에서 채널별 전사문을 대신 병합할 수 있습니다.

def create_conversation_transcript(multichannel_result):
"""Create a conversation-style transcript with speaker labels"""
all_words = []
if hasattr(multichannel_result, 'transcripts'):
# Collect all words from all channels
for transcript in multichannel_result.transcripts:
for word in transcript.words or []:
if word.type == 'word':
all_words.append({
'text': word.text,
'start': word.start,
'speaker_id': word.speaker_id,
'channel': transcript.channel_index
})
# Sort by timestamp
all_words.sort(key=lambda w: w['start'])
# Group consecutive words by speaker
conversation = []
current_speaker = None
current_text = []
for word in all_words:
if word['speaker_id'] != current_speaker:
if current_text:
conversation.append({
'speaker': current_speaker,
'text': ' '.join(current_text)
})
current_speaker = word['speaker_id']
current_text = [word['text']]
else:
current_text.append(word['text'])
# Add the last segment
if current_text:
conversation.append({
'speaker': current_speaker,
'text': ' '.join(current_text)
})
return conversation
# Format the output
conversation = create_conversation_transcript(result)
for turn in conversation:
print(f"{turn['speaker']}: {turn['text']}")

멀티채널에서 웹훅 사용

멀티채널 전사는 비동기 처리를 위한 웹훅 전송을 지원합니다.

웹훅은 separate(채널별) 형식을 반환합니다. multichannel_output_style=combined는 현재 웹훅 전송에서 지원되지 않습니다. 동기 요청을 사용하거나 채널별 웹훅 페이로드를 클라이언트 측에서 병합하세요.

from elevenlabs import ElevenLabs
elevenlabs = ElevenLabs(api_key="YOUR_API_KEY")
async def transcribe_multichannel_with_webhook(audio_file_path):
with open(audio_file_path, 'rb') as audio_file:
result = await elevenlabs.speech_to_text.convert_async(
file=audio_file,
model_id='scribe_v3',
use_multi_channel=True,
diarize=False,
webhook=True # Enable webhook delivery
)
print(f"Transcription started with task ID: {result.task_id}")
return result.task_id

오류 처리

일반적인 유효성 검사 오류

오류: 멀티채널 모드는 화자 분리를 지원하지 않으며, 화자가 발화하는 채널을 기준으로 화자를 할당합니다.

해결 방법: 멀티채널 모드를 사용할 때는 항상 diarize=false로 설정하세요.

오류: use_multi_channel이 활성화된 경우 num_speakers를 지정할 수 없습니다. 화자 수는 채널 수에 따라 자동으로 결정됩니다. 해결 방법: 요청에서 num_speakers 파라미터를 제거하세요.

오류: 멀티채널 모드는 최대 5개 채널을 지원하지만, 오디오 파일에는 X개 채널이 포함되어 있습니다.

해결 방법: 처음 5개 채널만 처리하거나 오디오를 전처리하여 채널 수를 줄이세요.

오류: multichannel_output_style=‘combined’에는 타임스탬프가 필요합니다. timestamps_granularity를 ‘word’ 또는 ‘character’로 설정하세요.

해결 방법: 결합된 출력은 시간을 기준으로 단어를 정렬하므로 timestamps_granularity를 word (기본값) 또는 character로 설정하세요.

오류: multichannel_output_style=‘combined’는 아직 웹훅 전송에서 지원되지 않습니다.

해결 방법: combined와 함께 동기 요청을 사용하거나, 웹훅 사용 시 기본 separate 출력을 유지하고 클라이언트 측에서 병합하세요.

모범 사례

오디오 준비

최적의 결과를 위해 다음을 따르세요. - 더 나은 성능을 위해 16kHz 샘플 레이트 사용 - 처리 전 무음 또는 미사용 채널 제거 - 각 채널에 화자가 한 명만 포함되도록 확인 - 최상의 품질을 위해 가능한 경우 무손실 형식(WAV) 사용

성능 최적화

동시성 비용은 채널 수에 따라 선형적으로 증가합니다. 60초 길이의 3채널 파일은 단일 채널 파일보다 동시성 비용이 3배입니다.

다음 공식을 사용하여 멀티채널 오디오의 처리 시간을 추정할 수 있습니다.

Processing Time=(D⋅0.3)+2+(N⋅0.5)Processing\ Time = (D \cdot 0.3) + 2 + (N \cdot 0.5)

각 항목의 의미는 다음과 같습니다.

  • DD = 파일 길이(초)
  • NN = 채널 수
  • 0.30.3 = 처리 속도 계수(실시간의 약 30%)
  • 22 = 초 단위 고정 오버헤드
  • 0.50.5 = 채널당 초 단위 오버헤드

예시: 60초 스테레오 파일(2개 채널)의 경우:

Processing Time=(60⋅0.3)+2+(2⋅0.5)=18+2+1=21 secondsProcessing\ Time = (60 \cdot 0.3) + 2 + (2 \cdot 0.5) = 18 + 2 + 1 = 21\ seconds

메모리 고려 사항

대용량 멀티채널 파일의 경우 스트리밍 또는 청킹을 고려하세요.

def process_large_multichannel_file(file_path, chunk_duration=300):
"""Process large files in chunks (5-minute segments)"""
from pydub import AudioSegment
from elevenlabs import ElevenLabs
import os
elevenlabs = ElevenLabs(api_key="YOUR_API_KEY")
audio = AudioSegment.from_file(file_path)
duration_ms = len(audio)
chunk_size_ms = chunk_duration * 1000
all_transcripts = []
for start_ms in range(0, duration_ms, chunk_size_ms):
end_ms = min(start_ms + chunk_size_ms, duration_ms)
# Extract chunk
chunk = audio[start_ms:end_ms]
chunk_file = f"temp_chunk_{start_ms}.wav"
chunk.export(chunk_file, format="wav")
# Transcribe chunk using SDK
with open(chunk_file, 'rb') as audio_file:
result = elevenlabs.speech_to_text.convert(
file=audio_file,
model_id='scribe_v3',
use_multi_channel=True,
diarize=False,
timestamps_granularity='word'
)
# Adjust timestamps
if hasattr(result, 'transcripts'):
for transcript in result.transcripts:
for word in transcript.words or []:
word.start += start_ms / 1000
word.end += start_ms / 1000
all_transcripts.extend(result.transcripts)
# Clean up
os.remove(chunk_file)
return all_transcripts

FAQ

API가 오류를 반환합니다. API로 전송할 5개 채널을 선택하거나, 전송 전에 일부 채널을 믹스다운해야 합니다.

예. 하지만 불필요합니다. use_multi_channel=true로 모노 오디오를 전송하면 멀티채널 형식이 아닌 표준 단일 채널 응답을 받습니다.

예. multichannel_output_style=combined를 설정하면 모든 채널이 병합되고 시작 시간순으로 정렬된 단일 전사문을 받을 수 있으며, 각 단어에는 channel_index가 태그됩니다. 이는 표준 단일 채널 응답 형식과 일치합니다. 타임스탬프가 필요하며 웹훅 전송에서는 사용할 수 없습니다.

화자 ID는 채널 번호에 따라 결정됩니다. 채널 0은 speaker_0, 채널 1은 speaker_1이 되는 방식입니다.

예. 각 채널은 독립적으로 처리되며 서로 다른 언어를 감지할 수 있습니다. 언어 감지는 채널별로 이루어집니다. multichannel_output_style=combined를 사용하면 최상위 language_code는 가장 신뢰도가 높은 채널을 반영하며, 각 단어에는 계속해서 channel_index가 포함됩니다.

다음 단계