MCPcopy Create free account
hub / github.com/HumeAI/hume-api-examples / send_input

Function send_input

tts/tts-python-quickstart/app.py:139–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

137 async with hume.tts.stream_input.connect(version="1", no_binary=True, strip_headers=True) as stream:
138
139 async def send_input():
140 print("Sending TTS messages...")
141 await stream.send_publish(
142 PublishTts(
143 text="Hello",
144 voice=PostedUtteranceVoiceWithName(name="Ava Song", provider="HUME_AI"),
145 )
146 )
147 await stream.send_publish(PublishTts(text=" world."))
148 # The whitespace ^ is important
149 # Otherwise the model would see "Helloworld." and not "Hello world."
150 await stream.send_publish(PublishTts(flush=True))
151 print("Waiting 8 seconds...")
152 await asyncio.sleep(8)
153 await stream.send_publish(PublishTts(text="Goodbye, world."))
154 await stream.send_publish(PublishTts(flush=True))
155 print("Closing stream...")
156 await stream.send_publish(PublishTts(close=True))
157
158 async def handle_messages():
159 await play_audio_streaming(base64.b64decode(chunk.audio) async for chunk in stream)

Callers 1

example3Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected