Skip to main content

Async Python library for Nanmai TTS (DeepSeek/Kimi voices)

Project description

nanmai-tts

Async Python library for Nanmai TTS (DeepSeek/Kimi voices).

This package provides an easy-to-use interface for the Nanmai AI text-to-speech service, featuring high-quality Chinese voices. It follows the same design pattern as edge-tts for consistency.

Installation

pip install nanmai-tts

Usage

Basic Usage

import asyncio
import nanmai_tts

async def main():
    # Create a Communicate instance
    communicate = nanmai_tts.Communicate("你好世界", "DeepSeek")

    # Get audio data
    audio_data = await communicate.get_audio_data()

    # Or save directly to file
    await communicate.save("output.mp3")

asyncio.run(main())

Streaming

async def stream_audio():
    communicate = nanmai_tts.Communicate("Hello world", "Kimi")

    async for chunk in communicate.stream():
        if chunk["type"] == "audio":
            # Process audio chunk
            print(f"Received {len(chunk['data'])} bytes of audio")

CLI Usage

nanmai-tts --text "你好世界" --voice DeepSeek --write-media output.mp3

Available Voices

  • DeepSeek: Male voice, optimized for Chinese text
  • Kimi: Female voice, optimized for Chinese text

API Reference

Communicate Class

  • __init__(text: str, voice: str = "DeepSeek"): Initialize with text and voice
  • stream(): Async generator yielding audio chunks
  • save(filename: str): Save audio to file
  • get_audio_data() -> bytes: Get complete audio data

Requirements

  • Python 3.8+
  • aiohttp

License

This project is for educational and research purposes. The underlying Nanmai TTS API is proprietary.

Disclaimer

This package uses reverse-engineered authentication methods for the Nanmai TTS service. Use at your own risk and in accordance with applicable laws and terms of service.

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

nanmai_tts-0.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

nanmai_tts-0.0.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file nanmai_tts-0.0.1.tar.gz.

File metadata

  • Download URL: nanmai_tts-0.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for nanmai_tts-0.0.1.tar.gz
Algorithm Hash digest
SHA256 855972e0b0dfe1669dfec1c174692e43a839023281dc2e1de2d486ceb1dab2b2
MD5 ced3bc0761fa43eb9d90b42af7c517b6
BLAKE2b-256 4832cb0e87cfaa054a495af121036a5036b098b804f92edc81f82255ba0673bb

See more details on using hashes here.

File details

Details for the file nanmai_tts-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: nanmai_tts-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for nanmai_tts-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e1faece455e69aa0b8a3a0aa997e913ea9c74775768f3741feb47b73f7a8136
MD5 1791289f2268cc6368929c9c782fd53f
BLAKE2b-256 262c6eac7331d06de348cbeb15804e0e7449d22cda4a04657a296833b90b0bf1

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