본문 바로가기
C.W.K.
Stream
Lesson 02 of 07 · published

mlx-audio STT — Apple Silicon에서 듣기

~12 min · mlx-audio, stt, whisper

Level 0호기심
0 XP0/51 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Whisper를 MLX로 돌려

음성을 글로 바꾸는 STT도 mlx-audio에 있어. Whisper 계열 모델을 MLX에 맞게 불러 WAV, MP3, M4A 파일을 받아 텍스트로 바꿔.

STT는 TTS보다 성숙했어. Whisper-large-v3와 Apple Silicon에 맞춘 증류 모델은 여러 언어에서 강하고 M-Pro 이상에서는 1시간 오디오를 몇 분 안에 처리할 수 있어.

같은 패키지, 짧은 흐름

Whisper 계열 모델을 불러 오디오 파일을 지정하면 텍스트를 주고, 원한다면 구간별 시각도 돌려줘.

텍스트보다 더 많은 결과

구조화된 응답에는 시작·끝 시각이 있는 구간, 감지 언어, 모델이 제공한다면 토큰별 신뢰도가 들어 있어. 자막이나 시간 검색처럼 글을 오디오에 다시 맞출 때는 구간을 저장하고, 대본만 필요하면 이어진 텍스트를 써.

실시간 배수로 성능을 봐

벽시계 1초에 오디오 몇 초를 처리하는지가 가장 유용한 숫자야. Whisper-large MLX는 M-Ultra에서 보통 5–15배, M-Pro에서 2–5배를 기대해. 1보다 작으면 라이브 방송을 따라가지 못하고, 1보다 크면 여유를 두고 처리할 수 있어.

화자 분리는 별도 문제야

Whisper는 무엇을 말했는지는 알려도 누가 말했는지는 몰라. 구간에 화자 ID를 붙이는 화자 분리는 2026-05의 mlx-audio에서 아직 핵심 기능이 아니야. 보통 mlx-audio로 대본을 만들고 PyTorch 기반 pyannote-audio로 화자를 나눈 뒤 둘을 합쳐. 아직 MLX 도구 하나로 끝나는 문제는 아니야.

Code

Whisper 계열 MLX 모델로 오디오 파일 받아쓰기·python
# Re-verified 2026-08-07 on mlx-audio 0.4.7.
# The old `from mlx_audio.stt.generate import generate` no longer exists;
# the entry point is `generate_transcription`. Two of the parameters were
# renamed with it (`audio_path=` -> `audio=`, `model_path=` -> `model=`);
# `output_path` kept its name but changed meaning — it is now a stem, and
# the extension comes from `format`.
from mlx_audio.stt.generate import generate_transcription

result = generate_transcription(
    model="openai/whisper-tiny",     # see the warning below on WHICH repo
    audio="path/to/audio.wav",
    output_path="transcript",        # extension comes from `format`
    format="txt",                    # txt | srt | vtt | json
)

# `result` is an STTOutput with:
#   .text       — full transcribed text
#   .segments   — list of {id, start, end, text, tokens, ...} per segment
#   .language   — detected language code (e.g. 'en', 'ko')
print(result.text[:500])
지금 쓰는 기계의 실시간 배수 측정하기·python
import time, wave
from mlx_audio.stt.generate import generate_transcription

audio_path = "path/to/audio.wav"

# Total audio duration via wave module (works for WAV; for MP3/M4A use ffprobe)
with wave.open(audio_path, "rb") as wf:
    duration_sec = wf.getnframes() / float(wf.getframerate())

t0 = time.perf_counter()
result = generate_transcription(model="openai/whisper-tiny", audio=audio_path)
elapsed = time.perf_counter() - t0

print(f"audio duration : {duration_sec:.1f} s")
print(f"transcribe wall : {elapsed:.1f} s")
print(f"realtime factor : {duration_sec / elapsed:.1f}x")

# Measure a REAL file, not a toy. Verifying this lesson on 2026-08-07 I fed it
# a 3.8 s clip and got 0.4x, which says nothing about throughput — model load
# dominated. Load once, transcribe something minutes long, and time only the
# transcribe call if you want a number you can plan capacity with.

External links

Exercise

실제 작업을 대표하는 5–15분 오디오를 골라 STT를 실행하고 실시간 배수를 재. 다국어이거나 시끄러운 표본도 있다면 함께 돌려 속도와 품질이 어떻게 달라지는지 봐. 결과가 예상보다 좋거나 나빴는지, 어느 정도 처리량을 계획할지 두 문장으로 적어.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.