Repeatedly segfaults ("segmentation fault (core dumped)". Checking the size of the extracted text, it was always 7 or 8 (even if the same file is used). One test file turned out to be nothing but scanned pages (would need OCR) but there is no error checking (I'm looking into adding that). I carefully selected another PDF (not scanned pages, has selectable text etc.) but at first I got the same results. Added a "print(text)" line after extracting, and it contains nothing unless the pages are *CAREFULLY* selected to begin after things like covers, tables of contents, etc. - any pages of those types result in a seg fault too. Besides error checking, it would help to have a few simple key commands like + - up down left right (arrows) for things like volume (+/-), up/down to change speaker (perhaps cycle through the +m1...+f5 options on the available voices), and left/right arrows (to back up or jump forward by, say, a paragraph or a page), and 'q' to quit more gracefully. It's a pleasant enough "how-to" video (though a caveat about the PDFs being used really should be added!) That robot intonation though, is going to be very tough to overcome and I was unable to find any non-robotic voices on the web (the library has several dozen voices for different languages but most cannot speak Enlish, for example). Any thought that this would somehow replace Audiobooks (or regular books, or even text files) is wishful thinking. Despite my comments, I hope you'll continue to provide quick examples like this for Python newbies or (with a clear warning) for "quick and dirty use only".
Found the segfault cause - if a page is scanned only (no actual text), than pyttsx3 segfaults when that "text" of zero-size is encountered. Sounds like something they should check in the library, but for now I've done it by just checking "len(text)" and skipping the handoff to pyttsx3 if it's less than 10 bytes or so (could just check for 0 but there may be conditions where the 0-size "text" shows up as an attribute value of some kind). With this, the code works better. Added some voice options (+m and +f) and an option to print the text to screen as well as saying it (seems to help for very technical text where pyttsx3 gets bogged down in trying to spell things out, etc.) Still not a replacement for audiobooks, but passable now for probably 2/3rds of the test PDFs I've thrown at it.
It would be a great sponsor because the tts even paid one from google or amazon are terrible for audiobooks, they sound terrible, even the deeplearning ones and are more expensive word for word then audible. It just makes no sense (as of 2020). Will check on the idea in couple years, there are good chances it will change.
Many people who own a Mac don't spend much money on computers, this Mac is from 2009, and so is the computer in my bedroom, in the living room and in the Mac in mail-room is even from 1999. Still working so why would I replace it? Most of my computers have costed me only a few hundred a year if the new price is spread over a decade or so. Mac owners do not alway have truckloads of money, all computers in my house have to share only one laser printer. I even had to save money on wires! Nowhere in my house you will find that fancy new stuff like the one that looks like a garbage bin, not even to think about the newest newest.
@@vanhetgoor yes overpriced computer.could use linux if want ls command xD.windows and linux can run mac on emulator even now they run faster than original.thats funny xD
After you wrote the loop, you forgot to change the number 7 to the variable ”num.” If you run the code with this mistake, it will read page number 7, 103 times 😂
@@qn565 it's ok, many people around the world are poor. To laugh at someone's poverty is the biggest poverty. Don't be sad. Better days will come. Let's keep downloading pdfs till then :) I'm not poor but I've seen some hard days. I wish nobody is poor in this world, ever. The one who wants nothing is the richest and the one isn't content is the poorest. btw I'm Indian. Richness is what we need, not riches.
Definitely. Though with this approach, one can extend it to read other sources of text. In general, coding it gives you greater control (e.g. playback speed or storing the speech into a file and uploading it to my phone).
But audio books have proper trained voice artists who have beautiful voices. Electronic reading sounds awful. PS don't come for my cookies, I haven't got any
you can use this It is much better than the voice of pyttsx3 def speak(str): from gtts import gTTS from playsound import playsound language = 'en-In' myobj = gTTS(text=str, lang=language) myobj.save("welcome1.mp3") playsound("welcome1.mp3")
Hahaha...wow....I don't know if I need a audiobook but I definitely found this so useful and I know nothing about coding and now I know something about coding that I can use if I want . Great stuff 👍 And I subscribed coz your grandma is cool 😎
Just for a say: If you want to enjoy programming, then use Linux. You don't have drop a sweat installing such python, etc etc files, everything is just backed Into the system..
I wouldn't do that for fiction books though; Even within audio book, one has to be careful to know who is reading it: some readers are very good at adding another dimension by injecting proper emotions.
This is so useful. I will definitely use this a lot. I’m still new to this and have been using the spyder IDE but now can see the benefit of using pycharm! Thanks for this tutorial 👍🏻
I just have got an ebook of nanotech and it is a whopping 319 pages. But now, the book is going to read itself. I feel very motivated by these tutorials. Thanks a lot and I hope you will be the best coder with the best coding channel of all time.
It seems that your grandma will do more than eat all cookies - is she going to target practice with the cookie jars? In any case I felt an urge to like this video.
1. You will have to do it for every single page. You have to just write file name in this code. 2. It works offline 3.(most important) It will be more satisfying to listen to something what you coded yourself.
Hi Hero, You made a little code error. If you want the code to loop all the pages Line 9 should be : "page = pdfReader.getPage(num)" Anyway, LOVED YOUR WORK..
This is such a cool idea! Thanks for sharing. Sometimes it's hard to find the motivation or drive to want to code, but seeing wacky ideas like this makes me want to.
@@maxhoden0303 we can do like that, but for more flexibility, we should use the keyboard module to detect a key press which will be set up to dynamically add/subtract values of a variable, then we use that variable in the time sleep function, then we can control the time sleep function resulting in more flexibility
I just did this project but occured error that osError but i just open the pdf file but showing error invalid argument .. can u please tell me the solution 🙏🙏
Great video. But it's also to be noted that the document structure might not support parsing and so it might not ALWAYS be feasible to use this to extract text from it. Just a heads up for people :)
while debugging the code i got pydev debugger: process is connecting this error and then program automatically finish without any python voice anyone knows the exact solution
Hi! I'm Pronab Mondal, I have one quaries. Before that I want to inform you that presently I'm using Python 3.9 64bit Ver. and PyCharm community Edition 2020.2.3 which is now latest. As following your video I was doing step by step but i'm not able to count the pdf pages. "pages = pdfReader.numPages" I stuck here. numPages is not showing in my Pycham. Please help me
"Use another pdf file and see if it still has the same error. If it does, switch back to previous version of python. Not every modules are updated with python latest versions.
You can do it by changing rate & voice property. e.g. rate = speaker.getProperty('rate') speaker.setProperty('rate',130) voices = speaker.getProperty ('voices') speaker.setProperty ('voice', voices[1].id)
This is amazing . A few questions 1. Does python also skips Diagrams on the page. 2. Also I saw , the program started reading from header. Any way you can skip header and footer of the page. 3. If the PDF is in 2 column format, does it detects it intelligently ? 4. What if there is a table in between . how does this table gets read , row wise or columnwise.
my moduel is not installing it is coming eeror it is ERROR: Could not find a version that satisfies the requirement pypfd2 ERROR: No matching distribution found for pypfd2
He seems to be a bengali. They have this same accent. (My 3 college professors are bengali and have the same accent, idk how😂) Also, I feel he is Bangladeshi, not sure though.