Содержимое
Еще никогда ранее не было так просто интегрировать такого уровня синтезированную речь в своих проектах. Вот код на Python с демо текстом и демо инструкцией: import asyncio from openai import AsyncOpenAI from openai.helpers import LocalAudioPlayer openai = AsyncOpenAI() input = """Woohoo! Let's get those meetings scheduled, superstar!\n\nAlright, first up—Monday at 10 AM, you've got a check-in with the team. Go, teamwork! Next, we're locking in Wednesday at 2 PM for that client presentation—you got this!\n\nOh, and don't forget Friday at 4 PM, a strategy session to wrap up the week. Finish strong!\n\nNeed to move anything around? No worries—I'm here to keep your schedule totally winning! Just say the word, and I'll make it happen! Let's do this!""" instructions = """Personality/affect: a high-energy cheerleader helping with administrative tasks \n\nVoice: Enthusiastic, and bubbly, with an uplifting and motivational quality.\n\nTone: Encouraging and playful, making even simple tasks feel exciting and fun.\n\nDialect: Casual and upbeat, using informal phrasing and pep talk-style expressions.\n\nPronunciation: Crisp and lively, with exaggerated emphasis on positive words to keep the energy high.\n\nFeatures: Uses motivational phrases, cheerful exclamations, and an energetic rhythm to create a sense of excitement and engagement.""" async def main() -> None: async with openai.audio.speech.with_streaming_response.create( model="gpt-4o-mini-tts", voice="coral", input=input, instructions=instructions, response_format="pcm", ) as response: await LocalAudioPlayer().play(response) if __name__ == "__main__": asyncio.run(main()) Здесь больше места занимает сам текст озвучки и инструкция, чем сам код! В потрясающее время мы живём! Создавайте, творите, будьте на вайбе!🍸 ИИволюция