audio | R Documentation |
To turn audio into text or text into audio
openaistream::openai
-> audio
speech()
Generates audio from the input text.
audio$speech( model = "tts-1", input, voice = "alloy", stream = F, num = 100, ..., verbosity = 0 )
model
character Required. One of the available TTS models: tts-1 or tts-1-hd
input
character Required. The text to generate audio for. The maximum length is 4096 characters.
voice
character Required. The voice to use when generating the audio. Supported voices are alloy, echo, fable, onyx, nova, and shimmer.
stream
logical. Using the stream call, it will return raw data of the specified length, which can be saved in the set format such as mp3, etc. For details, please see the examples.
num
The num parameter controls the number of raw entries returned by a stream in one go. Note that this is different from the n parameter, which specifies the number of results returned. For detailed information on the n parameter, please refer to OpenAI's API documentation.
...
Additional parameters as required by the OpenAI API.For example:response_format;speed....
verbosity
numeric. Verbosity level for the API call(0:no output;1:show headers; 2:show headers and bodies;3: show headers, bodies, and curl status messages.).
The audio file content.
transcription()
Transcribes audio into the input language.
audio$transcription(path, model = "whisper-1", ..., verbosity = 0)
path
character Required. The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
model
character Required. ID of the model to use. Only whisper-1 is currently available.
...
Additional parameters as required by the OpenAI API.For example:language;prompt;response_format;temperature....
verbosity
numeric. Verbosity level for the API call(0:no output;1:show headers; 2:show headers and bodies;3: show headers, bodies, and curl status messages.).
The transcribed text.
translation()
Translates audio into English.
audio$translation(path, model = "whisper-1", ..., verbosity = 0)
path
character Required. The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
model
character Required. ID of the model to use. Only whisper-1 is currently available.
...
Additional parameters as required by the OpenAI API.For example:prompt;response_format;temperature....
verbosity
numeric. Verbosity level for the API call(0:no output;1:show headers; 2:show headers and bodies;3: show headers, bodies, and curl status messages.).
The transcribed text.
clone()
The objects of this class are cloneable with this method.
audio$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.