This project features a sample implementation of Hume's Empathic Voice Interface using Hume's Python SDK.
The Hume Python SDK supports Python versions 3.9, 3.10, and 3.11 on macOS and Linux systems.
You can create a virtual environment using either conda from Miniconda or Anaconda, or the built-in venv module in Python. Below are instructions for both methods.
After activating the virtual environment using either method, you can proceed with the installation of dependencies.
- Install
condausing Miniconda, the free minimal installer for it. - Create a new virtual environment.
# Create a new conda environment named 'evi-env' with a specific Python version conda create --name evi-env python=3.11 - Activate the virtual environment.
# Activate the conda environment conda activate evi-env
To create a virtual environment with venv, run the following commands in your terminal:
- Create a new virtual environment.
# Create a virtual environment in the directory 'evi-env' python -m venv evi-env - Activate the virtual environment.
# Activate the virtual environment source evi-env/bin/activate
Below are the necessary steps to install the required packages and system dependencies for using environment variables, EVI, and handling audio input/output.
The python-dotenv package can be used to load variables from a .env file into the process's environment. This practice is for configuration settings that shouldn't be hard-coded into the code, such as API keys.
To install it, run:
pip install python-dotenvTo get your API credentials, log into the Hume Platform and visit the API keys page.
Implement your credentials by editing the provided placeholder .env.example file.
- Rename the file to
.env. - Place your API credentials inside.
Upon doing so, the .env file becomes a persistent local store of your API key, Secret key, and EVI config ID. The .gitignore file contains local env file paths so that they are not committed to GitHub.
(Note: .env is a hidden file so on Mac you would need to hit COMMAND-SHIFT . to make it viewable in the finder).
The hume package contains Hume's Python SDK, including the asynchronous WebSocket infrastructure for using EVI. To install it, run:
pip install "hume[microphone]"For audio playback and processing, additional system-level dependencies are required. Below are download instructions for each supported operating system.
To ensure audio playback functionality, you will need to install ffmpeg, a powerful multimedia framework that handles audio and video processing.
One of the most common ways to install ffmpeg on macOS is by using Homebrew. Homebrew is a popular package manager for macOS that simplifies the installation of software by automating the process of downloading, compiling, and setting up packages.
To install ffmpeg using Homebrew, follow these steps:
-
Install Homebrew onto your system according to the instructions on the Homebrew website.
-
Once Homebrew is installed, you can install
ffmpegwith:brew install ffmpeg
If you prefer not to use Homebrew, you can download a pre-built ffmpeg binary directly from the FFmpeg website or use other package managers like MacPorts.
On Linux systems, you will need to install a few additional packages to support audio input/output and playback:
libasound2-dev: This package contains development files for the ALSA (Advanced Linux Sound Architecture) sound system.libportaudio2: PortAudio is a cross-platform audio I/O library that is essential for handling audio streams.ffmpeg: Required for processing audio and video files.
To install these dependencies, use the following commands:
sudo apt-get --yes update
sudo apt-get --yes install libasound2-dev libportaudio2 ffmpegNot yet supported.
This minimal implementation of Hume's Empathic User Interface (EVI) demonstrates how to authenticate, connect to, and display output from the interface in a terminal application.
Below are the steps to run the project:
- Create a virtual environment using venv, conda or other method.
- Activate the virtual environment.
- Install the required packages and system dependencies.
- Execute the script by running
python quickstart.py. - Terminate the script by pressing
Ctrl+C.
