Metadata-Version: 2.4
Name: emon
Version: 0.0.8
Summary: Voice input and output toolkit — build voice-to-voice projects easily.
Home-page: https://github.com/ABS-EMON/emon
Author: ABS EMON
Author-email: iotandrobotics@gmail.com
Keywords: voice tts speech recognition text-to-speech voice-assistant
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gTTS>=2.3.2
Requires-Dist: SpeechRecognition>=3.10.0
Requires-Dist: pygame>=2.5.0
Requires-Dist: PyAudio>=0.2.13
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# emon 🎙️🔊

**emon** is a simple Python package that gives your projects a voice —
both speaking *and* listening — with just a few lines of code.

[![PyPI version](https://badge.fury.io/py/emon.svg)](https://pypi.org/project/emon/)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

---

## ✨ Features

| Feature | Description |
|---|---|
| `v.say(text)` | Speak any text out loud (Text-to-Speech via gTTS) |
| `v.listen(prompt)` | Listen through microphone → return text (Speech-to-Text via Google) |
| `v.conversation(handler)` | Run a full voice-to-voice loop with your own logic |
| Multi-language | Works with Bangla, French, Spanish, and 50+ languages |

---

## 📦 Installation

```bash
pip install emon
```

> **Windows note:** If `PyAudio` fails to install, run:
> ```bash
> pip install pipwin
> pipwin install pyaudio
> ```
>
> **Linux note:**
> ```bash
> sudo apt-get install portaudio19-dev python3-pyaudio
> pip install pyaudio
> ```

---

## 🚀 Quick Start

```python
from emon import voice as v

# Speak something
v.say("Hello! I am emon, your voice assistant.")

# Listen for a reply
user = v.listen("Say something...")
print("You said:", user)

# Respond based on input
if "how are you" in user.lower():
    v.say("I am fine, thank you!")
```

---

## 🔄 Voice-to-Voice Conversation

Build a full voice chatbot in minutes:

```python
from emon import voice as v

def my_bot(text):
    text = text.lower()
    if "hello" in text:
        return "Hello! How can I help you?"
    elif "how are you" in text:
        return "I am fine and you?"
    elif "your name" in text:
        return "My name is Emon Assistant."
    else:
        return f"You said: {text}. I am still learning!"

# Starts listening in a loop. Say 'goodbye' to stop.
v.conversation(my_bot)
```

---

## 🌍 Multi-Language Support

```python
from emon import voice as v

# Bangla
v.say("আমি ভালো আছি", lang="bn")

# French
v.say("Bonjour le monde", lang="fr")

# Listen in Bangla
text = v.listen("বলুন...", language="bn-BD")
```

---

## 📖 API Reference

### `v.say(text, lang="en", slow=False)`
Converts `text` to speech and plays it through your speakers.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `text` | str | — | The words to speak |
| `lang` | str | `"en"` | gTTS language code |
| `slow` | bool | `False` | Speak slower if `True` |

---

### `v.listen(prompt="Listening...", timeout=5, phrase_time_limit=10, language="en-US")`
Records from your microphone and returns the recognised text as a string.
Returns `""` (empty string) if nothing was heard.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `prompt` | str | `"Listening..."` | Console message while waiting |
| `timeout` | int | `5` | Seconds to wait for speech to start |
| `phrase_time_limit` | int | `10` | Max seconds per phrase |
| `language` | str | `"en-US"` | BCP-47 recognition language |

---

### `v.conversation(handler, prompt="Listening...", exit_phrase="goodbye", language="en-US", tts_lang="en")`
Runs a continuous voice loop. `handler` receives the heard text and returns a reply string.

---

## 📄 License

MIT © [ABS EMON](https://github.com/ABS-EMON)
