Skip to content

Commit 0e1056d

Browse files
committed
Add optional sample_rate parameter to synthesize request.
1 parent c81a096 commit 0e1056d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/lmnt/api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ async def synthesize(self, text: str, voice: str, **kwargs):
315315
Optional parameters:
316316
- `seed` (int): The seed used to specify a different take. Defaults to random.
317317
- `format` (str): The audio format to use for synthesis. Defaults to `mp3`.
318+
- `sample_rate` (int): 8000, 16000, or 24000 – the desired output sample rate. Defaults to 24000 for all formats except `mulaw` which defaults to 8000.
318319
- `speed` (float): Floating point value between 0.25 (slow) and 2.0 (fast); Defaults to 1.0
319320
- `return_durations` (bool): If `True`, the response will include word durations detail. Defaults to `False`.
320321
- `return_seed` (bool): If `True`, the response will include the seed used for synthesis. Defaults to `False`.
@@ -351,6 +352,8 @@ async def synthesize(self, text: str, voice: str, **kwargs):
351352
length = kwargs.get('length', None)
352353
if length is not None:
353354
form_data.add_field('length', length)
355+
if 'sample_rate' in kwargs:
356+
form_data.add_field('sample_rate', kwargs.get('sample_rate'))
354357
if 'quality' in kwargs:
355358
form_data.add_field('quality', kwargs.get('quality'))
356359
return_durations = kwargs.get('durations', False)

0 commit comments

Comments
 (0)