{"id":11443,"date":"2022-02-18T09:16:52","date_gmt":"2022-02-18T08:16:52","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=11443"},"modified":"2023-12-04T17:51:22","modified_gmt":"2023-12-04T16:51:22","slug":"get-audio-from-text-with-python","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/get-audio-from-text-with-python\/","title":{"rendered":"Get audio from text with python"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"960\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image-960x960.png\" alt=\"Get audio from text with python\" class=\"wp-image-13771\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image-960x960.png 960w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image-320x320.png 320w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image-150x150.png 150w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image-768x768.png 768w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/12\/image.png 1024w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Hello, let&#8217;s see how to make a script to get audio from text using Python.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you run the script below, first click on top left then o bottom right.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This script is a Python program for capturing a specific region of the screen, performing optical character recognition (OCR) on the captured image to extract text, and then converting that text into audio. Here&#8217;s a breakdown of the key components and functionalities:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Imports:<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><code>win32clipboard<\/code>: A module for interacting with the Windows clipboard.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>pyscreenshot<\/code>: Used for taking screenshots.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>os<\/code>: Provides a way to interact with the operating system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>pynput.mouse.Listener<\/code>: Monitors mouse events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>sys<\/code>: Provides access to some variables used or maintained by the interpreter.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>tkinter<\/code>: GUI toolkit for creating a simple graphical user interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>gtts<\/code> (Google Text-to-Speech): Converts text into spoken words.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>time<\/code>: Provides various time-related functions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>glob<\/code>: Finds all the pathnames matching a specified pattern.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>PIL<\/code>: Python Imaging Library, used here for image processing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>pytesseract<\/code>: Wrapper for Google&#8217;s Tesseract-OCR Engine.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Functions:<\/strong><\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">grab(x, y, w, h): Captures a region of the screen defined by the coordinates (x, y) of the top-left corner and (w, h) of the bottom-right corner. Saves the screenshot as &#8216;im.png&#8217; and performs OCR on it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">save(im): Saves the provided image and opens it using the default image viewer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ocr(image, mp3=0): Performs OCR on the specified image file. If mp3 is set to 1, it also creates an MP3 file from the extracted text using Google Text-to-Speech.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">create_mp3(text, lang=&#8221;en&#8221;): Converts the provided text to an MP3 file using Google Text-to-Speech.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">clip(): Retrieves text data from the clipboard and attempts to create an MP3 file from it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">on_click(x, y, button, pressed): Callback function for mouse clicks. Records the coordinates of the first and second clicks and calls the grab function.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">start(): Initiates the process by destroying the GUI window and prompting the user to click on the top-left and bottom-right corners of the region to capture.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GUI (tkinter):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Creates a simple GUI with two buttons: &#8220;Grab to audio&#8221; and &#8220;Audio from clipboard.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;Grab to audio&#8221; button triggers the start function, which in turn initiates the mouse click listener for capturing a specific region of the screen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;Audio from clipboard&#8221; button triggers the clip function, which attempts to create an MP3 file from the text in the clipboard.<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Additional Notes:<\/strong><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The script includes an image viewer using tkinter to display images found in the current directory (<code>slides<\/code>).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The script uses the <code>pytesseract<\/code> library for OCR, which relies on the Tesseract OCR engine. Make sure Tesseract is installed on the system.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some parts of the code are commented out, and there&#8217;s a commented-out &#8220;Help&#8221; button in the GUI.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This script essentially provides a basic graphical interface for capturing a region of the screen, extracting text from it, and converting that text into an audio file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># grabscreen.py\nimport win32clipboard\nimport pyscreenshot as ImageGrab\nimport os\nfrom pynput.mouse import Listener\nimport sys\nimport tkinter as tk\nfrom gtts import gTTS\nimport time\nfrom glob import glob\nfrom PIL import Image, ImageTk\n'''\n        Grab a text from an image\n        grabbed clickin on the left top corner\n        and right down corner of the part of the screen\n        with the text.\n        It returns it in the console\n        Then... it transform it into audio.\n\n'''\n\nimport pytesseract\n\n\ndef grab(x, y, w, h):\n    im = ImageGrab.grab(bbox=(x, y, w, h))\n    save(im)\n    ocr(\"im.png\", mp3=1)\n\n\ndef save(im):\n    im.save('im.png')\n    os.startfile('im.png')\n\ntrycount = 0\ndef ocr(image, mp3=0):\n    global trycount\n\n\n    pytesseract.pytesseract.tesseract_cmd = r'C:\\Program Files\\Tesseract-OCR\\tesseract'\n    text = pytesseract.image_to_string(image)\n    print(text)\n    if mp3 == 1:\n        try:\n            create_mp3(text)\n        except:\n            trycount += 1\n            if trycount &lt; 3:\n                ocr()\n            else:\n                print(\"Some problems with connection maybe\")\n                trycount2 = 0\n\ndef create_mp3(text, lang=\"en\"):\n    s = gTTS(text, lang=lang)\n    print(\"Wait a second...\")\n    time.sleep(3)\n    s.save(f\"text.mp3\")\n    os.system(\"text.mp3\")\n\ntrycount2 = 0\ndef clip():\n    global trycount2\n\n\n    win32clipboard.OpenClipboard()\n    data = win32clipboard.GetClipboardData()\n    win32clipboard.CloseClipboard()\n    try:\n        create_mp3(data)\n    except:\n        trycount2 += 1\n        if trycount2 &lt; 3:\n            ocr()\n    else:\n        print(\"Some problems with connection maybe\")\n        trycount2 = 0\n\n\nclick1 = 0\nx1 = 0\ny1 = 0\ndef on_click(x, y, button, pressed):\n    global click1, x1, y1, listener\n    \n    if pressed:\n        if click1 == 0:\n            x1 = x\n            y1 = y\n            click1 = 1\n        else:\n            grab(x1, y1, x, y)\n            listener.stop()\n            sys.exit()\ndef start():\n    global listener\n\n    root.destroy()\n    print(\"Click once on top left and once on bottom right\")\n    # with Listener(on_move=on_move, on_click=on_click, on_scroll=on_scroll) as listener:\n    with Listener(on_click=on_click) as listener:\n        listener.join()\n        # listener.stop()\n        # sys.exit()\n\nroot = tk.Tk()\nroot.title(\"GRAUTESC 2 - Text to Audio APP\")\nroot.geometry(\"600x500\")\nbut = tk.Button(root, text=\"Grab to audio\", command=start, width=20, height=3, bg=\"gold\")\nbut.pack()\nbutclip = tk.Button(root, text=\"Audio from clipboard\", command=clip, width=20,height=3, bg=\"gold\")\nbutclip.pack()\n\n# # HELP\n# buthelp = tk.Button(root, text=\"Help\", command=clip, width=20, height=3, bg=\"gold\")\n# buthelp.pack()\n\ncounter = 0\ndef lab_print(event):\n    ocr(slides[0], mp3=0)\n\n    # global counter, slides, label\n\n    # counter += 1\n    # print(counter)\n    # if counter &lt; len(slides) - 1:\n    #     img = tk.PhotoImage(file=slides[counter])\n    #     label[\"image\"] = img\n    #     label.image = img\n    #     label.pack()\n    # else:\n    #     counter = 0\n\n\n# SLIDES\nslides = [x for x in glob(\"*.png\")]\nimage = Image.open(slides[0])\nprint(slides[0])\nimage = image.resize((200, 400), Image.ANTIALIAS)\nimg = ImageTk.PhotoImage(image=image)\nlabel = tk.Label(root, image=img)\nlabel.pack()\nlabel.bind(\"&lt;Button-1>\", lab_print)\n\nroot.mainloop()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><!-- se vuoi mettere un testo scorrevole\r\n[hoops name=\"typeWriterGen\"]\r\n\r\npoi metti un id diverso per ogni testo nella stessa pagina\r\n\r\n<div id=\"div01\">\r\n<script>\r\n\r\ntypeWriterGen(\"div01\",\"Esempio di testo scorrevole\");\r\n<\/script>\r\n\r\n-->\r\n<style>\r\n.avatar {\r\n  vertical-align: middle;\r\n  width: 100px;\r\n  height: 100px;\r\n  border-radius: 50%;\r\n}\r\n<\/style>\r\n\r\n<hr>\r\n\r\n<!-- NEWSLETTER LINK -->\r\n<a href=\"https:\/\/docs.google.com\/forms\/d\/e\/1FAIpQLSf7TniIPCWHDzCSGh2dYZaCwDvi9yLKS5ovFdKuK1sdfOvwEg\/viewform\">\r\n<img decoding=\"async\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/08\/image-13.png\" class=\"avatar\">\r\nSubscribe to the <b>newsletter<\/b> for updates<\/a><br>\r\n\r\n<!-- TKINTER TEMPLATE LINK -->\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/tkinter-templates\/\">\r\n<img decoding=\"async\" src=\"https:\/\/i0.wp.com\/pythonprogramming.altervista.org\/wp-content\/uploads\/2023\/07\/image-26.png\" class=\"avatar\">\r\nTkinter templates<\/a><br>\r\n\r\n<!-- MY AVATAR PUT A LINK TO YOUTUBE CHANNEL-->\r\n<iframe loading=\"lazy\" frameborder=\"0\" src=\"https:\/\/itch.io\/embed\/711828\" width=\"552\" height=\"167\"><a href=\"https:\/\/pythonprogrammi.itch.io\/pysnake\">PySnake by PythonProgrammi<\/a><\/iframe>\r\n<br>\r\n<style>\r\n.avatar {\r\n  vertical-align: middle;\r\n  width: 100px;\r\n  height: 100px;\r\n  border-radius: 50%;\r\n}\r\n<\/style>\r\n\r\n\r\n<a href=\"https:\/\/www.youtube.com\/channel\/UCzbxq5e9gLiY-je2-br1rvg\">\r\n\t<img decoding=\"async\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/10\/avatar64x64.png\" alt=\"Avatar\" class=\"avatar\">\r\n\t My youtube channel<\/a><br>\r\n\r\n<br>\r\n\r\nTwitter: <a href=\"https:\/\/twitter.com\/pythonprogrammi\">@pythonprogrammi - python_pygame<\/a>\r\n<h3>Claude's Games<\/h3>\r\n<p><a href=\"https:\/\/pythonprogramming.altervista.org\/random-daily-game-1-arkanoid\/\">Arkanoid<\/a><br>\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/platform-2d-with-pygame-made-with-claude\/\">Platform 2d<\/a><\/p> <!-- videogames made with claude -->\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/artifacts-games-day-1-memory-game\/\">1. Memory game<\/a>\r\n<h4>Videos<\/h4>\r\n<a href=\"https:\/\/youtu.be\/ciLjWWw5pLY\">Speech recognition game<\/a>\r\n<h3>Pygame's Platform Game<\/h3>\r\n\r\n<a href=\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-5-sounds-and-mixer\/\"><img decoding=\"async\" src=\"https:\/\/i1.wp.com\/pythonprogramming.altervista.org\/wp-content\/uploads\/2020\/01\/climbercover.png?w=557&ssl=1\"\/ width=\"50%\"><\/a>\r\n<script>\r\nvar title = \"Platform Pygame\";\r\n\t\tvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-animation-of-a-sprite-v-1-3\/\",\"Animation 1.3\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-sprite-animation-v-2-better-coding-test-it-checking-fps-on-the-screen\/\",\"Animation 1.2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-how-to-display-the-frame-rate-fps-on-the-screen\/\",\"Display Frame rate\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-sprite-animation-update\/\",\"Animation 1.1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platformer-1\/\",\"Pygame Platform Game 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-platform-game-2\/\",\"Pygame Platform 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-3-recap-cheatsheet\/\",\"Pygame PLatform 3 - recap and some Cheat Sheet\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-4-background-and-stuffs\/\",\"Pygame Platform 4 - Background & organizing code\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platform-game-5-sounds-and-mixer\/\",\"Pygame Platform 5 - Sounds\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/platform-game-in-detail-part-1\/\",\"Game in detail part 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/map-maker-1-2\/\", \"Map maker 1.2\"]\r\n\t\t];\r\n\t\t<\/script>\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\r\n\r\n<h3>Other Pygame's posts<\/h3>\r\n\r\n<script>\r\nvar title = \"Pygame's Posts\"\r\nvar links = [\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-platformer-1\/\",\"Platform game 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/make-a-platform-game-with-pygame-dafluffypotato\/\",\"DaFluffyPotato Platform Tutorials\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-and-classic-arcade-games-pong\/\",\"Pong Game Full\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-draws-in-colors-app-to-draw-with-pygame\/\",\"PyGameGIF 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-draw-app-with-animation\/\",\"PyGameGIF 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pydraw-2-0-app-to-draw-gif\/\",\"PyDraw 2.0\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-drawing-2\/\",\"Draw with Pygame\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animation-with-pygame\",\"Sprite animation 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animation-on-pygame-2-free-characters-and-more-actions\/\",\"Sprite animation 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/starting-with-pygame\/\",\"Starting movements with Pygame\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-3-move-sprite\/\", \"Move a Sprite\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-4-fonts\/\",\"Text and Fonts\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-animate-a-sprite\/\", \"Animate a sprite\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pygame-and-mouse-events\/\",\"Mouse events\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/pgp-aka-pygamepresentation-project\/\",\"Pygame presentation\"],\r\n\t[\"https:\/\/pythonprogramming.altervista.org\/moving-the-player-in-pygame-with-key-get_pressed\/\",\"How to use key.get_pressed()\"]\r\n]\r\n<\/script>\r\n\r\n\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"Gettting audio from text\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/get-audio-from-text-with-python\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":13771,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[1083,52,4,51],"class_list":["post-11443","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","tag-audio-from-text","tag-gui","tag-python","tag-tkinter"],"avopt_banners_inside_post":true,"avopt_banners_on_page":true,"av_copy_from":"","av_sharing_message":"","av_sharing_allowed":true,"av_sharing_on":{"fb":[],"tw":[]},"av_allow_affiliate_banner":false,"av_allow_affiliate_multi_banner":false,"av_show_affiliation_buy_button":false,"av_post_rating":true,"av_have_post_rating_value":false,"av_is_artificial_intelligence_content":false,"_links":{"self":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/11443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/comments?post=11443"}],"version-history":[{"count":7,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/11443\/revisions"}],"predecessor-version":[{"id":13780,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/11443\/revisions\/13780"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/13771"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=11443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=11443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=11443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}