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.3.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.3-py3-none-any.whl (5.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cosyvoice_ttsfrd-0.4.3.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.3.tar.gz
Algorithm Hash digest
SHA256 fc7b4a25067b3928439ed27f613ab8a6f221f39423797e58aadec96b59c8d6ea
MD5 abcf6431dfb06f8f204a4565df00c37c
BLAKE2b-256 908e5b4fb09b3f0def550eeb203ecb9531e71ff6a459f7fba56619451921c90a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cosyvoice_ttsfrd-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 52122c0b823b392f7b25f54a2b574c86737bee098b2c3ac811b275d2d90ba087
MD5 cc8899d67f9f45e4995827127a3ad05e
BLAKE2b-256 13805336a933eb107b6c95f4e5b05ed4112309dda1205965fe53be635f69aeeb

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