Hey developers! 👋
I just built a Smart Audio Book using Python that can read any PDF file aloud — and it's super beginner-friendly! 🧠🔊
🎯 What It Does
- Reads any PDF aloud using Python
- Custom speech speed and volume
- Works completely offline
- Optional: Save audio as
.mp3
🧠 Tech Used
-
PyPDF2
for reading PDF -
pyttsx3
for offline text-to-speech (TTS)
💻 Sample Code
import pyttsx3
from PyPDF2 import PdfReader
book = open('yourfile.pdf', 'rb')
reader = PdfReader(book)
pages = len(reader.pages)
engine = pyttsx3.init()
engine.setProperty('rate', 180)
engine.setProperty('volume', 1.0)
for i in range(pages):
text = reader.pages[i].extract_text()
if text:
engine.say(text)
engine.runAndWait()
📦 GitHub Repo
🔗 Smart Audio Book Project on GitHub
🚀 Future Ideas
- Add voice chooser (male/female)
- Save as
.mp3
file - Build a GUI with Tkinter
- Add keyboard pause/resume
👨💻 Why I Made This
I'm learning Python and wanted to build something useful, smart, and beginner-friendly. This helped me practice:
- Loops
- File handling
- Voice engine setup
- Real-world automation
Let me know what you think! Feedback or stars on GitHub are super appreciated 💙
Top comments (0)