-
-
Notifications
You must be signed in to change notification settings - Fork 6
OpenAI.AudioGeneration
Andrew Lambert edited this page Dec 24, 2023
·
7 revisions
OpenAI.AudioGeneration
Protected Class AudioGeneration
Inherits OpenAI.Response
This class represents an API Text-to-Speech (TTS) response. Refer to the OpenAI documentation on the /v1/audio/speech
endpoint for further details.
This example uploads some text and downloads the spoken version as an MP3:
OpenAI.APIKey = "YOUR KEY HERE"
Dim data As String = "This is a test. This is a test of the OpenAI API. This is only a test."
Dim response As OpenAI.Response = OpenAI.AudioGeneration.Create(data, "tts-1", "alloy")
Dim audio As MemoryBlock = response.GetResult()
This example does the same as the previous example, but asks for the raw audio data only:
OpenAI.APIKey = "YOUR KEY HERE"
Dim data As String = "This is a test. This is a test of the OpenAI API. This is only a test."
Dim audio As MemoryBlock = OpenAI.AudioGeneration.CreateRaw(data, "tts-1", "alloy")
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2023-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.