# ๐๏ธ pyvoicelib
<div align="center">
[](https://pypi.org/project/pyvoicelib/)
[](https://pepy.tech/projects/pyvoicelib)

[](LICENSE)
[](https://github.com/yazirofi/pyvoicelib)
</div>
---
> A **simple, cross-platform Python voice assistant library** for beginners, hobbyists, and developers.
Easily add **speech recognition** ๐ฃ๏ธ and **text-to-speech** ๐ to your Python projects.
---
## โจ Features
โ
Text-to-speech conversion (TTS)
โ
Speech recognition (STT)
โ
Simple API โ both **functions** and **VoiceAssistant class**
โ
Set **voice rate, volume, and gender** (male/female/neutral)
โ
Cross-platform: Windows, macOS, Linux
โ
Python **3.6+** supported
---
## ๐ฆ Installation
```bash
pip install pyvoicelib
````
For development (with testing):
```bash
git clone https://github.com/Yazirofi/pyvoicelib.git
cd pyvoicelib
pip install -r requirements-dev.txt
```
---
## ๐ Quick Start
### 1. Standalone Functions
```python
from pyvoicelib import speak, listen
# Text-to-speech
speak("Hello, I am your Python voice assistant!")
# Speech recognition
try:
text = listen()
print("You said:", text)
except Exception as e:
print("Error:", e)
```
---
### 2. Using the VoiceAssistant Class
```python
from pyvoicelib import VoiceAssistant
# Initialize assistant
assistant = VoiceAssistant(voice_rate=160, voice_volume=0.8, voice_gender="female")
# Speak
assistant.speak("Hi there, how can I help you?")
# Listen
try:
command = assistant.listen()
print("You said:", command)
except Exception as e:
print("Error:", e)
```
---
## ๐๏ธ Voice Customization
```python
from pyvoicelib import VoiceAssistant
assistant = VoiceAssistant
assistant.set_voice_rate(180) # Words per minute
assistant.set_voice_volume(0.7) # Volume (0.0 โ 1.0)
assistant.set_voice_gender("male") # 'male', 'female', 'neutral'
```
Check available voices on your system:
```python
print(assistant.get_available_voices())
```
---
## Change the voice gender
```python
from pyvoicelib import VoiceAssistant
va = VoiceAssistant()
print("Available voices:", va.get_available_voices())
va.set_voice_gender("female")
va.speak("Hello, this is the female voice.")
va.set_voice_gender("male")
va.speak("And now, this is the male voice.")
```
---
## ๐งช Running Tests
We use **pytest** for testing.
```bash
pytest -v
```
All tests are located in the `tests/` directory.
---
## ๐ ๏ธ Troubleshooting
### โ `No 'male' voice found. Using default system voice.`
* Your system may not provide explicitly labeled voices.
* Try `assistant.get_available_voices()` to list supported voices.
### โ `speech_recognition` or `pyaudio` ImportError
* Install missing dependencies:
```bash
pip install SpeechRecognition pyttsx3 pyaudio
```
### โ Microphone not working
* Ensure your microphone is enabled and selected as the input device.
* On Linux, install portaudio:
```bash
sudo apt-get install portaudio19-dev
```
### โ Python version error
* `pyvoicelib` requires **Python 3.6+**.
* Check with:
```bash
python --version
```
---
## ๐ก Example Project โ Simple Conversation Bot
```python
from pyvoicelib import VoiceAssistant
assistant = VoiceAssistant(voice_gender="female")
while True:
try:
command = assistant.listen()
if command:
print("You:", command)
if "exit" in command.lower():
assistant.speak("Goodbye!")
break
else:
assistant.speak(f"You said: {command}")
except Exception as e:
print("Error:", e)
```
---
## ๐ค Contributing
Pull requests are welcome! ๐
Please run tests before submitting:
```bash
pytest -v
```
---
## ๐ Resources
* [SpeechRecognition Docs](https://pypi.org/project/SpeechRecognition/)
* [pyttsx3 Docs](https://pyttsx3.readthedocs.io/)
---
## ๐ License
MIT License ยฉ 2025 [Yazirofi](https://github.com/Yazirofi)
---
๐ This README is **clean, stylish, and beginner-friendly**. It has:
- โจ Emojis for readability
- ๐ Quick start & examples
- ๐ ๏ธ Troubleshooting section
- ๐ก Example project
Raw data
{
"_id": null,
"home_page": "https://github.com/Yazirofi/pyvoicelib",
"name": "pyvoicelib",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "voice assistant speech recognition text-to-speech",
"author": "Shay Yazirofi",
"author_email": "yazirofi@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fa/e8/fc4f5a3431e1fa5c9f7917c859ba5b7d6c0b11a5ce6d742985ed80dd65bd/pyvoicelib-0.1.4.tar.gz",
"platform": null,
"description": "# \ud83c\udf99\ufe0f pyvoicelib\r\n\r\n<div align=\"center\">\r\n\r\n[](https://pypi.org/project/pyvoicelib/)\r\n[](https://pepy.tech/projects/pyvoicelib)\r\n\r\n[](LICENSE)\r\n[](https://github.com/yazirofi/pyvoicelib)\r\n\r\n</div>\r\n\r\n---\r\n> A **simple, cross-platform Python voice assistant library** for beginners, hobbyists, and developers. \r\nEasily add **speech recognition** \ud83d\udde3\ufe0f and **text-to-speech** \ud83d\udd0a to your Python projects.\r\n\r\n---\r\n\r\n## \u2728 Features\r\n\r\n\u2705 Text-to-speech conversion (TTS) \r\n\u2705 Speech recognition (STT) \r\n\u2705 Simple API \u2013 both **functions** and **VoiceAssistant class** \r\n\u2705 Set **voice rate, volume, and gender** (male/female/neutral) \r\n\u2705 Cross-platform: Windows, macOS, Linux \r\n\u2705 Python **3.6+** supported \r\n\r\n---\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n```bash\r\npip install pyvoicelib\r\n````\r\n\r\nFor development (with testing):\r\n\r\n```bash\r\ngit clone https://github.com/Yazirofi/pyvoicelib.git\r\ncd pyvoicelib\r\npip install -r requirements-dev.txt\r\n```\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### 1. Standalone Functions\r\n\r\n```python\r\nfrom pyvoicelib import speak, listen\r\n\r\n# Text-to-speech\r\nspeak(\"Hello, I am your Python voice assistant!\")\r\n\r\n# Speech recognition\r\ntry:\r\n text = listen()\r\n print(\"You said:\", text)\r\nexcept Exception as e:\r\n print(\"Error:\", e)\r\n```\r\n\r\n---\r\n\r\n### 2. Using the VoiceAssistant Class\r\n\r\n```python\r\nfrom pyvoicelib import VoiceAssistant\r\n\r\n# Initialize assistant\r\nassistant = VoiceAssistant(voice_rate=160, voice_volume=0.8, voice_gender=\"female\")\r\n\r\n# Speak\r\nassistant.speak(\"Hi there, how can I help you?\")\r\n\r\n# Listen\r\ntry:\r\n command = assistant.listen()\r\n print(\"You said:\", command)\r\nexcept Exception as e:\r\n print(\"Error:\", e)\r\n```\r\n\r\n---\r\n\r\n## \ud83c\udf9b\ufe0f Voice Customization\r\n\r\n```python\r\nfrom pyvoicelib import VoiceAssistant\r\nassistant = VoiceAssistant\r\n\r\nassistant.set_voice_rate(180) # Words per minute\r\nassistant.set_voice_volume(0.7) # Volume (0.0 \u2013 1.0)\r\nassistant.set_voice_gender(\"male\") # 'male', 'female', 'neutral'\r\n```\r\n\r\nCheck available voices on your system:\r\n\r\n```python\r\nprint(assistant.get_available_voices())\r\n```\r\n---\r\n## Change the voice gender\r\n```python\r\nfrom pyvoicelib import VoiceAssistant\r\n\r\nva = VoiceAssistant()\r\n\r\nprint(\"Available voices:\", va.get_available_voices())\r\n\r\nva.set_voice_gender(\"female\")\r\nva.speak(\"Hello, this is the female voice.\")\r\n\r\nva.set_voice_gender(\"male\")\r\nva.speak(\"And now, this is the male voice.\")\r\n```\r\n\r\n---\r\n\r\n## \ud83e\uddea Running Tests\r\n\r\nWe use **pytest** for testing.\r\n\r\n```bash\r\npytest -v\r\n```\r\n\r\nAll tests are located in the `tests/` directory.\r\n\r\n---\r\n\r\n## \ud83d\udee0\ufe0f Troubleshooting\r\n\r\n### \u274c `No 'male' voice found. Using default system voice.`\r\n\r\n* Your system may not provide explicitly labeled voices.\r\n* Try `assistant.get_available_voices()` to list supported voices.\r\n\r\n### \u274c `speech_recognition` or `pyaudio` ImportError\r\n\r\n* Install missing dependencies:\r\n\r\n ```bash\r\n pip install SpeechRecognition pyttsx3 pyaudio\r\n ```\r\n\r\n### \u274c Microphone not working\r\n\r\n* Ensure your microphone is enabled and selected as the input device.\r\n* On Linux, install portaudio:\r\n\r\n ```bash\r\n sudo apt-get install portaudio19-dev\r\n ```\r\n\r\n### \u274c Python version error\r\n\r\n* `pyvoicelib` requires **Python 3.6+**.\r\n* Check with:\r\n\r\n ```bash\r\n python --version\r\n ```\r\n\r\n---\r\n\r\n## \ud83d\udca1 Example Project \u2013 Simple Conversation Bot\r\n\r\n```python\r\nfrom pyvoicelib import VoiceAssistant\r\n\r\nassistant = VoiceAssistant(voice_gender=\"female\")\r\n\r\nwhile True:\r\n try:\r\n command = assistant.listen()\r\n if command:\r\n print(\"You:\", command)\r\n if \"exit\" in command.lower():\r\n assistant.speak(\"Goodbye!\")\r\n break\r\n else:\r\n assistant.speak(f\"You said: {command}\")\r\n except Exception as e:\r\n print(\"Error:\", e)\r\n```\r\n\r\n---\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nPull requests are welcome! \ud83c\udf89\r\nPlease run tests before submitting:\r\n\r\n```bash\r\npytest -v\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcd6 Resources\r\n\r\n* [SpeechRecognition Docs](https://pypi.org/project/SpeechRecognition/)\r\n* [pyttsx3 Docs](https://pyttsx3.readthedocs.io/)\r\n\r\n---\r\n\r\n## \ud83d\udcdc License\r\n\r\nMIT License \u00a9 2025 [Yazirofi](https://github.com/Yazirofi)\r\n\r\n---\r\n\r\n\ud83d\udc49 This README is **clean, stylish, and beginner-friendly**. It has: \r\n- \u2728 Emojis for readability \r\n- \ud83d\ude80 Quick start & examples \r\n- \ud83d\udee0\ufe0f Troubleshooting section \r\n- \ud83d\udca1 Example project \r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple Python voice library for Voice Assistant",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/Yazirofi/pyvoicelib"
},
"split_keywords": [
"voice",
"assistant",
"speech",
"recognition",
"text-to-speech"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "250c4d9d2de492f9bff586fd29e08b678a1f7dd26ec429ee8cd64a5b5acfb2b9",
"md5": "c1c0a2df5a9545c0b5eaf7ce8c5cf823",
"sha256": "67acb3416d14e11f6c9aa03feb301649b89fba7612a160c6ea7f0bb0fb820d65"
},
"downloads": -1,
"filename": "pyvoicelib-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c1c0a2df5a9545c0b5eaf7ce8c5cf823",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 10567,
"upload_time": "2025-08-21T11:15:18",
"upload_time_iso_8601": "2025-08-21T11:15:18.201723Z",
"url": "https://files.pythonhosted.org/packages/25/0c/4d9d2de492f9bff586fd29e08b678a1f7dd26ec429ee8cd64a5b5acfb2b9/pyvoicelib-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fae8fc4f5a3431e1fa5c9f7917c859ba5b7d6c0b11a5ce6d742985ed80dd65bd",
"md5": "d0ce9e4c66dc95fe9cd5774a95c7a811",
"sha256": "44e64526caf47b815d5e7dcf3f1b4e20cdab05d32c1eb537c64791aea2ba2000"
},
"downloads": -1,
"filename": "pyvoicelib-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "d0ce9e4c66dc95fe9cd5774a95c7a811",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9287,
"upload_time": "2025-08-21T11:15:19",
"upload_time_iso_8601": "2025-08-21T11:15:19.616146Z",
"url": "https://files.pythonhosted.org/packages/fa/e8/fc4f5a3431e1fa5c9f7917c859ba5b7d6c0b11a5ce6d742985ed80dd65bd/pyvoicelib-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 11:15:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Yazirofi",
"github_project": "pyvoicelib",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyvoicelib"
}