Title: | Automatic Speech Recognition using Whisper.cpp |
---|---|
Description: | Wrapper for whisper.cpp to perform automatic speech recognition. |
Authors: | mikefc |
Maintainer: | mikefc <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2024-11-15 04:50:56 UTC |
Source: | https://github.com/coolbutuseless/carelesswhisper |
Audio sample for testing
jfk
jfk
An object of class audioSample
of length 176000.
Record audio from the default input device
record_audio(seconds)
record_audio(seconds)
seconds |
recording length |
Numeric vector of mono sound data sampled at 16kHz
Perform automatic speech recognition of the given sound sample
whisper(ctx, snd, params = list(), verbose = FALSE, details = FALSE)
whisper(ctx, snd, params = list(), verbose = FALSE, details = FALSE)
ctx |
whisper context (which you have previously created using |
snd |
Sound data. 16kHz mono audio in a numeric vector
with all values in the range [-1, 1]. This package includes the function
'record_audio()' which will record audio in this format.
You could also use |
params |
parameters for whisper. A user should usually create a default set
of parameters by calling
|
verbose |
logical. be verbose? default: FALSE. |
details |
logical. return detailed breakdown as a data.frame? default: FALSE |
Character string
## Not run: ctx <- whisper_init() # Initialise the model snd <- record_audio(2) # record 2 seconds of audio whisper(ctx, snd) # perform speech recognition ## End(Not run)
## Not run: ctx <- whisper_init() # Initialise the model snd <- record_audio(2) # record 2 seconds of audio whisper(ctx, snd) # perform speech recognition ## End(Not run)
Number of threads to use when processing. Default: 4
Translate from source language into english? Default: FALSE
language represented in audio. Use 'auto' to automatically detect language. Default: 'en'
maximum segment length in characters. Default: 0 (meaning no limit. Set to 1 to get one-word-per-segment.)
whisper_default_params()
whisper_default_params()
Named list of default parameters
Initialise whisper by loading a model
whisper_init( model_path = system.file("ggml-tiny.bin", package = "carelesswhisper", mustWork = TRUE), verbose = FALSE )
whisper_init( model_path = system.file("ggml-tiny.bin", package = "carelesswhisper", mustWork = TRUE), verbose = FALSE )
model_path |
path to whisper.cpp model. By default this will use the "ggml-tiny.bin" file included with this package installation, which is a tiny multi-language model See README for this package, or the original whisper.cpp documentation, for how to download other models. |
verbose |
Be verbose about model initialisation? Logical. Default: FALSE |
whisper context (ctx
)
language
parameterNamed list of two-letter language codes to use as language
parameter
whisper_lang_codes
whisper_lang_codes
An object of class list
of length 99.