@@ -19,20 +19,68 @@ namespace s3d
1919 {
2020 namespace Speech
2121 {
22+ namespace Model
23+ {
24+ // / @brief 音声合成モデル tts-1 | Speech Synthesis Model tts-1
25+ // / @see https://platform.openai.com/docs/models/tts
26+ inline constexpr StringView TTS1{ U" tts-1" };
27+
28+ // / @brief 音声合成モデル tts-1-hd | Speech Synthesis Model tts-1-hd
29+ // / @see https://platform.openai.com/docs/models/tts
30+ // / @remark tts-1 よりも高品質な音声を生成します。 | Generates higher quality audio than tts-1.
31+ inline constexpr StringView TTS1HD{ U" tts-1-hd" };
32+ }
33+
34+ namespace Voice
35+ {
36+ inline constexpr StringView Alloy{ U" alloy" };
37+
38+ inline constexpr StringView Echo{ U" echo" };
39+
40+ inline constexpr StringView Fable{ U" fable" };
41+
42+ inline constexpr StringView Onyx{ U" onyx" };
43+
44+ inline constexpr StringView Nova{ U" nova" };
45+
46+ inline constexpr StringView Shimmer{ U" shimmer" };
47+ }
48+
49+ namespace ResponseFormat
50+ {
51+ inline constexpr StringView MP3{ U" mp3" };
52+
53+ inline constexpr StringView Opus{ U" opus" };
54+
55+ inline constexpr StringView AAC{ U" aac" };
56+
57+ inline constexpr StringView FLAC{ U" flac" };
58+ }
59+
60+ inline constexpr size_t MaxInputLength = 4096 ;
61+
62+ inline constexpr double MinSpeed = 0.25 ;
63+
64+ inline constexpr double DefaultSpeed = 1.0 ;
65+
66+ inline constexpr double MaxSpeed = 4.0 ;
67+
2268 struct Request
2369 {
24- String model = U" tts-1 " ;
70+ String model{ OpenAI::Speech::Model::TTS1 } ;
2571
2672 String input;
2773
28- String voice = U" alloy " ;
74+ String voice{ OpenAI::Speech::Voice::Alloy } ;
2975
30- String responseFormat = U" mp3 " ;
76+ String responseFormat{ OpenAI::Speech::ResponseFormat::MP3 } ;
3177
32- double speed = 1.0 ;
78+ double speed = OpenAI::Speech::DefaultSpeed ;
3379 };
3480
35- bool Create (const Request& request, FilePathView path);
81+ bool Create (StringView apiKey, const Request& request, FilePathView path);
82+
83+ AsyncTask<bool > CreateAsync (StringView apiKey, const Request& request, FilePathView path);
3684 }
3785 }
3886}
0 commit comments