Skip to main content
One Python script that creates a call, streams your microphone to Pearl and plays its voice through your speakers. Press Ctrl+C to hang up.
1

Install

Python 3.11 or later, then:
On Linux, also install PortAudio: sudo apt install libportaudio2. On macOS and Windows it comes with sounddevice.
2

Save the script

Save it as pearl_quickstart.py.
pearl_quickstart.py
3

Run it and talk

Use headphones: a terminal has no echo cancellation, and Pearl would hear itself through your speakers.
Your <AccountId>:<SecretKey> is on the API Access page of your workspace settings (API Authorization). Your <pearlId> is on your Pearl’s overview page, in the Settings popover.Pearl greets you; answer it. On macOS, allow the terminal to use the microphone the first time.
Output
The call is in your call history with its transcript and recording, like any other call of your Pearl.

How the script works

  • The order: create the call, open url?ticket=…, wait for ready, then stream.
  • The pacing: the sound card hands over 20 ms of the microphone every 20 ms, silence included, which is exactly what Pearl expects.
  • The playback: Pearl’s frames go through an 80 ms buffer, which absorbs network jitter.
  • The ending: Ctrl+C sends hangup, answered by ended. If Pearl ends the call first, the script prints its ended and stops.

Next steps

Browser App

The same conversation from a web page.

Stream Call

Every message, audio format, event and limit.