Skip to content

Commit

Permalink
feat(api): add wav and pcm to response_format (openai#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and stainless-app[bot] committed Feb 28, 2024
1 parent af02745 commit 6d25c6b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
16 changes: 12 additions & 4 deletions src/openai/resources/audio/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def create(
input: str,
model: Union[str, Literal["tts-1", "tts-1-hd"]],
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
response_format: Literal["mp3", "opus", "aac", "flac"] | NotGiven = NOT_GIVEN,
response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] | NotGiven = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -65,7 +65,11 @@ def create(
available in the
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`.
response_format: The format to return audio in. Supported formats are `mp3`, `opus`, `aac`,
`flac`, `pcm`, and `wav`.
The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
sample rate, mono channel, and 16-bit depth in signed little-endian format.
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
the default.
Expand Down Expand Up @@ -113,7 +117,7 @@ async def create(
input: str,
model: Union[str, Literal["tts-1", "tts-1-hd"]],
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"],
response_format: Literal["mp3", "opus", "aac", "flac"] | NotGiven = NOT_GIVEN,
response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"] | NotGiven = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -137,7 +141,11 @@ async def create(
available in the
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
response_format: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`.
response_format: The format to return audio in. Supported formats are `mp3`, `opus`, `aac`,
`flac`, `pcm`, and `wav`.
The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
sample rate, mono channel, and 16-bit depth in signed little-endian format.
speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
the default.
Expand Down
10 changes: 8 additions & 2 deletions src/openai/types/audio/speech_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ class SpeechCreateParams(TypedDict, total=False):
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options).
"""

response_format: Literal["mp3", "opus", "aac", "flac"]
"""The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`."""
response_format: Literal["mp3", "opus", "aac", "flac", "pcm", "wav"]
"""The format to return audio in.
Supported formats are `mp3`, `opus`, `aac`, `flac`, `pcm`, and `wav`.
The `pcm` audio format, similar to `wav` but without a header, utilizes a 24kHz
sample rate, mono channel, and 16-bit depth in signed little-endian format.
"""

speed: float
"""The speed of the generated audio.
Expand Down

0 comments on commit 6d25c6b

Please sign in to comment.