change TTS examples from build to grow something people love

This commit is contained in:
Russell Ballestrini 2025-10-15 11:40:08 -04:00
parent 66a82f6b0b
commit f7c5d6d553
14 changed files with 51 additions and 13 deletions

View file

@ -244,7 +244,7 @@ var client = new AudioClient(
);
BinaryData speech = await client.GenerateSpeechAsync(
"I think so therefore, Today is a wonderful day to build something people love!",
"I think so therefore, Today is a wonderful day to grow something people love!",
GeneratedSpeechVoice.Alloy,
new SpeechGenerationOptions
{

View file

@ -239,7 +239,7 @@ void main() async {
final speech = await OpenAI.instance.audio.createSpeech(
model: "tts-1",
input: "I think so therefore, Today is a wonderful day to build something people love!",
input: "I think so therefore, Today is a wonderful day to grow something people love!",
voice: "alloy",
speed: 0.9,
);

View file

@ -204,7 +204,7 @@ end)
config,
model: "tts-1",
voice: "alloy",
input: "I think so therefore, Today is a wonderful day to build something people love!",
input: "I think so therefore, Today is a wonderful day to grow something people love!",
speed: 0.9
)

View file

@ -270,7 +270,7 @@ func main() {
response, err := client.Audio.Speech.New(context.Background(), openai.AudioSpeechNewParams{
Model: openai.F(openai.SpeechModelTTS1),
Voice: openai.F(openai.AudioSpeechNewParamsVoiceAlloy),
Input: openai.F("I think so therefore, Today is a wonderful day to build something people love!"),
Input: openai.F("I think so therefore, Today is a wonderful day to grow something people love!"),
Speed: openai.Float(0.9),
})

View file

@ -272,7 +272,7 @@ public class TTSExample {
SpeechCreateParams params = SpeechCreateParams.builder()
.model(SpeechModel.TTS_1)
.voice(SpeechCreateParams.Voice.ALLOY)
.input("I think so therefore, Today is a wonderful day to build something people love!")
.input("I think so therefore, Today is a wonderful day to grow something people love!")
.speed(0.9)
.build();

View file

@ -266,7 +266,7 @@ suspend fun main() {
val speechRequest = SpeechRequest(
model = ModelId("tts-1"),
input = "I think so therefore, Today is a wonderful day to build something people love!",
input = "I think so therefore, Today is a wonderful day to grow something people love!",
voice = Voice.Alloy,
speed = 0.9
)

View file

@ -95,7 +95,7 @@ curl -s -X POST "https://speech.ai.unturf.com/v1/audio/speech" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "Hello from Bash! Today is a wonderful day to build something people love!"
"input": "Hello from Bash! Today is a wonderful day to grow something people love!"
}' \
--output speech.mp3

View file

@ -0,0 +1,38 @@
#!/usr/bin/env sbcl --script
;;; Text-to-Speech Example
;;; Uses Dexador to download audio file from TTS endpoint
(load "~/quicklisp/setup.lisp")
(ql:quickload '(:dexador :jonathan) :silent t)
(defparameter *base-url* "https://speech.ai.unturf.com/v1/audio/speech")
(defun generate-speech (text output-file)
"Generate speech from text and save to file"
(let ((payload (jonathan:to-json
(list :|model| "tts-1"
:|voice| "alloy"
:|speed| 0.9
:|input| text))))
(with-open-file (out output-file
:direction :output
:if-exists :supersede
:if-does-not-exist :create
:element-type '(unsigned-byte 8))
(let ((response (dex:post *base-url*
:headers '(("Content-Type" . "application/json"))
:content payload
:force-binary t)))
(write-sequence response out)))
(format t "Speech saved to: ~A~%" output-file)))
;; Main execution
(handler-case
(progn
(format t "Generating speech from TTS...~%~%")
(generate-speech
"I think so therefore, Today is a wonderful day to grow something people love!"
"speech.mp3"))
(error (e)
(format t "Error: ~A~%" e)))

View file

@ -259,7 +259,7 @@ async function getSpeech() {
model: "tts-1",
voice: "alloy",
speed: 0.9,
input: "I think so therefore, Today is a wonderful day to build something people love!"
input: "I think so therefore, Today is a wonderful day to grow something people love!"
});
response.stream_to_file("speech.mp3");

View file

@ -223,7 +223,7 @@ $client = OpenAI::factory()
$response = $client->audio()->speech([
'model' => 'tts-1',
'voice' => 'alloy',
'input' => 'I think so therefore, Today is a wonderful day to build something people love!',
'input' => 'I think so therefore, Today is a wonderful day to grow something people love!',
'speed' => 0.9,
]);

View file

@ -211,7 +211,7 @@ with client.audio.speech.with_streaming_response.create(
model="tts-1",
voice="alloy",
speed=0.9,
input="I think so therefore, Today is a wonderful day to build something people love!"
input="I think so therefore, Today is a wonderful day to grow something people love!"
) as response:
response.stream_to_file("speech.mp3")
</code></pre>

View file

@ -212,7 +212,7 @@ response = client.audio.speech(
parameters: {
model: "tts-1",
voice: "alloy",
input: "I think so therefore, Today is a wonderful day to build something people love!",
input: "I think so therefore, Today is a wonderful day to grow something people love!",
speed: 0.9
}
)

View file

@ -282,7 +282,7 @@ async fn main() -&gt; Result&lt;(), Box&lt;dyn std::error::Error&gt;&gt; {
let request = CreateSpeechRequestArgs::default()
.model(SpeechModel::Tts1)
.voice(Voice::Alloy)
.input("I think so therefore, Today is a wonderful day to build something people love!")
.input("I think so therefore, Today is a wonderful day to grow something people love!")
.speed(0.9)
.build()?;

View file

@ -225,7 +225,7 @@ let service = OpenAIServiceFactory.service(
let parameters = AudioSpeechParameters(
model: .tts1,
input: "I think so therefore, Today is a wonderful day to build something people love!",
input: "I think so therefore, Today is a wonderful day to grow something people love!",
voice: .alloy,
speed: 0.9
)