So verarbeitet ElevenLabs Emotion und Prosodie in Sprachausgabe
Der Unterschied zwischen roboterhafter Monotonie und menschlich wirkender Stimme liegt an Emotion und Prosodie, also feinen Variationen von Tonhöhe, Rhythmus und Intensität. Ein Blick darauf, wie ElevenLabs diese Aspekte in seiner Text-to-Speech-Technik handhabt.

Wenn Sie schon einmal mit Text-to-Speech-(TTS-)APIs gearbeitet haben, kennen Sie den Unterschied zwischen einer robotischen Monotonie und einer Stimme, die sich wirklich menschlich anfühlt. Das Geheimnis liegt in Emotion und Prosodie, also den subtilen Variationen von Tonhöhe, Rhythmus und Intensität, die über die Worte hinaus Bedeutung vermitteln. In diesem Artikel untersuchen wir, wie moderne Voice-AI-Plattformen diese Feinheiten modellieren, und gehen anhand eines praktischen Beispiels mit ElevenLabs durch, einem Dienst, mit dem sich ausdrucksstarke Sprache mit nur wenigen Codezeilen erzeugen lässt.
Kurzfassung: Die API von ElevenLabs bietet feingranulare Kontrolle über Emotion, Stil und Prosodie, und Sie können in wenigen Minuten mit dem folgenden Python-Snippet loslegen.
Wenn eine TTS-Engine diese Hinweise ignoriert, wirkt die Ausgabe flach und kann sogar die wahrgenommene Absicht des Textes verändern. Für Anwendungen wie virtuelle Assistenten, Hörbücher oder interaktive Spiele ist ausdrucksstarke Sprache kein Luxus mehr, sondern eine Notwendigkeit.
ElevenLabs baut auf einem Deep-Learning-Fundament auf, das prosodische Konturen auf Basis von drei Haupteingaben vorhersagt:
Das Modell lernt eine latente Repräsentation davon, wie Menschen Tonhöhe und Timing auf natürliche Weise variieren. Während des Trainings verarbeitet es Tausende von Stunden aufgezeichneter Sprache und richtet Phoneme an akustischen Merkmalen aus. Das Ergebnis ist ein Prosodie-Encoder, der sich zur Inferenzzeit steuern lässt.
ElevenLabs stellt eine kleine Auswahl an High-Level-Emotions-Tags bereit. Intern verschieben diese Tags den latenten Raum in Richtung von Mustern, die typisch für die jeweilige Emotion sind. Beispielsweise hebt das Tag excited die Tonhöhe an und erhöht die Sprechgeschwindigkeit, während calm das Gegenteil bewirkt.
Für Entwickler, die mehr Präzision benötigen, unterstützt ElevenLabs einen Teilumfang der Speech Synthesis Markup Language (SSML). Sie können Wörter in <prosody>-Tags einschließen, um Geschwindigkeit, Tonhöhe und Lautstärke auf Wortebene anzupassen.
import os import requests # ------------------------------------------------- # 1️⃣ Zugangsdaten einrichten # ------------------------------------------------- API_KEY = os. getenv ( " ELEVENLABS_API_KEY " ) # sicher speichern! VOICE_ID = " EXAVITQu4vr4xnSDxMaL " # Standardstimme "Rachel" # ------------------------------------------------- # 2️⃣ Request-Payload erstellen # ------------------------------------------------- payload = { " text ": " Congratulations! You ' ve just unlocked a new achievement.
", " voice_settings ": { " stability ": 0.75, # Glätte der Stimme " similarity_boost ": 0.85 }, " model_id ": " eleven_monolingual_v1 ", # aktuellstes Modell " emotion ": " excited " # ← Emotions-Tag } headers = { " xi-api-key ": API_KEY, " Content-Type ": " application/json " } # ------------------------------------------------- # 3️⃣ TTS-Endpunkt aufrufen # ------------------------------------------------- url = f " https://api.elevenlabs.io/v1/text-to-speech/ { VOICE_ID } " response = requests. post ( url, json = payload, headers = headers ) # ------------------------------------------------- # 4️⃣ Audiodatei speichern # ------------------------------------------------- if response. status_code == 200: with open ( " output.wav ", " wb " ) as f: f. write ( response. content ) print ( " ✅ Audio gespeichert als output.wav " ) else: print ( " ❌ Fehler: ", response. status_code, response. text ) Enter fullscreen mode Exit fullscreen mode Profi-Tipp: Ersetzen Sie "excited" durch "sad" oder "calm", um denselben Satz in einer völlig anderen Stimmung zu hören. Sie können außerdem stability und similarity_boost anpassen, um die Stimme je nach Anwendungsfall menschenähnlicher oder synthetischer klingen zu lassen.
Manchmal soll ein einzelnes Wort hervorstechen. ElevenLabs ermöglicht es, SSML direkt in das Textfeld einzubetten:
payload [ " text " ] = """ <speak> The <prosody rate= " fast " pitch= " +5% " >deadline</prosody> is tomorrow. </speak> """ Enter fullscreen mode Exit fullscreen mode Die API parst die Tags und wendet die angeforderte Geschwindigkeit und Tonhöhe nur auf das Wort deadline an. Das eignet sich hervorragend für:
Wenn Sie einfach nur über das Terminal testen, übernimmt curl die Hauptarbeit:
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/ ${ VOICE_ID } " \ -H "xi-api-key: $ELEVENLABS_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "text": "Welcome back, hero. Your journey continues.", "emotion": "mysterious", "voice_settings": { "stability": 0.65, "similarity_boost": 0.9 } }' --output hero.wav Enter fullscreen mode Exit fullscreen mode Ersetzen Sie mysterious durch ein beliebiges unterstütztes Emotions-Label. Die entstandene Datei hero.wav lässt sich direkt in ein Unity-Projekt oder eine Webseite einbinden.
Sie können es selbst gleich jetzt ausprobieren, indem Sie sich über den Affiliate-Link registrieren: ElevenLabs. Bei der Anmeldung erhalten Sie kostenlose Credits, sodass Sie ohne unmittelbare Kosten experimentieren können.
Emotion und Prosodie sind die fehlenden Bausteine, die eine lieblose Roboterstimme in einen überzeugenden Gesprächspartner verwandeln. Mit Hilfe eines Prosodie-Encoders, Emotions-Konditionierung und SSML gibt ElevenLabs Entwicklern die Werkzeuge an die Hand, um Sprache zu erzeugen, die sich natürlich und kontextbewusst anfühlt.
Ob Sie einen sprachgesteuerten Chatbot, einen immersiven Spielerzähler oder einen automatisierten Podcast-Generator entwickeln: Mit den obigen Schriften gelangen Sie von „Hello, world!“ zu „Hello, world with feeling“.
Sind Sie bereit, Ihrem nächsten Projekt echte Emotion zu verleihen? Probieren Sie ElevenLabs noch heute aus: testen Sie ElevenLabs hier und lassen Sie Ihre Anwendungen mit Persönlichkeit sprechen. Viel Spaß beim Programmieren!
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
If you’ve ever played with text‑to‑speech (TTS) APIs, you know the difference between a robotic monotone and a voice that actually feels human. The secret sauce is emotion and prosody – the subtle variations in pitch, rhythm, and intensity that convey meaning beyond the words themselves. In this article we’ll explore how modern voice‑AI platforms model these nuances and walk through a practical example using ElevenLabs – a service that lets you generate expressive speech with just a few lines of code.
TL;DR: ElevenLabs’ API gives you fine‑grained control over emotion, style, and prosody, and you can start experimenting in minutes with the Python snippet below.
If a TTS engine ignores these cues, the output feels flat and can even change the perceived intent of the text. For applications like virtual assistants, audiobooks, or interactive games, expressive speech is no longer a luxury – it’s a requirement.
ElevenLabs builds on a deep‑learning backbone that predicts prosodic contours conditioned on three main inputs:
The model learns a latent representation of how humans naturally vary pitch and timing. During training it ingests thousands of hours of recorded speech, aligning phonemes with acoustic features. The result is a prosody encoder that can be steered at inference time.
ElevenLabs exposes a small set of high‑level emotion tags. Internally these tags bias the latent space toward patterns typical of that emotion. For example, the excited tag will push the pitch upward and increase the speaking rate, while calm does the opposite.
For developers who need more precision, ElevenLabs supports a subset of Speech Synthesis Markup Language (SSML). You can wrap words in <prosody> tags to tweak rate, pitch, and volume on a per‑word basis.
import os import requests # ------------------------------------------------- # 1️⃣ Set up your credentials # ------------------------------------------------- API_KEY = os. getenv ( " ELEVENLABS_API_KEY " ) # store securely! VOICE_ID = " EXAVITQu4vr4xnSDxMaL " # default "Rachel" voice # ------------------------------------------------- # 2️⃣ Build the request payload # ------------------------------------------------- payload = { " text ": " Congratulations! You ' ve just unlocked a new achievement.
", " voice_settings ": { " stability ": 0.75, # smoothness of the voice " similarity_boost ": 0.85 }, " model_id ": " eleven_monolingual_v1 ", # latest model " emotion ": " excited " # ← emotion tag } headers = { " xi-api-key ": API_KEY, " Content-Type ": " application/json " } # ------------------------------------------------- # 3️⃣ Call the TTS endpoint # ------------------------------------------------- url = f " https://api.elevenlabs.io/v1/text-to-speech/ { VOICE_ID } " response = requests. post ( url, json = payload, headers = headers ) # ------------------------------------------------- # 4️⃣ Save the audio file # ------------------------------------------------- if response. status_code == 200: with open ( " output.wav ", " wb " ) as f: f. write ( response. content ) print ( " ✅ Audio saved as output.wav " ) else: print ( " ❌ Error: ", response. status_code, response. text ) Enter fullscreen mode Exit fullscreen mode Pro tip: Swap "excited" for "sad" or "calm" to hear the same sentence in a completely different mood. You can also adjust stability and similarity_boost to make the voice sound more “human‑like” or more “synthetic” depending on your use‑case.
Sometimes you need a single word to pop. ElevenLabs lets you embed SSML directly in the text field:
payload [ " text " ] = """ <speak> The <prosody rate= " fast " pitch= " +5% " >deadline</prosody> is tomorrow. </speak> """ Enter fullscreen mode Exit fullscreen mode The API will parse the tags and apply the requested rate and pitch only to the word deadline. This works great for:
If you’re just testing from the terminal, curl does the heavy lifting:
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/ ${ VOICE_ID } " \ -H "xi-api-key: $ELEVENLABS_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "text": "Welcome back, hero. Your journey continues.", "emotion": "mysterious", "voice_settings": { "stability": 0.65, "similarity_boost": 0.9 } }' --output hero.wav Enter fullscreen mode Exit fullscreen mode Replace mysterious with any supported emotion label. The resulting hero.wav can be dropped straight into a Unity project or a web page.
You can try it yourself right now by signing up through the affiliate link: ElevenLabs. The sign‑up process grants you free credits, so you can experiment without any immediate cost.
Emotion and prosody are the missing pieces that turn a bland robot voice into a compelling conversational partner. By leveraging a prosody encoder, emotion conditioning, and SSML, ElevenLabs gives developers the tools to create speech that feels natural and context‑aware.
Whether you’re building a voice‑enabled chatbot, an immersive game narrator, or an automated podcast generator, the steps above should get you from “Hello, world!” to “Hello, world with feeling.”
Ready to add genuine emotion to your next project? Give ElevenLabs a spin today: try ElevenLabs here and let your applications speak with personality. Happy coding!