Metadata-Version: 2.4
Name: ttsfw
Version: 1.0.1
Summary: Text To Speech FrameWork. Pure Python. Zero Dependencies.
Author: SuleimanBelKiber1
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Classifier: Intended Audience :: Developers
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# ttsfw — Text To Speech FrameWork

**ttsfw** is a lightweight, fully autonomous Text-to-Speech (TTS) engine written in pure Python.

The project requires no third-party libraries, heavy neural networks, or internet connection. Everything runs locally using LPC (Linear Predictive Coding) algorithms and a built-in, ideal CMU dictionary parser.

## ✨ Features

*   **Zero Dependencies**: Runs entirely on the Python standard library (`wave`, `struct`, `math`, `io`). No `pip install` for audio libraries required.
*   **Ideal CMU Parser**: Supports the CMUdict pronunciation dictionary. Automatically uses a fast `cmudict.pkl` cache (if present next to the module) or parses the plain-text format.
*   **LPC Synthesis (Clear Speech)**: Formant-based speech synthesis (F1, F2, F3) using resonators, vibrato, and intonation control.
*   **Smart Text Processing**:
    *   Sentence segmentation (periods, question marks, exclamation points).
    *   Proper intonation (questions raise pitch toward the end, statements lower it).
    *   Number-to-words conversion.
*   **Cross-Platform**: The built-in `play()` function automatically detects the OS (Windows, macOS, Linux) for audio playback.

## 🚀 Quick Start

Make sure you have Python 3.6 or higher installed.

```python
from ttsfw import tts, play

# 1. Generate WAV in memory and play it immediately
wav_data = tts("Hello, world! This is a test of the text to speech framework.")
play(wav_data)

# 2. Save the result to a file
tts("The quick brown fox jumps over the lazy dog.", path="output.wav")

# 3. Using createfile
from ttsfw import createfile
createfile("Testing 123.", "test_123.wav")
```

📂 Important Note on the Dictionary

For the best pronunciation quality (G2P — Grapheme-to-Phoneme), it is recommended to place the cmudict.pkl file in the same folder as __init__.py (or in the project root).

If the file is missing, the engine will try to find cmudict.dict (the text version), and as a last resort, it will fall back to letter-by-letter reading, which may sound less natural.

📄 License

This project is distributed under the MIT License. You are free to use, modify, and distribute it.
