This repository was archived by the owner on Nov 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
System-Automation-Scripts/Story Reader Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ [ ![ forthebadge] ( https://forthebadge.com/images/badges/made-with-python.svg )] ( https://forthebadge.com )
2+
3+ <div align =" center " >
4+ <img src =" audiobook.png " height =500 width =" 500 " >
5+ </div >
6+
7+ # Audiobook
8+
9+ Read any audio book from pdf using python.
10+
11+ ### Modules used:
12+ 1. PyPDF2
13+ 2. Pyttsx3
Original file line number Diff line number Diff line change 1+ from time import sleep
2+
3+ import pyttsx3 #pip install pyttsx3
4+ import PyPDF2 #pip install PyPDF2
5+
6+ story = open ('mybook.pdf' , 'rb' ) #Name of your script make sure it's in pdf format
7+ pdfReader = PyPDF2 .PdfFileReader (story )
8+ pages = pdfReader .numPages
9+ # pages = pdfReader.getPage(number) Replace nu,ber with any specific page number you want this to read
10+ engine = pyttsx3 .init ()
11+ voices = engine .getProperty ('voices' )
12+ engine .setProperty ('voice' , voices [0 ].id ) #For male voice change the value to 1.
13+
14+ for num in range (0 , pages ):
15+ page = pdfReader .getPage (num )
16+ text = page .extractText ()
17+ engine .say (text )
18+ engine .runAndWait ()
You can’t perform that action at this time.
0 commit comments