Learn R Programming

whisper (version 0.1.0)

transcribe: Whisper Transcription

Description

Main transcription API for Whisper. Transcribe Audio Transcribe speech from an audio file using Whisper.

Usage

transcribe(
  file,
  model = "tiny",
  language = "en",
  task = "transcribe",
  device = "auto",
  dtype = "auto",
  verbose = TRUE
)

Value

List with text, language, and metadata

Arguments

file

Path to audio file (WAV, MP3, etc.)

model

Model name: "tiny", "base", "small", "medium", "large-v3"

language

Language code (e.g., "en", "es"). NULL for auto-detection.

task

"transcribe" or "translate" (translate to English)

device

Device: "auto", "cpu", "cuda"

dtype

Data type: "auto", "float16", "float32"

verbose

Print progress messages

Examples

Run this code
# \donttest{
# Transcribe included sample (JFK "ask not" speech)
if (model_exists("tiny")) {
  audio_file <- system.file("audio", "jfk.mp3", package = "whisper")
  result <- transcribe(audio_file, model = "tiny")
  result$text

  # Translate Spanish audio to English
  spanish_file <- system.file("audio", "allende.mp3", package = "whisper")
  result <- transcribe(spanish_file, model = "tiny",
                       language = "es", task = "translate")
  result$text
}
# }

Run the code above in your browser using DataLab