| audio {openaistream} | R Documentation |
audio Class
Description
To turn audio into text or text into audio
Super class
openaistream::openai -> audio
Methods
Public methods
Inherited methods
Method speech()
Generates audio from the input text.
Usage
audio$speech( model = "tts-1", input, voice = "alloy", stream = F, num = 100, ..., verbosity = 0 )
Arguments
modelcharacter Required. One of the available TTS models: tts-1 or tts-1-hd
inputcharacter Required. The text to generate audio for. The maximum length is 4096 characters.
voicecharacter Required. The voice to use when generating the audio. Supported voices are alloy, echo, fable, onyx, nova, and shimmer.
streamlogical. 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.
numThe 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....
verbositynumeric. 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.).
Returns
The audio file content.
Method transcription()
Transcribes audio into the input language.
Usage
audio$transcription(path, model = "whisper-1", ..., verbosity = 0)
Arguments
pathcharacter 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.
modelcharacter 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....
verbositynumeric. 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.).
Returns
The transcribed text.
Method translation()
Translates audio into English.
Usage
audio$translation(path, model = "whisper-1", ..., verbosity = 0)
Arguments
pathcharacter 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.
modelcharacter 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....
verbositynumeric. 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.).
Returns
The transcribed text.
Method clone()
The objects of this class are cloneable with this method.
Usage
audio$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.