Python Quickstart
Get up and running using Python
Installation
Install the vocode package:
Getting started
Working with system audio
We provide helper methods to hook into your system audio.
If the default I/O devices are not being set properly, set use_default_devices
to False
to select them before kicking off the conversation.
Environments
Vocode provides a unified interface across various speech transcription, speech synthesis, and AI/NLU providers. To use these providers with Vocode, you’ll need to grab credentials from these providers and set them in the Vocode environment.
You can either set the following parameters as environment variables (e.g. by specifying them in a .env
file and using a package like python-dotenv
to load), or set them manually in the pydantic settings (see below).
For AZURE_SPEECH_REGION you should use the URL format. For example, if you’re using the “East US” region, the value should be “eastus”. See Azure Region list.
StreamingConversation
example
This can also be found in the quickstarts
directory of the repo.
A note on echo cancellation
As of now, there is no default echo cancellation enabled for system audio conversation, so this works best with headphones, otherwise the bot audio feeds back into the input audio stream. On some speakers (eg phone calls) this is handled by the device itself.
Another fix for this is to pipe your microphone / speaker to Krisp.AI. Download their application and select the Krisp virtual audio devices when running the script!
Stay tuned for updates here, tracking in this GitHub issue.