{"id":4140,"date":"2026-03-26T20:14:45","date_gmt":"2026-03-26T11:14:45","guid":{"rendered":"https:\/\/www.dogrow.net\/python\/?p=4140"},"modified":"2026-03-28T20:40:26","modified_gmt":"2026-03-28T11:40:26","slug":"blog141%e3%80%90google-cloud-tts-8%e3%80%91%e4%ba%8c%e4%ba%ba%e4%bb%a5%e4%b8%8a%e3%81%ae%e4%bc%9a%e8%a9%b1%e3%82%92%e5%85%a5%e5%8a%9b%e5%8f%af%e8%83%bd%e3%81%ab","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/python\/blog141%e3%80%90google-cloud-tts-8%e3%80%91%e4%ba%8c%e4%ba%ba%e4%bb%a5%e4%b8%8a%e3%81%ae%e4%bc%9a%e8%a9%b1%e3%82%92%e5%85%a5%e5%8a%9b%e5%8f%af%e8%83%bd%e3%81%ab\/","title":{"rendered":"(141)\u3010Google Cloud TTS #8\u3011\u4e8c\u4eba\u4ee5\u4e0a\u306e\u4f1a\u8a71\u3092\u5165\u529b\u53ef\u80fd\u306b"},"content":{"rendered":"<h1 class=\"my_h\">\u30100\u3011\u9023\u8f09\u5185\u5bb9<\/h1>\n<p><a href=\"https:\/\/www.dogrow.net\/python\/blog134-google-cloud-tts%e3%82%92%e4%bd%bf%e3%81%84%e5%a7%8b%e3%82%81%e3%82%8b%e3%80%82\/\" target=\"_blank\">(134)\u3010Google Cloud TTS #1\u3011\u5b50\u3069\u3082\u306e\u82f1\u4f1a\u8a71\u5b66\u7fd2\u6559\u6750\u3092\u4f5c\u308a\u305f\u3044\uff01<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog135%e3%80%90google-cloud-tts-2%e3%80%91google-cloud%e5%81%b4%e3%81%ae%e6%ba%96%e5%82%99%e4%bd%9c%e6%a5%ad\/\" target=\"_blank\">(135)\u3010Google Cloud TTS #2\u3011Google Cloud\u5074\u306e\u6e96\u5099\u4f5c\u696d<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog136%e3%80%90google-cloud-tts-3%e3%80%91%e8%87%aa%e5%89%8d%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e5%81%b4%e3%81%ae%e6%ba%96%e5%82%99%e4%bd%9c%e6%a5%ad%ef%bc%88ubuntu24%ef%bc%89\/\" target=\"_blank\">(136)\u3010Google Cloud TTS #3\u3011\u81ea\u524d\u30b5\u30fc\u30d0\u30fc\u5074\u306e\u6e96\u5099\u4f5c\u696d\uff08Ubuntu24\uff09<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog137%e3%80%90google-cloud-tts-4%e3%80%91web%e3%83%96%e3%83%a9%e3%82%a6%e3%82%b6%e3%81%8b%e3%82%89%e5%ae%9f%e8%a1%8c\/\" target=\"_blank\">(137)\u3010Google Cloud TTS #4\u3011WEB\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u5b9f\u884c<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog138%e3%80%90google-cloud-tts-5%e3%80%91%e8%a9%b1%e3%81%99%e9%80%9f%e5%ba%a6%e3%82%92%e3%82%86%e3%81%a3%e3%81%8f%e3%82%8a%e3%81%ab\/#google_vignette\" target=\"_blank\">(138)\u3010Google Cloud TTS #5\u3011\u8a71\u3059\u901f\u5ea6\u3092\u3086\u3063\u304f\u308a\u306b<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/139%e3%80%90google-cloud-tts-6%e3%80%91%e8%a9%b1%e3%81%99%e9%80%9f%e5%ba%a6\/\" target=\"_blank\">(139)\u3010Google Cloud TTS #6\u3011\u58f0\u306e\u5927\u304d\u3055\u3001\u58f0\u306e\u9ad8\u3055\u3092\u5909\u3048\u308b\u3002<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog140%e3%80%90google-cloud-tts-7%e3%80%91%e8%a9%b1%e8%80%85%ef%bc%88speaker-voice%ef%bc%89%e3%82%92%e6%8c%87%e5%ae%9a%e5%8f%af%e8%83%bd%e3%81%ab%e3%81%99%e3%82%8b%e3%80%82\/\" target=\"_blank\">(140)\u3010Google Cloud TTS #7\u3011Web\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u8a71\u8005\uff08Voice\uff09\u3092\u6307\u5b9a\u53ef\u80fd\u306b<\/a><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog141%e3%80%90google-cloud-tts-8%e3%80%91%e4%ba%8c%e4%ba%ba%e4%bb%a5%e4%b8%8a%e3%81%ae%e4%bc%9a%e8%a9%b1%e3%82%92%e5%85%a5%e5%8a%9b%e5%8f%af%e8%83%bd%e3%81%ab\/\" target=\"_blank\">(141)\u3010Google Cloud TTS #8\u3011\u4e8c\u4eba\u4ee5\u4e0a\u306e\u4f1a\u8a71\u3092\u5165\u529b\u53ef\u80fd\u306b<\/a> <span class='my_fs_big1B'>\u2190\u4eca\u56de\u306f\u30b3\u30b3<\/span><br \/>\n<a href=\"https:\/\/www.dogrow.net\/python\/blog142%e3%80%90google-cloud-tts-9%e3%80%91%e8%8b%b1%e4%bc%9a%e8%a9%b1%e6%95%99%e6%9d%90%e3%82%92%e4%bd%9c%e3%82%8b%e3%80%82%ef%bc%88%e4%b8%80%e5%85%88%e3%81%9a%e5%ae%8c%e7%b5%90%ef%bc%89\/\" target=\"_blank\">(142)\u3010Google Cloud TTS #9\u3011\u82f1\u4f1a\u8a71\u6559\u6750\u3092\u4f5c\u308b\u3002\uff08\u4e00\u5148\u305a\u5b8c\u7d50\uff09<\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/wp-content\/uploads\/2026\/03\/Image5-1.jpg\" alt=\"\" \/><\/p>\n<h1 class=\"my_h\">\u30101\u3011\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u4eca\u56de\u306f\u3001<a href=\"https:\/\/www.dogrow.net\/python\/blog140%e3%80%90google-cloud-tts-7%e3%80%91%e8%a9%b1%e8%80%85%ef%bc%88speaker-voice%ef%bc%89%e3%82%92%e6%8c%87%e5%ae%9a%e5%8f%af%e8%83%bd%e3%81%ab%e3%81%99%e3%82%8b%e3%80%82\/\" target=\"_blank\">\u524d\u56de\u306e\u6295\u7a3f<\/a> \u306e\u300c\u4eca\u5f8c\u3084\u308a\u305f\u3044\u3053\u3068\u300d\u306b\u66f8\u3044\u305f\u3053\u3068\u3092\u5b9f\u88c5\u3059\u308b\u3002<br \/>\n<span class='my_fc_blueBBig'>\u4e8c\u4eba\u4ee5\u4e0a\u306e\u4f1a\u8a71\u3092\u5165\u529b\u53ef\u80fd\u306b\u3059\u308b\u3002<br \/>\n\u3000\u2192 \uff08\u97f3\u58f0\u30ad\u30e3\u30e9\u30af\u30bf\u30fc\u3001\u82f1\u6587\u30c6\u30ad\u30b9\u30c8\uff09\u3092\u30bb\u30c3\u30c8\u3068\u3057\u3001\u8907\u6570\u30bb\u30c3\u30c8\u3092\u9806\u756a\u306b TTS\u51e6\u7406\u3057\u3001\u4e00\u3064\u306eMP3\u30d5\u30a1\u30a4\u30eb\u306b\u7d50\u5408\u3059\u308b\u3002<\/span><\/p>\n<h1 class=\"my_h\">\u30102\u3011\u5b8c\u6210\u5f62<\/h1>\n<p><span class='my_fc_blueBBig'>\u3053\u3093\u306a\u611f\u3058\u306b\u51fa\u6765\u4e0a\u304c\u3063\u305f\u3002<\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/python\/wp-content\/uploads\/2026\/03\/Image2-2.jpg\" alt=\"\" class='my_add_bs1' \/><\/p>\n<h3 class=\"my_h\">\u4f7f\u3044\u65b9<\/h3>\n<p>(1) \u82f1\u6587\u30c6\u30ad\u30b9\u30c8\u3092\u5165\u529b\u3059\u308b\u3002<br \/>\n(2) \u8aad\u307f\u4e0a\u3052\u901f\u5ea6\u3092\u8a2d\u5b9a\u3059\u308b\u3002 0.3\u500d \uff5e 2.0\u500d<br \/>\n(3) \u97f3\u58f0\u3092\u9078\u629e\u3059\u308b\u3002<br \/>\n\u3053\u308c\u3092\u6700\u59274\u56de\u5206\u6307\u5b9a\u3067\u304d\u308b\u3002\u3053\u308c\u3092\u4f7f\u3048\u3070\u8907\u6570\u4eba\u304c\u4f1a\u8a71\u3057\u3066\u3044\u308b\u30b7\u30fc\u30f3\u304c\u4f5c\u308c\u308b\u3002<br \/>\n\u3000\u2193<br \/>\n[\u97f3\u58f0\u3092\u751f\u6210]\u3000\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3059\u308b\u3068\u3001\u4e0a\u8a18(1),(2),(3)\u3067\u6307\u5b9a\u3057\u305f\u901a\u308a\u306e MP3\u97f3\u58f0\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u6765\u4e0a\u304c\u308b\u3002<\/p>\n<h1 class=\"my_h\">\u30103\u3011\u30d7\u30ed\u30b0\u30e9\u30e0<\/h1>\n<p>\u30a8\u30e9\u30fc\u51e6\u7406\u3001\u30ed\u30b0\u53ce\u96c6\u51e6\u7406\u306a\u3069\u306e\u6b8b\u4ef6\u304c\u3044\u308d\u3044\u308d\u3068\u3042\u308b\u304c\u3001\u3072\u3068\u307e\u305a\u6240\u671b\u306e\u6a5f\u80fd\u3092\u5b9f\u88c5\u3067\u304d\u305f\u306e\u3067\u8a18\u9332\u3057\u3066\u304a\u3053\u3046\u3002<\/p>\n<h3 class=\"my_h\">1\/6 : index.py<\/h3>\n<p>Web\u30da\u30fc\u30b8\u3092\u4f7f\u3063\u305f\u64cd\u4f5c\u753b\u9762\u3060\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/opt\/webtts\/myenv\/bin\/python\r\nimport cgi\r\nimport os\r\nimport sys\r\nfrom datetime import datetime\r\n\r\n# \u30c7\u30d0\u30c3\u30b0\u7528\uff08\u30a8\u30e9\u30fc\u6642\u306b\u8a73\u7d30\u3092\u30d6\u30e9\u30a6\u30b6\u306b\u8868\u793a\uff09\r\nimport cgitb\r\ncgitb.enable()\r\n\r\n# \u81ea\u4f5c\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30d1\u30b9\u3092\u901a\u3059\r\nsys.path.append(&#039;\/opt\/webtts\/src&#039;)\r\nimport my_ggtts \r\nfrom CVoice import CVoices\r\n\r\n# HTTP\u30d8\u30c3\u30c0\u30fc\u306e\u51fa\u529b\r\nprint(&quot;Content-Type: text\/html; charset=utf-8\\n&quot;)\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\ndef execute_TTS(form, cvoices):\r\n    #-------------------------------------------------------------------\r\n    # \u5165\u529b\u60c5\u5831\u3092\u53d6\u5f97\r\n    texts  = form.getlist(&#039;text&#x5B;]&#039;)\r\n    srates = form.getlist(&#039;srate&#x5B;]&#039;)\r\n    vnames = form.getlist(&#039;vname&#x5B;]&#039;)\r\n    fname_prefix = form.getvalue(&#039;fname_prefix&#039;)\r\n    #-------------------------------------------------------------------\r\n    html_sound = &#039;&#039;\r\n    tts_request = &#x5B;]\r\n    for text, srate, vname in zip(texts, srates, vnames):\r\n        #---------------------------------------------------------------\r\n        if not text:                                # \u82f1\u6587\u30c6\u30ad\u30b9\u30c8\u306e\u5165\u529b\u306a\u3057\uff1f\r\n            break\r\n        #---------------------------------------------------------------\r\n        try:\r\n            sratef = float(srate)\r\n        except (TypeError, ValueError):\r\n            sratef = 0.8\r\n        sratef = max(0.3, min(2.0, sratef))         # 0.3\uff5e2.0\u306b\u4e38\u3081\u308b\u3002\r\n        #---------------------------------------------------------------\r\n        vitem = cvoices.get_item(vname)             # \u6307\u5b9a\u306e Voice\u60c5\u5831\u3092\u53d6\u5f97\r\n        if not vitem:\r\n            raise RuntimeError(f&quot;Internal error in execute_TTS&#x5B;1]&quot;)\r\n        #---------------------------------------------------------------\r\n        tts_request.append(&#x5B;text, sratef, vitem])\r\n    #-------------------------------------------------------------------\r\n    if len(tts_request) &gt; 0:\r\n        #---------------------------------------------------------------\r\n        # MP3\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u4f5c\u308b\u3002\r\n        filename  = f&quot;{fname_prefix}.mp3&quot;\r\n        #---------------------------------------------------------------\r\n        # TTS\u5b9f\u884c\r\n        try:\r\n            output_filepath = os.path.join(my_ggtts.OUTPUT_DIR, filename)\r\n            my_ggtts.generate_voice_from_list( tts_request, output_filepath )\r\n            audio_url  = f&quot;\/webtts\/sound\/{filename}&quot;\r\n            html_sound = f&quot;&quot;&quot;\r\n                &lt;hr&gt;\r\n                &lt;h3&gt;\u751f\u6210\u7d50\u679c:&lt;\/h3&gt;\r\n                &lt;audio controls autoplay&gt;\r\n                    &lt;source src=&quot;{audio_url}?t={os.path.getmtime(output_filepath)}&quot; type=&quot;audio\/mpeg&quot;&gt;\r\n                    \u304a\u4f7f\u3044\u306e\u30d6\u30e9\u30a6\u30b6\u306faudio\u8981\u7d20\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093\u3002\r\n                &lt;\/audio&gt;\r\n            &quot;&quot;&quot;\r\n\r\n        except Exception as e:\r\n            raise RuntimeError(f&quot;TTS failed: {e}&quot;) from e\r\n    #-------------------------------------------------------------------\r\n    return html_sound\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\ndef makeHtml_conversationForm( cvoices, form, num_rows=4 ):\r\n    #-------------------------------------------------------------------\r\n    texts  = form.getlist(&#039;text&#x5B;]&#039;)\r\n    srates = form.getlist(&#039;srate&#x5B;]&#039;)\r\n    vnames = form.getlist(&#039;vname&#x5B;]&#039;)\r\n    #-------------------------------------------------------------------\r\n    html_rows = &#039;&#039;\r\n    rows = &#x5B;]\r\n    for i in range(num_rows):\r\n        #---------------------------------------------------------------\r\n        # form\u30c7\u30fc\u30bf\u304c\u3042\u308c\u3070\u3001\u524d\u56de\u306e\u5165\u529b\u5024\u3092\u53d6\u5f97\u3059\u308b\u3002\r\n        text  = texts&#x5B;i]  if len(texts)  &gt; i else &#039;&#039;\r\n        srate = srates&#x5B;i] if len(srates) &gt; i else &#039;0.8&#039;\r\n        vname = vnames&#x5B;i] if len(vnames) &gt; i else &#039;&#039;\r\n        #---------------------------------------------------------------\r\n        # Voice\u9078\u629e\u306e &lt;select&gt; \u8981\u7d20\u3092\u4f5c\u6210\r\n        html_select_voice = cvoices.getHtml_select(active_vname=vname, elm_name=&#039;vname&#x5B;]&#039;)\r\n        #---------------------------------------------------------------\r\n        # 1 Voice\u5206\uff08\uff1d1\u884c\u5206\uff09\u306e\u8868\u793a\u9805\u76ee\u3092\u4f5c\u6210\r\n        html_row = f&#039;&#039;&#039;\r\n            &lt;td&gt;&lt;textarea name=&quot;text&#x5B;]&quot; rows=&quot;5&quot; cols=&quot;100&quot; placeholder=&quot;\u558b\u3089\u305b\u305f\u3044\u6587\u5b57\u3092\u5165\u529b...&quot;&gt;{text}&lt;\/textarea&gt;&lt;br&gt;&lt;\/td&gt;\r\n            &lt;td&gt;&lt;input type=&quot;number&quot; name=&quot;srate&#x5B;]&quot; value=&quot;{srate}&quot; step=&quot;0.1&quot; min=&quot;0.3&quot; max=&quot;2.0&quot;&gt;&lt;\/td&gt;\r\n            &lt;td&gt;{html_select_voice}&lt;\/td&gt; &#039;&#039;&#039;\r\n        rows.append(f&#039;&lt;tr&gt;{html_row}&lt;\/tr&gt;&#039;)\r\n    #-------------------------------------------------------------------\r\n    html_rows = &#039;&#039;.join(rows)\r\n    return f&#039;&#039;&#039;\r\n        &lt;table&gt;\r\n            &lt;tr&gt;\r\n                &lt;th&gt;\u82f1\u6587\u30c6\u30ad\u30b9\u30c8&lt;\/th&gt;\r\n                &lt;th&gt;\u8aad\u307f\u4e0a\u3052\u901f\u5ea6&lt;br&gt;&lt;small&gt;0.3\u500d\uff5e2.0\u500d&lt;\/small&gt;&lt;\/th&gt;\r\n                &lt;th&gt;\u97f3\u58f0&lt;\/th&gt;\r\n            &lt;\/tr&gt;\r\n            {html_rows}\r\n        &lt;\/table&gt; &#039;&#039;&#039;\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nform = cgi.FieldStorage()   # \u30d5\u30a9\u30fc\u30e0\u30c7\u30fc\u30bf\u306e\u53d6\u5f97\r\naction = form.getvalue(&#039;action&#039;, &#039;&#039;)\r\ncvoices = CVoices()         # \u97f3\u58f0(voice)\u60c5\u5831\u3092 JSON\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30ed\u30fc\u30c9\u3059\u308b\u3002\r\nhtml_sound = &#039;&#039;             # \u30b5\u30a6\u30f3\u30c9\u30d7\u30ec\u30a4\u30e4\u30fc\u306eHTML\u6587\r\nif action == &#039;exectts&#039;:     # &#x5B;\u97f3\u58f0\u3092\u751f\u6210]\u30dc\u30bf\u30f3\u62bc\u4e0b\u3067\u3042\u308c\u3070 TTS\u3092\u5b9f\u884c\u3059\u308b\u3002\r\n    try:\r\n        html_sound = execute_TTS(form, cvoices)\r\n    except Exception as e:\r\n        print(f&quot;&lt;p style=&#039;color:red;&#039;&gt;\u30a8\u30e9\u30fc\u767a\u751f: {e}&lt;\/p&gt;&quot;)  # \u2605\u5f8c\u3067logging\u306b\u5909\u66f4\u3059\u308b\u3002\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nhtml_speech_form = makeHtml_conversationForm(cvoices, form)  # \u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306e HTML\u6587\u3092\u4f5c\u6210\r\nfname_prefix = form.getvalue(&#039;fname_prefix&#039;)\r\n# HTML\u306e\u51fa\u529b\r\nprint(f&quot;&quot;&quot;\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;ja&quot;&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=&quot;UTF-8&quot;&gt;\r\n    &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; \/&gt;\r\n    &lt;title&gt;Google Cloud TTS Sample&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1&gt;Text to Speech&lt;\/h1&gt;\r\n    &lt;form method=&quot;POST&quot;&gt;\r\n        &lt;div class=&quot;setting&quot;&gt;\r\n            {html_speech_form}\r\n            &lt;input id=&quot;fname_prefix&quot; type=&quot;text&quot; name=&quot;fname_prefix&quot; value=&quot;{fname_prefix}&quot; placeholder=&quot;\u30d5\u30a1\u30a4\u30eb\u540d\u306eprefix&quot;&gt;\r\n            &lt;button type=&quot;submit&quot; name=&quot;action&quot; value=&quot;exectts&quot;&gt;\u97f3\u58f0\u3092\u751f\u6210&lt;\/button&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/form&gt;\r\n    {html_sound}\r\n&lt;\/body&gt;&lt;\/html&gt;\r\n&quot;&quot;&quot;)\r\n<\/pre>\n<h3 class=\"my_h\">2\/6 : style.scss<\/h3>\n<p>\u6700\u4f4e\u9650\u306e\u88c5\u98fe\u3092\u65bd\u3057\u305f\u3002SASS\u3067\u66f8\u3044\u305f\u65b9\u304c\u7de8\u96c6\u3057\u3084\u3059\u3044\u3002<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n@charset &quot;UTF-8&quot;;\r\n\r\n*{\r\n    margin:0;\r\n    padding:0;\r\n    box-sizing: border-box;\r\n}\r\n\r\nbutton, select{\r\n    cursor: pointer;\r\n}\r\n\r\ntable{\r\n    border-collapse: collapse;\r\n    border-spacing: 0;\r\n    tr, th, td{\r\n        border: 1px #000 solid;\r\n    }\r\n    th, td{\r\n        padding: 0.5rem;\r\n    }\r\n    th{\r\n        background-color: #fffff0;\r\n    }\r\n    td{\r\n        background-color: #f0f0f0;\r\n    }\r\n}\r\n\r\ndiv.setting{\r\n    display: inline-block;\r\n    text-align: center;\r\n}\r\n\r\ninput&#x5B;type=&quot;number&quot;]{\r\n    text-align: center;\r\n    font-size: 1.3rem;\r\n}\r\n\r\nbutton&#x5B;type=&quot;submit&quot;]{\r\n    margin: 1rem;\r\n    padding: 0.5rem;\r\n    font-size: 1.5rem;\r\n}\r\n\r\ninput#fname_prefix{\r\n    text-align: center;\r\n    font-size: 1.2rem;\r\n    width: 20rem;\r\n    padding: 0.3rem;\r\n    border: 3px #888 solid;\r\n}\r\n<\/pre>\n<h3 class=\"my_h\">3\/6 : my_ggtts.py<\/h3>\n<p>Google Cloud TTS\uff08Text-to-Speech\uff09\u3068\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3001\u4eca\u56de\u306e\u30b3\u30a2\u30e2\u30b8\u30e5\u30fc\u30eb\u3060\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport os\r\nimport tempfile\r\nfrom google.cloud import texttospeech\r\nfrom CMP3Joiner import CMP3Joiner\r\n\r\nOUTPUT_DIR = &quot;\/opt\/webtts\/www\/sound&quot;\r\n\r\n# Text-to-Speech API \u9375\u30d5\u30a1\u30a4\u30eb\u306e\u7d76\u5bfe\u30d1\u30b9\r\nKEY_PATH = &quot;\/opt\/webtts\/auth\/key.json&quot;\r\nos.environ.setdefault(&quot;GOOGLE_APPLICATION_CREDENTIALS&quot;, KEY_PATH)\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\ndef _execute_ggtts(client, etext, language_code, voice_name, speaking_rate, output_path):\r\n    #-------------------------------------------------------------------\r\n    synthesis_input = texttospeech.SynthesisInput(text=etext)\r\n    if not language_code or not voice_name:\r\n        language_code = &#039;en-US&#039;\r\n        voice_name    = &#039;en-US-Chirp3-HD-Rasalgethi&#039;\r\n    #-------------------------------------------------------------------\r\n    # \u97f3\u58f0\u8a2d\u5b9a\r\n    voice        = texttospeech.VoiceSelectionParams(language_code=language_code, name=voice_name)\r\n    audio_config = texttospeech.AudioConfig(audio_encoding=texttospeech.AudioEncoding.MP3, speaking_rate=speaking_rate )\r\n    #-------------------------------------------------------------------\r\n    # TTS\u5b9f\u884c\r\n    try:\r\n        response = client.synthesize_speech(input=synthesis_input, voice=voice, audio_config=audio_config )\r\n    except Exception as e:\r\n        raise RuntimeError(f&quot;synthesize_speech failed: {e}&quot;) from e\r\n    #-------------------------------------------------------------------\r\n    # MP3\u30d5\u30a1\u30a4\u30eb\u51fa\u529b\r\n    try:\r\n        output_dir = os.path.dirname(output_path)\r\n        if output_dir:\r\n            os.makedirs(output_dir, exist_ok=True)\r\n        with open(output_path, &quot;wb&quot;) as out:\r\n            out.write(response.audio_content)\r\n    except Exception as e:\r\n        raise RuntimeError(f&quot;Failed to write MP3 file &#039;{output_path}&#039;: {e}&quot;) from e\r\n    #-------------------------------------------------------------------\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\ndef generate_voice(etext, output_path, speaking_rate=1.0, language_code=&#039;&#039;, voice_name=&#039;&#039;):\r\n    #-------------------------------------------------------------------\r\n    # TTS client instance\u751f\u6210\r\n    try:\r\n        client = texttospeech.TextToSpeechClient()\r\n    except Exception as e:\r\n        raise RuntimeError(f&quot;Failed to create TextToSpeechClient: {e}&quot;) from e\r\n    #-------------------------------------------------------------------\r\n    # TTS\u5b9f\u884c\r\n    try:\r\n        _execute_ggtts(client, etext, language_code, voice_name, speaking_rate, output_path)\r\n    except Exception as e:\r\n        raise RuntimeError(f&quot;TTS failed (voice={voice_name}, lang={language_code}): {e}&quot;) from e\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\ndef generate_voice_from_list(tts_requests, filepath):\r\n    #-------------------------------------------------------------------\r\n    # TTS client instance\u751f\u6210\r\n    try:\r\n        client = texttospeech.TextToSpeechClient()\r\n    except Exception as e:\r\n        raise RuntimeError(f&quot;Failed to create TextToSpeechClient: {e}&quot;) from e\r\n    #-------------------------------------------------------------------\r\n    # \u5168\u3066\u306e\u5909\u63db\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9806\u306b\u51e6\u7406\u3059\u308b\u3002\r\n    output_files = &#x5B;]\r\n    for idx, (etext, srate, vitem) in enumerate(tts_requests, start=1):\r\n        lcode = vitem.lcode\r\n        vname = vitem.vname\r\n        if not lcode or not vname:\r\n            raise RuntimeError(f&quot;Invalid voice data at request #{idx}&quot;)\r\n        #---------------------------------------------------------------\r\n        try:\r\n            # \u9023\u7d50\u524d\u306e\u4e00\u6642\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u4f5c\u308b\u3002\r\n            with tempfile.NamedTemporaryFile(delete=False, suffix=&quot;.mp3&quot;, dir=OUTPUT_DIR) as tmp:\r\n                output_path = tmp.name\r\n        except Exception as e:\r\n            raise RuntimeError(f&quot;Failed to create temp file at request #{idx}: {e}&quot;) from e\r\n        #---------------------------------------------------------------\r\n        # TTS\u5b9f\u884c\r\n        try:\r\n            _execute_ggtts( client, etext, lcode, vname, srate, output_path )\r\n        except Exception as e:\r\n            raise RuntimeError(f&quot;TTS failed at request #{idx} (voice={vname}, lang={lcode}): {e}&quot;) from e\r\n        output_files.append(output_path)\r\n    #-------------------------------------------------------------------\r\n    # \u4e00\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u307e\u3068\u3081\u308b\u3002\r\n    if not output_files:\r\n        raise RuntimeError(&quot;No audio files were generated.&quot;)\r\n    try:\r\n        output_dir = os.path.dirname(filepath)\r\n        if output_dir:\r\n            os.makedirs(output_dir, exist_ok=True)\r\n        CMP3Joiner.join_mp3_files(output_files, filepath)\r\n    except Exception as e:\r\n        raise RuntimeError(f&quot;Failed to join MP3 files: {e}&quot;) from e\r\n    #-------------------------------------------------------------------\r\n<\/pre>\n<h3 class=\"my_h\">4\/6 : CVoice.py<\/h3>\n<p>Google Cloud\u304c\u63d0\u4f9b\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u97f3\u58f0\uff08Voice, Speaker\uff09\u3092\u307e\u3068\u3081\u3066\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e\u30af\u30e9\u30b9\u3060\u3002<br \/>\n\u30c7\u30fc\u30bf\u306f\u5916\u90e8\u306e JSON\u30d5\u30a1\u30a4\u30eb\uff08\u5f8c\u8ff0\u306e voice.json\uff09\u306b\u4fdd\u5b58\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport json\r\nimport os\r\nimport html\r\nfrom dataclasses import dataclass\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n@dataclass(frozen=True)\r\nclass CVoice:\r\n    lcode: str\r\n    vname: str\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nclass CVoices:\r\n    #\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    def __init__(self, fpath=None):\r\n        #---------------------------------------------------------------\r\n        self.voices: dict&#x5B;str, dict&#x5B;str, str | None]] = {}\r\n        #---------------------------------------------------------------\r\n        try:\r\n            #-----------------------------------------------------------\r\n            if not fpath:\r\n                base_dir = os.path.dirname(os.path.abspath(__file__))\r\n                fpath    = os.path.join(base_dir, &#039;voice.json&#039;)\r\n            #-----------------------------------------------------------\r\n            with open(fpath, &#039;r&#039;, encoding=&#039;utf-8&#039;) as f:\r\n                loaddata = json.load(f)\r\n            if not isinstance(loaddata, list):\r\n                raise RuntimeError(f&quot;Invalid JSON format in {fpath}: root must be a list.&quot;)\r\n            #-----------------------------------------------------------\r\n            for voice in loaddata:\r\n                if &#039;vname&#039; not in voice or &#039;lcode&#039; not in voice:\r\n                    continue                    # \u58ca\u308c\u305f\u30c7\u30fc\u30bf\u3092\u7121\u8996 \u2605\u5f8c\u3067logging\u306b\u5909\u66f4 \u2192 \u30c7\u30fc\u30bf\u4fee\u6b63\r\n                self.voices&#x5B;voice&#x5B;&#039;vname&#039;]] = {\r\n                    &#039;age&#039;:   voice.get(&#039;age&#039;),\r\n                    &#039;sex&#039;:   voice.get(&#039;sex&#039;),\r\n                    &#039;lcode&#039;: voice.get(&#039;lcode&#039;)\r\n                }\r\n        #---------------------------------------------------------------\r\n        except (OSError, json.JSONDecodeError) as e:\r\n            raise RuntimeError(f&quot;Could not load {fpath}: {e}&quot;)\r\n\r\n    # public \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    def get_item(self, vname: str) -&gt; CVoice | None:\r\n        #---------------------------------------------------------------\r\n        item = self.voices.get(vname)\r\n        #---------------------------------------------------------------\r\n        if not item or not item.get(&#039;lcode&#039;):\r\n            return None\r\n        return CVoice(lcode=item&#x5B;&#039;lcode&#039;], vname=vname)\r\n\r\n    # public \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    def getHtml_select(self, conditions: dict&#x5B;str, str] | None = None, active_vname: str=&#039;&#039;, elm_name: str=&#039;vname&#039;) -&gt; str:\r\n        #---------------------------------------------------------------\r\n        if conditions is None:\r\n            conditions = {}\r\n        filtered = self._get_filtered(conditions)\r\n        #---------------------------------------------------------------\r\n        options = &#x5B;]\r\n        for i, (vname, info) in enumerate(filtered.items(), start=1):\r\n            age = &#039;&#039; if info.get(&#039;age&#039;) is None else str(info.get(&#039;age&#039;))\r\n            sex = &#039;&#039; if info.get(&#039;sex&#039;) is None else str(info.get(&#039;sex&#039;))\r\n            #-----------------------------------------------------------\r\n            escaped_name_attr = html.escape(str(vname), quote=True)\r\n            escaped_name_text = html.escape(str(vname), quote=False)\r\n            escaped_age       = html.escape(age,        quote=False)\r\n            escaped_sex       = html.escape(sex,        quote=False)\r\n            #-----------------------------------------------------------\r\n            selected = &#039; selected&#039; if vname == active_vname else &#039;&#039;\r\n            label = f&#039;{escaped_age}{escaped_sex} : {escaped_name_text}&#039;\r\n            options.append(f&#039;&lt;option value=&quot;{escaped_name_attr}&quot;{selected}&gt;({i}) {label}&lt;\/option&gt;&#039;)\r\n        #---------------------------------------------------------------\r\n        if not options:\r\n            options.append(&#039;&lt;option value=&quot;&quot;&gt;No voices available&lt;\/option&gt;&#039;)\r\n        #---------------------------------------------------------------\r\n        html_options = &#039;&#039;.join(options)\r\n        escaped_elm_name = html.escape(str(elm_name), quote=True)\r\n        return f&#039;&lt;select name=&quot;{escaped_elm_name}&quot;&gt;{html_options}&lt;\/select&gt;&#039;\r\n\r\n    # private \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    def _get_by_age(self, age):\r\n        result = {}\r\n        for name, info in self.voices.items():\r\n            if info.get(&#039;age&#039;) == age:\r\n                result&#x5B;name] = info\r\n        return result\r\n\r\n    # private \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    # \u6307\u5b9a\u6761\u4ef6\u306b\u30de\u30c3\u30c1\u3059\u308b Voice\u3092\u53d6\u5f97\u3059\u308b\u3002\r\n    def _get_filtered(self, conditions: dict&#x5B;str, str] | None = None):\r\n        if conditions is None:\r\n            conditions = {}\r\n        return {\r\n            name: info\r\n            for name, info in self.voices.items()\r\n            if all(info.get(k) == v for k, v in conditions.items())\r\n        }\r\n<\/pre>\n<h3 class=\"my_h\">5\/6 : voice.json<\/h3>\n<p>Google Cloud\u304c\u63d0\u4f9b\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u97f3\u58f0\uff08Voice, Speaker\uff09\u306e\u4e2d\u3067\u3001\u4f7f\u3044\u305f\u3044\u3082\u306e\u3060\u3051\u3092\u66f8\u3044\u305f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;\r\n  {\r\n    &quot;age&quot;:   &quot;10&quot;,\r\n    &quot;sex&quot;:   &quot;F&quot;,\r\n    &quot;lcode&quot;: &quot;en-US&quot;,\r\n    &quot;vname&quot;: &quot;en-US-Chirp3-HD-Achernar&quot;\r\n  },\r\n  {\r\n    &quot;age&quot;:   &quot;10&quot;,\r\n    &quot;sex&quot;:   &quot;F&quot;,\r\n    &quot;lcode&quot;: &quot;en-US&quot;,\r\n    &quot;vname&quot;: &quot;en-US-Chirp3-HD-Zephyr&quot;\r\n  },\r\n  :\r\n  : \u7701\u7565\r\n  :\r\n  {\r\n    &quot;age&quot;:   &quot;60&quot;,\r\n    &quot;sex&quot;:   &quot;M&quot;,\r\n    &quot;lcode&quot;: &quot;en-US&quot;,\r\n    &quot;vname&quot;: &quot;en-US-Chirp3-HD-Sadachbia&quot;\r\n  },\r\n  {\r\n    &quot;age&quot;:   &quot;60&quot;,\r\n    &quot;sex&quot;:   &quot;M&quot;,\r\n    &quot;lcode&quot;: &quot;en-US&quot;,\r\n    &quot;vname&quot;: &quot;en-US-Chirp3-HD-Zubenelgenubi&quot;\r\n  }\r\n]\r\n<\/pre>\n<h3 class=\"my_h\">6\/6 : CMP3Joiner.py<\/h3>\n<p>\u8907\u6570\u306e MP3\u30d5\u30a1\u30a4\u30eb\u3092\u7d50\u5408\u3057\u3066\u4e00\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u3059\u308b\u305f\u3081\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3060\u3002<br \/>\n\u8907\u6570\u306e\u4f1a\u8a71\u6587\u3092\u4e00\u3064\u306e MP3\u30d5\u30a1\u30a4\u30eb\u306b\u3057\u305f\u3044\u306e\u3067\u4f5c\u3063\u305f\u3002<br \/>\n\u7d50\u5408\u51e6\u7406\u306f\u81ea\u4f5c\u305b\u305a ffmpeg \u3092\u5229\u7528\u3057\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport os\r\nimport tempfile\r\nimport subprocess\r\n\r\n#\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\nclass CMP3Joiner:\r\n    #\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    @staticmethod\r\n    def _escape_ffmpeg_path(path):\r\n        #---------------------------------------------------------------\r\n        # ffmpeg concat \u7528\u306b\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c8\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\r\n        return path.replace(&quot;&#039;&quot;, r&quot;&#039;\\&#039;&#039;&quot;)\r\n    \r\n    #\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\r\n    @classmethod\r\n    def join_mp3_files(cls, input_files, output_file, cleanup: bool=True):\r\n        #---------------------------------------------------------------\r\n        if not input_files:\r\n            raise ValueError(&quot;input_files is empty.&quot;)\r\n        #---------------------------------------------------------------\r\n        for path in input_files:                # \u5165\u529b\u30d5\u30a1\u30a4\u30eb\u306e\u5b58\u5728\u78ba\u8a8d\r\n            if not os.path.isfile(path):\r\n                raise FileNotFoundError(f&quot;Input file not found: {path}&quot;)\r\n        #---------------------------------------------------------------\r\n        tmp_list_file = None\r\n        success = False\r\n        try:\r\n            #-----------------------------------------------------------\r\n            # \u4e00\u6642\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\r\n            with tempfile.NamedTemporaryFile(\r\n                mode=&quot;w&quot;,\r\n                suffix=&quot;.txt&quot;,\r\n                delete=False,\r\n                encoding=&quot;utf-8&quot;\r\n            ) as f:\r\n                tmp_list_file = f.name\r\n                \r\n                for mp3_file in input_files:\r\n                    abs_path = os.path.abspath(mp3_file)\r\n                    esc_path = cls._escape_ffmpeg_path(abs_path)\r\n                    f.write(f&quot;file &#039;{esc_path}&#039;\\n&quot;)\r\n            #-----------------------------------------------------------\r\n            # ffmpeg\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u3057\u3001\u8907\u6570\u306e MP3\u30d5\u30a1\u30a4\u30eb\u3092\u7d50\u5408\u3059\u308b\u3002\r\n            cmd = &#x5B;\r\n                &quot;ffmpeg&quot;, &quot;-y&quot;, &quot;-f&quot;, &quot;concat&quot;, &quot;-safe&quot;, &quot;0&quot;, &quot;-i&quot;, tmp_list_file,\r\n                &quot;-c&quot;, &quot;copy&quot;, output_file\r\n            ]\r\n            output_dir = os.path.dirname(output_file)\r\n            if output_dir:\r\n                os.makedirs(output_dir, exist_ok=True)\r\n            result = subprocess.run(\r\n                cmd, stdout=subprocess.PIPE,\r\n                     stderr=subprocess.PIPE, text=True\r\n            )\r\n            #-----------------------------------------------------------\r\n            if result.returncode != 0:\r\n                raise RuntimeError(\r\n                    f&quot;ffmpeg failed while creating &#039;{output_file}&#039;.\\n&quot;\r\n                    f&quot;stdout:\\n{result.stdout}\\n&quot;\r\n                    f&quot;stderr:\\n{result.stderr}&quot;\r\n                )\r\n            success = True\r\n        #---------------------------------------------------------------\r\n        finally:\r\n            #-----------------------------------------------------------\r\n            # \u4e00\u6642\u30d5\u30a1\u30a4\u30eb\u524a\u9664\r\n            if tmp_list_file and os.path.exists(tmp_list_file):\r\n                os.remove(tmp_list_file)\r\n            #-----------------------------------------------------------\r\n            # \u5165\u529b MP3\u30d5\u30a1\u30a4\u30eb\u3092\u5168\u524a\u9664\r\n            if cleanup and success:\r\n                for f in input_files:\r\n                    try:\r\n                        if os.path.exists(f):\r\n                            os.remove(f)\r\n                    except Exception as e:\r\n                        print(f&quot;Failed to delete {f}: {e}&quot;)     # \u2605\u5f8c\u3067logging\u306b\u5909\u66f4\u3059\u308b\u3002\r\n<\/pre>\n<h1 class=\"my_h\">\u30104\u3011\u6240\u611f<\/h1>\n<p>\u4e00\u5148\u305a\u3001<a href=\"https:\/\/www.dogrow.net\/python\/blog134-google-cloud-tts%e3%82%92%e4%bd%bf%e3%81%84%e5%a7%8b%e3%82%81%e3%82%8b%e3%80%82\/\" target=\"_blank\">\u521d\u56de<\/a> \u306b\u3084\u308a\u305f\u3044\u3068\u8003\u3048\u3066\u3044\u305f\u3053\u3068\u304c\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<p>\u3053\u306e Web\u30a2\u30d7\u30ea\u3092\u4f7f\u3044\u3001<br \/>\n<span class='my_fc_blueBBig'>\u82f1\u8a9e\u5b66\u7fd2\u3092\u304c\u3093\u3070\u3063\u3066\u3044\u308b\u6211\u304c\u5b50\u306e\u305f\u3081\u306e\u82f1\u4f1a\u8a71\u6559\u6750\u3092\u4f5c\u3063\u3066\u3042\u3052\u305f\u3044\u3002<\/span><\/p>\n<p>\u6c17\u3092\u4ed8\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u306f AI\u3067\u97f3\u58f0\u3092\u4f5c\u3063\u3066\u3044\u308b\u305f\u3081\u3001<br \/>\n<span class='my_fc_crimsonBBig'>\u540c\u3058 Voice\u3092\u4f7f\u3063\u3066\u3044\u3066\u3082\u3001<br \/>\n\u4f5c\u6210\u306e\u5ea6\u306b\u6291\u63da\u3084\u533a\u5207\u308a\u306e\u9593\u306a\u3069\u306e\u300c\u8a71\u3057\u3063\u3077\u308a\u300d\u304c\u5909\u5316\u3059\u308b\u3002<\/span><\/p>\n<p>\u300c\u3053\u306e Voice\u306f\u30c0\u30e1\u3060\u306a\u300d\u3068\u6368\u3066\u305a\u306b\u3001<br \/>\n<span class='my_fc_blueBBig'>\u540c\u3058 Voice \uff06 \u540c\u3058\u82f1\u6587\u30c6\u30ad\u30b9\u30c8\u3067\u4f55\u5ea6\u304b\u30c8\u30e9\u30a4\u3057\u3066\u307f\u308b\u5fc5\u8981\u304c\u3042\u308b<\/span><br \/>\n\u3068\u611f\u3058\u305f\u3002<\/p>\n<h1 class=\"my_h\">\u30105\u3011\u6b21\u306b\u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>\u30fb<a href=\"https:\/\/docs.cloud.google.com\/text-to-speech\/docs\/ssml?hl=ja\" target=\"_blank\">\u97f3\u58f0\u5408\u6210\u30de\u30fc\u30af\u30a2\u30c3\u30d7\u8a00\u8a9e\uff08SSML\uff09<\/a> \u3092\u4f7f\u3063\u3066\u307f\u305f\u3044\u3002<br \/>\n\u3000\u3053\u306e\u30e1\u30bf\u8a00\u8a9e\u3092\u4f7f\u3046\u3068\u3001&#8221;.&#8221;\uff08\u30d4\u30ea\u30aa\u30c9\uff09\u306e\u5f8c\u306e\u7a7a\u767d\u6642\u9593\u3092\u6307\u5b9a\u3059\u308b\u306a\u3069\u3001\u97f3\u58f0\u751f\u6210\u3092\u5236\u5fa1\u3067\u304d\u308b\u306e\u3060\u305d\u3046\u306a\u3002<\/p>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>\u30100\u3011\u9023\u8f09\u5185\u5bb9 (134)\u3010Google Cloud TTS #1\u3011\u5b50\u3069\u3082\u306e\u82f1\u4f1a\u8a71\u5b66\u7fd2\u6559\u6750\u3092\u4f5c\u308a\u305f\u3044\uff01 (135)\u3010Google Cloud TTS #2\u3011Google Cloud\u5074\u306e\u6e96\u5099\u4f5c\u696d (136)\u3010Google \u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/python\/blog141%e3%80%90google-cloud-tts-8%e3%80%91%e4%ba%8c%e4%ba%ba%e4%bb%a5%e4%b8%8a%e3%81%ae%e4%bc%9a%e8%a9%b1%e3%82%92%e5%85%a5%e5%8a%9b%e5%8f%af%e8%83%bd%e3%81%ab\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69],"tags":[],"class_list":["post-4140","post","type-post","status-publish","format-standard","hentry","category-google-cloud-tts"],"views":160,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/4140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/comments?post=4140"}],"version-history":[{"count":25,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/4140\/revisions"}],"predecessor-version":[{"id":4193,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/posts\/4140\/revisions\/4193"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/media?parent=4140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/categories?post=4140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/python\/wp-json\/wp\/v2\/tags?post=4140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}