Accents from voice prompts
LMNT's models excel at voice cloning, so the accents in your voice prompts carry forward to your generated speech. You don't have to do anything special - this works out of the box.
Learn more about how to craft great voice prompts in our Voice prompting guide.
Changing accents
You can prompt the model to change accents on the fly by changing the language option. This results in speech that sounds distinctly like your voice prompt, but also now
with an accent of someone who has been speaking that language for a long time.
import asyncio
from lmnt import AsyncLmnt
async def main():
client = AsyncLmnt()
text = 'Hello, and uh, welcome to the show.'
for language in ['en', 'fr', 'de']:
async with client.speech.with_streaming_response.generate(
text=text,
voice='leah',
language=language,
) as response:
await response.stream_to_file(f'{language}.mp3')
asyncio.run(main())de.mp3
en.mp3
fr.mp3
The output:
en.mp3→ spoken by a native English speaker.fr.mp3→ spoken in English with a French accent.de.mp3→ spoken in English with a German accent.