Skip to main content

A wrapper package to install the ttsfrd package for CosyVoice.

Project description

CosyVoice-ttsfrd

This package is a wrapper for the ttsfrd library used in CosyVoice. It simplifies installation by bundling the required wheels and resources.

!! Important

  • Platform: This package will only work on 64-bit Linux with Python 3.10.
  • License: This package redistributes software under the [Apache 2.0 License], which is the original license used in CosyVoice.
  • Purpose: This is a convenience wrapper. All credit goes to the original authors of CosyVoice and the ttsfrd library.

Installation

# Step 1: Install this wrapper package
pip install cosyvoice-ttsfrd
# Step 2: After the wrapper is installed, you must run the following command in your terminal. This will install the actual `ttsfrd` libraries and unzip the required resources.
cosyvoice-post-install

The installation process will automatically install the bundled ttsfrd wheels and unzip the required resources into the package directory. Installation log looks like:

 cosyvoice-post-install
CosyVoice-ttsfrd initialized. Resources are expected in: /mnt/user-ssd/songxingchen/.conda/envs/touchnet/lib/python3.10/site-packages/cosyvoice_ttsfrd/resource
--- Running Post-Installation Setup for CosyVoice-TTSFRD ---
Unzipping resources to /mnt/user-ssd/songxingchen/.conda/envs/touchnet/lib/python3.10/site-packages/cosyvoice_ttsfrd...
Resources unzipped. Package contents:
- __init__.py
- __pycache__
- bundled_files
- post_install.py
- resource
Installing ttsfrd_dependency-0.1-py3-none-any.whl from bundled file...
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Processing /mnt/user-ssd/songxingchen/.conda/envs/touchnet/lib/python3.10/site-packages/cosyvoice_ttsfrd/bundled_files/ttsfrd_dependency-0.1-py3-none-any.whl
Installing collected packages: ttsfrd-dependency
Successfully installed ttsfrd-dependency-0.1
Installing ttsfrd-0.4.2-cp310-cp310-linux_x86_64.whl from bundled file...
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Processing /mnt/user-ssd/songxingchen/.conda/envs/touchnet/lib/python3.10/site-packages/cosyvoice_ttsfrd/bundled_files/ttsfrd-0.4.2-cp310-cp310-linux_x86_64.whl
Installing collected packages: ttsfrd
Successfully installed ttsfrd-0.4.2
---  Post-Installation Finished Successfully! ---
You can now use the 'ttsfrd' module in your Python scripts.

Usage

After installation, you can import and use ttsfrd as you normally would. If you need to access the unzipped resources programmatically, you can do so like this:

import json
import ttsfrd
from cosyvoice_ttsfrd import get_resource_path

resource_dir = get_resource_path()
print(f"Resources are located at: {resource_dir}")

frd = ttsfrd.TtsFrontendEngine()
frd.initialize(resource_dir)
frd.set_lang_type('pinyinvg')

text = "嘿,你是不是在纠结,家里到底是该买个55~60的投影仪呢,还是整个大屏幕电视啊?这俩玩意儿确实各有各的好,选哪个主要就看你的钱袋子、平时都用它干啥、对画质要求高不高,还有家里地方够不够大。"
texts = [i["text"] for i in json.loads(frd.do_voicegen_frd(text))["sentences"]]
text = ''.join(texts)
print(text)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosyvoice_ttsfrd-0.4.2.tar.gz (5.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cosyvoice_ttsfrd-0.4.2-py3-none-any.whl (5.1 MB view details)

Uploaded Python 3

File details

Details for the file cosyvoice_ttsfrd-0.4.2.tar.gz.

File metadata

  • Download URL: cosyvoice_ttsfrd-0.4.2.tar.gz
  • Upload date:
  • Size: 5.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for cosyvoice_ttsfrd-0.4.2.tar.gz
Algorithm Hash digest
SHA256 b9ab3fd57d5cbf51de5a3a47e16071f70bcf2a2e56d1ce3355dce75befcd28c9
MD5 6c268abf54518cd12344dae661da22a2
BLAKE2b-256 d091019f8ffb5f0dfd06ffaf6db322aa57fb1806f1611899f56d220a40a057ce

See more details on using hashes here.

File details

Details for the file cosyvoice_ttsfrd-0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for cosyvoice_ttsfrd-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b4faa5bfe48ea99f32d7f2c44f39a1cdbdacf3df476901a8bf3b377fcbebfb81
MD5 630611609268b2b8a815d657bde5dbd1
BLAKE2b-256 dd5debf62f8ed5df4322c53512b97f6f69d9014ab9ca1b3d72d7286b5bec9abc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page