Skip to content

Commit

Permalink
Update Audiolibro.py
Browse files Browse the repository at this point in the history
Added more personalization options
  • Loading branch information
dmtzs committed Sep 13, 2021
1 parent d04a0bc commit 16d4bb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
audio.mp3
*.mp3
14 changes: 11 additions & 3 deletions Audiolibro.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@ def ReadBook():
speaker= pyttsx3.init()
speaker.setProperty("rate", 125)
speaker.setProperty("volume", 1.0)

bande= input("Qué deseas hacer, ingresa Y o n[Y= reproducir y guardar audio/n= solo guardar audio]: ")
bande.lower()


for pageNum in range(pdfReader.numPages):
text= pdfReader.getPage(pageNum).extractText()
speaker.say(text)
speaker.runAndWait()
textoCompleto+= text
speaker.runAndWait()

if bande== "y":
speaker.say(text)
else:
pass

speaker.stop()

speaker.save_to_file(textoCompleto, "audio.mp3")
nombreAudio= input("Ingresa el nombre que deseas que tenga el audio que se guardará: ")
speaker.save_to_file(textoCompleto, f"{nombreAudio}.mp3")
speaker.runAndWait()

if __name__== "__main__":
Expand Down

0 comments on commit 16d4bb0

Please sign in to comment.