{"id":9638,"date":"2023-06-11T22:39:25","date_gmt":"2023-06-11T22:39:25","guid":{"rendered":"https:\/\/max-drake.cc\/?p=9638"},"modified":"2023-06-11T22:43:27","modified_gmt":"2023-06-11T22:43:27","slug":"speech-to-text-with-python-or-word","status":"publish","type":"post","link":"https:\/\/max-drake.cc\/?p=9638","title":{"rendered":"Speech to Text with Python or Word"},"content":{"rendered":"\n<p>I am thinking about writing a book on Python scripting.<\/p>\n\n\n\n<p> I started to tinker with Text To Speech from PDF with python scripts and then looked at reversing the process from Speech to Text. There was a video on it so I found one and fossiked on my mobile for an Audi Recorder to create a file to use to convert. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Python Speech to Text script <\/h3>\n\n\n\n\n\n\n\n<p>I found the video below and this article <strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.thepythoncode.com\/article\/using-speech-recognition-to-convert-speech-to-text-python\" target=\"_blank\">How to Convert Speech to Text in Python<\/a><\/strong> and used the code from the article.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Python Convert Recorded Audio To Text | Python Speech Recognition\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/hMg9KZG6iSI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>The audio file I&#8217;d recorded was in .MP3 format and it wouldn&#8217;t work with the script as the library would only do .WAV files , so I looked to: <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Use online process for converting MP3 to WAV <\/li>\n\n\n\n<li>Get a script that converted MP3 to WAV then did Speech to text on file. <\/li>\n\n\n\n<li>Use a different app that recorded in .WAV format<\/li>\n<\/ol>\n\n\n\n<p>The first process worked well, and I was impressed with the results of the conversion,. only there was no punctuation, I hadn&#8217;t used words like comma or full stop in the audio file so it was a continuous stream of text, and it removed my &#8220;umms&#8217; of which there were many. <\/p>\n\n\n\n<p>The 2nd process not as successful as I needed some other files on my PC to make this conversion work. After downloading files and trying to run them, I wad unable to get the results from the script. <\/p>\n\n\n\n<p>Process 3 was the easiest solution and I found an app in the Store that would do this. I did a recording and sent it to my PC and converted it and it did a good job, still no punctuation of course. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import speech_recognition as sr\n\npath='Text2Speech2Text\/Speach2Text\/'\nfileIn='Test.wav'\nr = sr.Recognizer()\naudio_file = sr.AudioFile(path+fileIn)\nwith audio_file as source:\n    audio = r.record(source)\n    text = r.recognize_google(audio)\n    print(text)    <\/code><\/pre>\n\n\n\n<p>This script just printed it out to the terminal. I now had a process for doing the conversion. <\/p>\n\n\n\n<figure class=\"wp-block-pullquote alignleft has-text-align-left has-luminous-vivid-amber-background-color has-background has-medium-font-size\" style=\"border-style:none;border-width:0px;border-radius:47px\"><blockquote><p>the rain in Spain falls mainly in the plane and this is a recording to see it because I want to start recording audio so that I can actually write my python booking put my python ideas for the book down because a python book is going to be about beginner to intermediate practical tools for doing personal Bespoke apps that you want to use yourself<\/p><cite>Result of running script on audiofile<\/cite><\/blockquote><\/figure>\n\n\n\n<p>I had planned to use this as a method of dictating part of the book as I was out and about.  Then I came across another method of doing the same process. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Speech to Text Dictation or Transcribe in Word Online <\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to Transcribe Audio to Text in Microsoft Word\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/FxQvsCBpNAw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>This video showed me another method that I could use. I could use the audio file and get it to write the text, or I could dictate and get it to transcribe on the screen. <\/p>\n\n\n\n<p>I tried the 2nd process and was quite impressed with the results and decided to use it to write some paragraphs for my book. <\/p>\n\n\n\n<p>It did a very good job of removing the &#8220;umms&#8221; and as you can see the text being transcribed you can add punctuation like comma and full stop. <\/p>\n\n\n\n<p>It was a little slow, and after a while, whilst editing it I just continued to type and found that I stopped using the voice transcribing and continued with the typing. <\/p>\n\n\n\n<p>I think I&#8217;m used to speed and thought process with typing, so would find it diffucult to change to the transcribing process as it worked at a different rhythm than I work at. <\/p>\n\n\n\n<p>I will need to think about using the dictation process when I&#8217;m out and about and then using word online to convert to text. I may try this method later. <\/p>\n\n\n\n<p>advantages:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>it will transcribe into Word, which is the tool I&#8217;m using to write my book.<\/li>\n\n\n\n<li>I can quickly make voice notes on my phone, so capture thoughts while out and about<\/li>\n<\/ol>\n\n\n\n<p>disadvantages<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>After recording separate files I&#8217;ve to email them to my PC. Then download, then open Word Online and upload and transcribe<\/li>\n\n\n\n<li>After transcribing I need to edit then cut-copy\/paste into document it pertains to. <\/li>\n<\/ol>\n\n\n\n<p>Writing idea down when out and about I still need to email and then cut-copy\/paste into document it pertains to and also format it as well. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Comment &amp; more &#8211; Live Transcribe for Android phone &amp; Google Keep<\/h3>\n\n\n\n<p>Some interesting tools I was not aware of, and after playing with them I can see some uses for them. <\/p>\n\n\n\n<p>As I&#8217;m dictating, unless I&#8217;m totally focused, I forget the next sentence and so lots of umming and erring trying to get the next point down. This is not such a great issue with typing, but a more tedious process on a mobile phone small keyboard. <\/p>\n\n\n\n<p>This made me wonder if there was a voice to text on android phone and it came up with Google Live Transcribe. The only issue is cut\/paste is a bit of a nuisance but will definitely try it to capture ideas and paste to note. This may get around keyboard issues on mobile phone. <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to use Google&#039;s Live Transcribe app\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/j46K-8VhaCA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How To Copy Text From Live Transcribe - Google Live Transcribe\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/_uf7gT4GTY4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>I found <strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.androidauthority.com\/best-dictation-apps-android-1010363\/\" target=\"_blank\">10 best dictation apps for Android to transcribe audio to text<\/a> <\/strong>and one of them was <strong>Google Keep<\/strong>. So I&#8217;ll try using that to transcribe notes as well. <\/p>\n\n\n\n<p>I&#8217;ve Google Keep linked to PC as well as Mobile so that may be best process for ideas so that may be best process for capturing ideas. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">AI transcribe with Colab  &amp; with Whisper on PC<\/h3>\n\n\n\n<p>This looks interesting. Using audiofiles and transcribes to file with punctuation. <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Best FREE Speech to Text AI - Whisper AI\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/8SQV-B83tPU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>You can put it on your PC as per: <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to Install &amp; Use Whisper AI Voice to Text\" width=\"678\" height=\"381\" data-src=\"https:\/\/www.youtube.com\/embed\/ABFqbY_rmEk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" data-load-mode=\"1\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>This is definitely an interesting project to explore. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">End comment <\/h3>\n\n\n\n<p>Halfway through article I thought about voice instead of keyboard for android and that threw up some oppertunities, then later I saw the video on AI Whisper with python for PC so that may be another way to go, especially as it uses LLM&#8217;s and that is an opportunity to play with that technology. So there will be more on this topic. <\/p>\n\n\n\n<p>I did also wonder about different AI text to Text translation for my books for different languages. That may be worth exploring. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am thinking about writing a book on Python scripting. I started to tinker with Text To Speech from PDF with python scripts and then looked at reversing the process from Speech to Text. There was a video on it so I found one and fossiked on my mobile for an Audi Recorder to create [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9639,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[204,42,34],"tags":[],"class_list":["post-9638","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation","category-productivity","category-python"],"featured_image_src":"https:\/\/max-drake.cc\/wp-content\/uploads\/2023\/06\/Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox38_27.jpg","featured_image_src_square":"https:\/\/max-drake.cc\/wp-content\/uploads\/2023\/06\/Add-New-Post-\u2039-Vast-\u2014-WordPress-\u2014-Mozilla-Firefox38_27.jpg","author_info":{"display_name":"Max Drake","author_link":"https:\/\/max-drake.cc\/?author=1"},"_links":{"self":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/9638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9638"}],"version-history":[{"count":2,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/9638\/revisions"}],"predecessor-version":[{"id":9642,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/posts\/9638\/revisions\/9642"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=\/wp\/v2\/media\/9639"}],"wp:attachment":[{"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/max-drake.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}