#mp3 via API? .wav is no problem, but how to get mp3?

1 messages · Page 1 of 1 (latest)

sharp moon
small birch
#

Hi @sharp moon - clarifying, are you unable to save an mp3 while using container: mp3 and encoding: mp3 on the tts/bytes endpoint?

toxic comet
#

@small birch I'm having the same issue.

I get the response "POST https://api.cartesia.ai/tts/bytes` resulted in a 400 Bad Request response: invalid output specification: unsupported encoding for mp3".

The request works fine if I specify raw but mp3 doesn't work.

'output_format' => [
                'container' => 'mp3',
                'bit_rate' => 192,
                'sample_rate' => 44100,
            ]
small birch
#

@toxic comet Could u try passing “encoding: mp3”

toxic comet
#

@small birch Thanks, I now have a 400 Bad Request response: invalid output specification: unsupported bit rate for mp3: 192

What bit rates are supported?

small birch
#

Hmmm tbh I’m not sure off the top of my head - here are the sample rates we support perhaps they’re the same?

8000
16000
22050
24000
44100
48000
#

This one is likely more of a bug on our end, we have a ticket for it I believe

Cc: @reef drift

toxic comet
#

Thanks Chongz, got it working, I was using kilobytes, not bits!

A few examples on the docs page would be helpful for others I imagine.

charred tendon
#

The playground for SSE and MP3 https://docs.cartesia.ai/api-reference/tts/bytes?playground=%2Fapi-reference%2Ftts%2Fsse doesn't support an encoding field, but maybe this error message is misleading ... B/C I can't find any docs on what bit_rate and sample_rate are supported, so wondering if that is the problem.

small birch
#

@charred tendon apologies I think that's more of a bug on our end. The documentation is what it should be, we'll be fixing that shortly.