This example provides scripts and tools to perform standalone audio generation and build Livekit voice assistants using the Smallest AI TTS plugin. Follow the steps below to set up and run the experiments.

Code Examples Repository

You can find the code examples for this setup in the following GitHub repository:

Livekit Example Code Repository

Common Steps

1. Create a Virtual Environment

To ensure your Python environment is isolated, create a virtual environment:

python3 -m venv venv

Activate the virtual environment:

  • On Linux/Mac:

    source venv/bin/activate
    
  • On Windows:

    venv\Scripts\activate
    

2. Install Requirements

Once the virtual environment is activated, install the required dependencies:

pip install -r requirements.txt

3. Sign in and Create a New Project on Livekit

Sign in here: Livekit Cloud

After signing in, create a new project and copy the following tokens:

LIVEKIT_API_KEY
LIVEKIT_API_SECRET
LIVEKIT_URL

4. Create a .env File

Create a .env file in the project root directory. This file should contain the following keys with appropriate values:

LIVEKIT_API_KEY=...
LIVEKIT_API_SECRET=...
LIVEKIT_URL=...
OPENAI_API_KEY=...
DEEPGRAM_API_KEY=...
SMALLEST_API_KEY=...

5. Install the Plugin

To set up the Livekit plugin for smallest.ai, run the following commands:

chmod +x install_plugin.sh
./install_plugin.sh

Usage

1. Running generate_audio.py

To generate audio using the Smallest AI plugin as a WAV file, run the following command:

python3 generate_audio.py

You can change the parameters in the script and try out different voices, languages, and texts.

2. Running minimal_assistant.py

To build a minimal Livekit voice assistant using the Smallest model, run the following command:

python3 minimal_assistant.py dev

3. Connect to the Agent Here

You can connect to the agent by visiting the following link:

Livekit Agent Playground


Notes

  • Ensure that you have added the correct API keys and other credentials in the .env file before running the scripts.
  • For any issues or questions, feel free to open an issue in the repository or contact us on Discord.