This project was initially built with the help of Coqui, an open-source project that we deeply admire and appreciate. Unfortunately, Coqui has ceased operations, reminding us of the importance of supporting open-source initiatives.
Open-source projects, such as Coqui, provide immense value to the tech community by driving innovation and offering resources that are accessible to everyone. Without our support, we might all end up using Microsoft, like this project! (Just kidding 😅)
So, let's remember to contribute to and support our favorite open-source projects. We can do this by using the SAS services they create, which will help these projects become self-sustaining. They need us as much as we need them. 💚
This project demonstrates how to use Microsoft Azure's Text-to-Speech (TTS) service with the Vocode library on Replit. It's a rewrite of a previous demo that used the now-closed Coqui service.
To get started with this project, you need to have a Replit. Additionally, you will need to obtain the following API keys:
To add secrets to your Replit project, follow these steps:
- Open your Replit project.
- Navigate to the 'Secrets' tab on the left sidebar, which looks like a lock icon.
- In the Replit interface, locate and click the 'Secrets' tab, represented by a lock icon.
- Instead of manually entering secrets, click the 'Edit as JSON' button.
- In the JSON editor, you can add all your secrets in the following format:
- After adding your secrets, click the 'Save' button to store them securely.
{
"AZURE_SPEECH_REGION": "",
"DEEPGRAM_API_KEY": "",
"TELEGRAM_BOT_KEY": "",
"OPENAI_API_KEY": "",
"AZURE_SPEECH_KEY": ""
}
The main challenge with this project is that Microsoft Azure's speech-SDK does not support OpenSSL 3.0. To make Azure Speech-SDK work, you must do several things that are not trivial in Replit.
You need to add the following dependencies in your replit.nix
file:
{pkgs}: {
deps = [
pkgs.neovim
pkgs.libxcrypt
pkgs.ffmpeg-full
pkgs.libuuid
pkgs.openssl_1_1
];
env = {
PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.libuuid
pkgs.alsa-lib
pkgs.openssl_1_1
];
NIXPKGS_ALLOW_INSECURE="1";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.libuuid
];
};
}
And add the following to your .config/nixpkgs/config.nix
file:
{
permittedInsecurePackages = [
"openssl-1.1.1u"
];
}
{
nixpkgs.config.permittedInsecurePackages = [
"openssl-1.1.1u"
];
}
The main script for this project is main.py
. This script uses the Vocode library to create a voice-to-voice chatbot that uses Microsoft Azure's TTS service.
To run the project, simply execute the main.py
script.
In the Replit bash, manually install Vocode from Git:
pip install git+https://github.com/ArtisanLabs/vocode-python.git@486-support-for-pydantic-v2-v1-compatible
- Vocode - The library used to create the voice-to-voice chatbot
- Microsoft Azure - The cloud service provider used for TTS
- Replit - The online IDE used
- Deepgram - The automatic speech recognition service used
- OpenAI - The artificial intelligence research lab used for generating responses
- This project pays tribute to the exceptional work accomplished by @josh_meyer and @erogol at Coqui, which has unfortunately ceased operations.
- Special thanks to @Kian for his support and encouragement to publish this demo.
- Video of the previous demo can be found here