[SSFM only] Predefined style of speaking¶
All SSFM-based actors come with 4 basic emotions by default: normal, happy, sad, and angry. You can adjust the intensity of these emotions to achieve the exact mood you want. These presets make it easy to add natural-sounding emotions to your text-to-speech output.
Follow the steps below:
Step 1. Check Available Actors¶
curl \
--request GET \
--url https://typecast.ai/api/actor/ \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN"
Step 2. Check if the Actor Supports SSFM¶
Using the actor_id from Step 1, call the following API. If the display_name starts with SSFM-, it means the actor supports the SSFM model. Use the name value from this result in Step 3.
curl \
--request GET \
--url https://typecast.ai/api/actor/${24-letters-your_actor_id}/versions \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN"
Step 3. Request Speech Generation¶
Use the SSFM name obtained in Step 2 as the model_version in your speech generation request. It will usually be something like v1, v2, etc. Set emotion_tone_preset to normal-1, and choose one of happy, sad, or angry for emotion_label. The default value for emotion_scale is 1.0, but you can increase it up to 2.0 for a stronger emotional effect.
curl \
--request POST \
--url https://typecast.ai/api/speak \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $API_TOKEN" \
--data '{
"text": "My name is Typecast.",
"lang": "auto",
"xapi_hd": true,
"actor_id": "6059dad0b83880769a50502f",
"model_version": "v5",
"emotion_tone_preset": "normal-1",
"emotion_label": "angry",
"emotion_scale": 1
}'