say

View as MarkdownOpen in Claude

Add a text-to-speech play verb using the say: URL prefix. This is a convenience wrapper around play() that constructs the say: URL automatically.

Parameters

text
strRequired

The text to speak.

voice
str | NoneDefaults to None

Voice name for text-to-speech.

language
str | NoneDefaults to None

Language code (e.g., "en-US").

gender
str | NoneDefaults to None

Gender for voice selection.

volume
float | NoneDefaults to None

Volume adjustment level, from -40 to 40 dB.

Returns

Self — The builder instance for method chaining.

Example

from signalwire import SWMLService, SWMLBuilder
service = SWMLService(name="greeting")
builder = SWMLBuilder(service)
doc = (
builder
.answer()
.say("Welcome to our service. Please hold.", voice="rime.spore")
.sleep(duration=500)
.say("Connecting you now.", voice="rime.spore")
.build()
)
print(doc)