Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Story reader using python #280

Merged
merged 2 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions System-Automation-Scripts/Story Reader/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[![forthebadge](https://forthebadge.com/images/badges/made-with-python.svg)](https://forthebadge.com)

<div align="center">
<img src="audiobook.png" height=500 width="500">
</div>

# Audiobook

Read any audio book from pdf using python.

### Modules used:
1. PyPDF2
2. Pyttsx3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions System-Automation-Scripts/Story Reader/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from time import sleep

import pyttsx3 #pip install pyttsx3
import PyPDF2 #pip install PyPDF2

story = open('mybook.pdf', 'rb') #Name of your script make sure it's in pdf format
pdfReader = PyPDF2.PdfFileReader(story)
pages = pdfReader.numPages
# pages = pdfReader.getPage(number) Replace nu,ber with any specific page number you want this to read
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id) #For male voice change the value to 1.

for num in range(0, pages):
page = pdfReader.getPage(num)
text = page.extractText()
engine.say(text)
engine.runAndWait()
Binary file not shown.