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)