Text to speech using CSM TTS model
Project description
Sinapsis CSM
🐍 Installation • 🚀 Features • 📚 Usage example • 📙 Documentation • 🔍 License
This Sinapsis CSM package integrates a lightweight, efficient text-to-speech engine using the CSM model. It provides a simple template to convert input text into speech using Sinapsis.
🐍 Installation
[!IMPORTANT] Sinapsis project requires Python 3.10 or higher.
Install using your preferred package manager. We strongly recommend using uv. To install uv, refer to the official documentation.
Install with uv:
uv pip install sinapsis-csm --extra-index-url https://pypi.sinapsis.tech
Or with raw pip:
pip install sinapsis-csm --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates in each package may require additional dependencies. For development, we recommend installing the package with all the optional dependencies:
With uv:
uv pip install sinapsis-csm[all] --extra-index-url https://pypi.sinapsis.tech
Or with raw pip:
pip install sinapsis-csm[all] --extra-index-url https://pypi.sinapsis.tech
To run this package you need a HuggingFace token. See the official instructions and set it using
export HF_TOKEN=<token-provided-by-hf>
and test it through the cli or the webapp.
Access to the following models is needed:
🚀 Features
Templates Supported
-
CSMTTS: Converts text into speech using the CSM model.
Attributes
speaker_id(int, default: 0): Speaker identity index.max_audio_length_ms(int, default: 10000): Max audio length in milliseconds.device("cpu" or "cuda", default: "cpu"): Device used for inference.context(context: list[str] | None = None): Optional list of past utterances for context.sample_rate_hz(int, default: 24000): Output audio sample rate.
📚 Usage example
This example shows how to use the CSMTTS template to convert text into speech and save it to disk.
Agent config
agent:
name: csm_tts_agent
description: Agent that synthesizes speech from text using the CSM model.
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: TextInput
class_name: TextInput
template_input: InputTemplate
attributes:
text: "Hi, my name is Taylor and this is Sinapsis"
- template_name: CSMTTS
class_name: CSMTTS
template_input: TextInput
attributes:
speaker_id: 0
max_audio_length_ms: 10000
device: cpu
context: null
sample_rate_hz: 24000
- template_name: AudioWriterSoundFile
class_name: AudioWriterSoundFile
template_input: CSMTTS
attributes:
save_dir: csm_tts
extension: wav
To run the config, use:
sinapsis run packages/sinapsis_csm/src/sinapsis_csm/configs/csm_agent.yml
[!NOTE] The
TextInputandAudioWriterSoundFiletemplates come from the sinapsis-data-readers and sinapsis-data-writers packages. Make sure they are installed to use this example.
🌐 Webapp
The webapp included in this project showcases the modularity of the CSM template for speech generation tasks.[!IMPORTANT] To run the app you first need to clone this repository:
git clone git@github.com:Sinapsis-ai/sinapsis-speech.git
cd sinapsis-speech
[!NOTE] If you'd like to enable external app sharing in Gradio,
export GRADIO_SHARE_APP=True
🐳 Docker
IMPORTANT This docker image depends on the sinapsis-nvidia:base image. Please refer to the official sinapsis instructions to Build with Docker.
- Build the sinapsis-speech image:
docker compose -f docker/compose.yaml build
- Start the app container:
docker compose -f docker/compose_apps.yaml up -d sinapsis-csm
- Check the logs
docker logs -f sinapsis-csm
- The logs will display the URL to access the webapp, e.g.,::
Running on local URL: http://127.0.0.1:7860
NOTE: The url may be different, check the output of logs.
- To stop the app:
docker compose -f docker/compose_apps.yaml down
💻 UV
To run the webapp using the uv package manager, follow these steps:
- Sync the virtual environment:
uv sync --frozen
- Install the wheel:
uv pip install sinapsis-speech[all] --extra-index-url https://pypi.sinapsis.tech
- Run the webapp:
uv run webapps/packet_tts_apps/csm_tts_app.py
- The terminal will display the URL to access the webapp (e.g.):
Running on local URL: http://127.0.0.1:7860
NOTE: The URL may vary; check the terminal output for the correct address.
📙 Documentation
Documentation is available on the Sinapsis website.
Tutorials and guides for different templates and agents are available at docs.sinapsis.tech/tutorials.
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinapsis_csm-0.1.2.tar.gz.
File metadata
- Download URL: sinapsis_csm-0.1.2.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bd672d2bec8c16928fe852d4bae96939439740df8e6b699093a0c718ee2f516
|
|
| MD5 |
d3765bd33be67799f1a9f83042dee7dd
|
|
| BLAKE2b-256 |
4f6933eb200bfd38f7a001cc052412b16922b0217f4dde29c66b2e793759f432
|
File details
Details for the file sinapsis_csm-0.1.2-py3-none-any.whl.
File metadata
- Download URL: sinapsis_csm-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b3e63440718dcecc6df4cbc9fc924b47b0e347b86883d8b85a4d2c703922fe8
|
|
| MD5 |
909daeb3a332c4f0eec1e0b37d5bcbb7
|
|
| BLAKE2b-256 |
c5d366bebfe8b3eb3b0451133caea07cb770a2c2d7bf802621735086b4daf535
|