{"id":10020426,"date":"2024-11-28T18:47:51","date_gmt":"2024-11-28T10:47:51","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020426"},"modified":"2024-11-28T18:47:51","modified_gmt":"2024-11-28T10:47:51","slug":"ai-%e5%a3%b0%e9%9f%b3%ef%bc%9a%e6%95%b0%e5%ad%97%e9%9f%b3%e9%a2%91%e3%80%81%e8%af%ad%e9%9f%b3%e8%af%86%e5%88%ab%e3%80%81tts-%e7%ae%80%e4%bb%8b%e4%b8%8e%e4%bd%bf%e7%94%a8%e7%a4%ba%e4%be%8b","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020426","title":{"rendered":"AI \u58f0\u97f3\uff1a\u6570\u5b57\u97f3\u9891\u3001\u8bed\u97f3\u8bc6\u522b\u3001TTS \u7b80\u4ecb\u4e0e\u4f7f\u7528\u793a\u4f8b"},"content":{"rendered":"<p>\u5728\u73b0\u4ee3 AI \u6280\u672f\u7684\u63a8\u52a8\u4e0b\uff0c\u58f0\u97f3\u5904\u7406\u9886\u57df\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u4ece\u8bed\u97f3\u8bc6\u522b\uff08<code>ASR<\/code>\uff09\u5230\u6587\u672c\u8f6c\u8bed\u97f3\uff08<code>TTS<\/code>\uff09\uff0c\u518d\u5230\u4e2a\u6027\u5316\u58f0\u97f3\u514b\u9686\uff0c\u8fd9\u4e9b\u6280\u672f\u5df2\u7ecf\u6df1\u5165\u5230\u6211\u4eec\u7684\u65e5\u5e38\u751f\u6d3b\u4e2d\uff1a\u8bed\u97f3\u52a9\u624b\u3001\u81ea\u52a8\u5b57\u5e55\u751f\u6210\u3001\u8bed\u97f3\u5bfc\u822a\u7b49\u5e94\u7528\u65e0\u5904\u4e0d\u5728\u3002<\/p>\n<h2>\u6570\u5b57\u97f3\u9891<\/h2>\n<p>\u97f3\u9891\u662f\u58f0\u97f3\u7684\u201c\u6570\u5b57\u5316\u201d\u3002\u58f0\u97f3\u672c\u8d28\u4e0a\u662f\u7a7a\u6c14\u4e2d\u632f\u52a8\u7684\u6ce2\uff0c\u8fd9\u4e9b\u6ce2\u7684\u632f\u52a8\u88ab\u9ea6\u514b\u98ce\u6355\u6349\u540e\u8f6c\u5316\u4e3a\u7535\u4fe1\u53f7\u3002\u63a5\u7740\uff0c\u8fd9\u4e9b\u4fe1\u53f7\u4f1a\u901a\u8fc7\u91c7\u6837\u548c\u91cf\u5316\u5b58\u50a8\u4e3a\u6570\u5b57\u6570\u636e\u3002<\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000045514217\" alt=\"\" title=\"\"><\/p>\n<p>\u5982\u4e0a\u56fe\u6240\u793a\u3002\u58f0\u6ce2\u6700\u5f00\u59cb\u662f\u4e00\u4e2a\u8fde\u7eed\u7684\u6a21\u62df\u4fe1\u53f7\uff0c\u7136\u540e\u7ecf\u8fc7\u7279\u5b9a\u9891\u7387\u7684\u91c7\u6837\u5f97\u5230\u91c7\u6837\u70b9\uff08\u6bd4\u5982\u91c7\u6837\u9891\u7387 48kHz \u5c31\u662f\u5c06\u6bcf\u79d2\u5207\u5272\u4e3a 48k \u4e2a\u91c7\u6837\u70b9\uff09\uff0c\u518d\u901a\u8fc7\u91cf\u5316\u5904\u7406\u5f97\u5230\u4e8c\u8fdb\u5236\u6570\u636e\uff08\u5982\u679c\u91cf\u5316\u4f4d\u6570\u662f 16 \u4f4d\uff0c\u5219\u8868\u793a\u6bcf\u4e2a\u91c7\u6837\u70b9\u5b58\u50a8\u4e3a 16 bit \u5373 2 \u4e2a\u5b57\u8282\uff09\uff0c\u6700\u540e\u5c06\u5143\u6570\u636e\uff08\u5982\u91c7\u6837\u7387\u3001\u91cf\u5316\u4f4d\u6570\u3001\u58f0\u9053\u6570\u91cf\u7b49\uff09\u548c\u91c7\u6837\u70b9\u4e8c\u8fdb\u5236\u6570\u636e\u7ec4\u5408\u8d77\u6765\u5c31\u5f97\u5230\u4e86\u97f3\u9891\u6587\u4ef6\uff08\u6bd4\u5982 WAV \u6216 MP3\uff09\u3002<\/p>\n<h2>ASR \u8bed\u97f3\u8bc6\u522b<\/h2>\n<p>\u8bed\u97f3\u8bc6\u522b\uff08<code>Automatic Speech Recognition<\/code>\uff0c<code>ASR<\/code>\uff09\u662f\u5c06\u8bed\u8a00\u8f6c\u5316\u4e3a\u6587\u5b57\u7684\u6280\u672f\u3002<\/p>\n<h4>\u4f20\u7edf\u65b9\u6cd5<\/h4>\n<p>\u65e9\u671f\u7684 <code>ASR<\/code> \u7cfb\u7edf\u4e3b\u8981\u4f9d\u8d56\u57fa\u4e8e\u7edf\u8ba1\u7684\u6a21\u578b\uff0c\u5982\uff1a<\/p>\n<ul>\n<li>\u58f0\u5b66\u6a21\u578b\uff08Acoustic Model\uff09\uff1a\u5c06\u97f3\u9891\u4fe1\u53f7\u8f6c\u6362\u4e3a\u58f0\u5b66\u7279\u5f81\uff0c\u5982 MFCC\uff08\u6885\u5c14\u9891\u7387\u5012\u8c31\u7cfb\u6570\uff09\u3002<\/li>\n<li>\u8bed\u8a00\u6a21\u578b\uff08Language Model\uff09\uff1a\u4f7f\u7528\u7edf\u8ba1\u65b9\u6cd5\u9884\u6d4b\u6587\u5b57\u5e8f\u5217\u7684\u6982\u7387\u3002<\/li>\n<li>\u89e3\u7801\u5668\uff08Decoder\uff09\uff1a\u7ed3\u5408\u58f0\u5b66\u548c\u8bed\u8a00\u6a21\u578b\uff0c\u5c06\u58f0\u5b66\u7279\u5f81\u6620\u5c04\u5230\u6700\u53ef\u80fd\u7684\u6587\u5b57\u5e8f\u5217\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u65b9\u6cd5\u9700\u8981\u5927\u91cf\u624b\u5de5\u8bbe\u8ba1\u7684\u7279\u5f81\u548c\u89c4\u5219\uff0c\u6027\u80fd\u53d7\u9650\u4e8e\u6570\u636e\u91cf\u548c\u8bed\u8a00\u6a21\u578b\u7684\u590d\u6742\u5ea6\u3002<\/p>\n<h4>\u6df1\u5ea6\u5b66\u4e60<\/h4>\n<p>\u73b0\u4ee3 <code>ASR<\/code> \u7cfb\u7edf\u4e3b\u8981\u57fa\u4e8e\u6df1\u5ea6\u5b66\u4e60\uff0c\u4f7f\u7528\u7aef\u5230\u7aef\uff08End-to-End\uff09\u65b9\u6cd5\uff0c\u76f4\u63a5\u4ece\u97f3\u9891\u8f93\u5165\u5230\u6587\u672c\u8f93\u51fa\u3002<\/p>\n<p>\u5982\u679c\u5c06 AI \u6a21\u578b\u770b\u4f5c\u4e00\u4e2a\u9ed1\u76d2\uff0c\u90a3\u4e48\u8bad\u7ec3\u8fc7\u7a0b\u5c31\u662f\u8f93\u5165 &lt;\u97f3\u9891, \u6587\u672c&gt; \u6570\u636e\u5bf9\uff0c\u8ba9\u6a21\u578b\u81ea\u52a8\u5b66\u4e60\u8f93\u5165\u548c\u8f93\u51fa\u4e4b\u95f4\u7684\u6620\u5c04\u5173\u7cfb\u3002\u7ecf\u8fc7\u8bad\u7ec3\u540e\uff0c\u6a21\u578b\u4fbf\u53ef\u4ee5\u5bf9\u65b0\u7684\u97f3\u9891\u8fdb\u884c\u63a8\u7406\uff0c\u751f\u6210\u5bf9\u5e94\u6587\u672c\u3002<\/p>\n<p>\u8fd9\u79cd\u63cf\u8ff0\u662f\u4e00\u4e2a\u9ad8\u5ea6\u62bd\u8c61\u7684\u89c6\u89d2\uff0c\u80cc\u540e\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u590d\u6742\u7684\u8fc7\u7a0b\uff0c\u6bd4\u5982 <code>OpenAI Whisper<\/code>\uff1a <\/p>\n<p><img decoding=\"async\"   referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000045514218\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u5b9e\u8df5\u8bc1\u660e\uff0c\u57fa\u4e8e\u6df1\u5ea6\u5b66\u4e60\u65b9\u6cd5\u8bad\u7ec3\u51fa\u6765\u7684\u6a21\u578b\u5177\u6709\u66f4\u597d\u7684\u9c81\u68d2\u6027\u3001\u51c6\u786e\u6027\u548c\u6cdb\u5316\u80fd\u529b\u3002<\/p>\n<p><code>OpenAI Whisper<\/code> \u4f7f\u7528\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"python\">import whisper\n\n# \u52a0\u8f7d\u6a21\u578b\uff0c\u9ed8\u8ba4\u5b58\u50a8\u4f4d\u7f6e ~\/.cache\/whisper\uff0c\u53ef\u4ee5\u8bbe\u7f6e download_root \u6539\u53d8\u8def\u5f84\nmodel = whisper.load_model(&quot;base&quot;, download_root=&quot;root_dir&quot;)\n\n# \u5c06\u97f3\u9891\u8f6c\u6362\u4e3a\u6587\u672c\nresult = model.transcribe(&quot;audio.mp3&quot;)\nprint(result[&quot;text&quot;])<\/code><\/pre>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 <code>whisper.cpp<\/code>\uff0c\u4e00\u4e2a\u4f7f\u7528 C\/C++ \u7f16\u5199\u7684 <code>OpenAI Whisper<\/code> \u7684\u9ad8\u6027\u80fd\u7248\u672c\u3002<\/p>\n<h2>TTS \u6587\u672c\u8f6c\u8bed\u8a00<\/h2>\n<p>\u6587\u672c\u8f6c\u8bed\u97f3\uff08<code>Text-to-Speech<\/code>\uff0c<code>TTS<\/code>\uff09\u6280\u672f\u5219\u662f\u5c06\u8f93\u5165\u6587\u672c\u8f6c\u5316\u4e3a\u81ea\u7136\u6d41\u7545\u7684\u8bed\u97f3\u3002<\/p>\n<p>\u4ece\u67d0\u79cd\u62bd\u8c61\u7684\u89d2\u5ea6\u6765\u770b\uff0c<code>TTS<\/code>\uff08\u6587\u672c\u8f6c\u8bed\u97f3\uff09\u53ef\u4ee5\u88ab\u89c6\u4e3a\u8bed\u97f3\u8bc6\u522b\uff08<code>ASR<\/code>\uff09\u7684\u201c\u53cd\u8fc7\u7a0b\u201d\uff0c\u4e24\u8005\u90fd\u6d89\u53ca\u5c06\u4e00\u79cd\u5f62\u5f0f\u7684\u6570\u636e\uff08\u97f3\u9891\u6216\u6587\u672c\uff09\u6620\u5c04\u5230\u53e6\u4e00\u79cd\u5f62\u5f0f\uff0c\u5e76\u4e14\u73b0\u4ee3\u90fd\u91c7\u7528\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\uff0c\u901a\u5e38\u57fa\u4e8e <code>Transformer<\/code> \u6216\u7c7b\u4f3c\u67b6\u6784\uff0c\u4f46\u5728\u67d0\u4e9b\u6280\u672f\u5b9e\u73b0\uff08\u6bd4\u5982\u4e2d\u95f4\u8868\u793a\u3001\u635f\u5931\u51fd\u6570\u3001\u7279\u5f81\u8868\u793a\u3001\u76ee\u6807\u4f18\u5316\u7b49\uff09\u548c\u590d\u6742\u5ea6\u4e0a\u5e76\u975e\u5b8c\u5168\u5bf9\u79f0\u3002<\/p>\n<p><code>TTS<\/code> \u793a\u4f8b\u5982\u4e0b\uff08\u4f7f\u7528\u7684\u662f <code>HuggingFace<\/code> \u4e0a\u7684 <code>OuteAI\/OuteTTS-0.2-500M<\/code> \u6a21\u578b\uff09\uff1a<\/p>\n<pre><code class=\"python\">import outetts\n\nmodel_config = outetts.HFModelConfig_v1(\n    model_path=&quot;OuteAI\/OuteTTS-0.2-500M&quot;,\n    language=&quot;en&quot;,  # Supported languages in v0.2: en, zh, ja, ko\n)\n\ninterface = outetts.InterfaceHF(model_version=&quot;0.2&quot;, cfg=model_config)\n\n# Optional: Load speaker from default presets\ninterface.print_default_speakers()\nspeaker = interface.load_default_speaker(name=&quot;male_1&quot;)\n\noutput = interface.generate(\n    text=&quot;&quot;&quot;Speech synthesis is the artificial production of human speech.\n    A computer system used for this purpose is called a speech synthesizer,\n    and it can be implemented in software or hardware products.\n    &quot;&quot;&quot;,\n    # Lower temperature values may result in a more stable tone,\n    # while higher values can introduce varied and expressive speech\n    temperature=0.1,\n    repetition_penalty=1.1,\n    max_length=4096,\n    speaker=speaker,\n)\n\noutput.save(&quot;output.wav&quot;)<\/code><\/pre>\n<h4>\u58f0\u97f3\u514b\u9686<\/h4>\n<p>\u6bcf\u4e2a\u4eba\u7684\u58f0\u97f3\u90fd\u6709\u72ec\u7279\u7684\u7279\u6027\uff0c\u6bd4\u5982\u97f3\u8c03\u9ad8\u4f4e\u3001\u54cd\u5ea6\u3001\u505c\u987f\u3001\u8bed\u6c14\u7b49\u7b49\uff0c\u58f0\u97f3\u514b\u9686\u5c31\u662f\u5206\u6790\u5e76\u63d0\u53d6\u4e00\u4e2a\u4eba\u7684\u58f0\u97f3\u7279\u5f81\uff0c\u5c06\u8fd9\u4e9b\u7279\u5f81\u53c2\u6570\u5316\uff08\u901a\u5e38\u8868\u793a\u4e3a\u9ad8\u7ef4\u5411\u91cf\uff09\u3002\u7279\u5f81\u63d0\u53d6\u672c\u8eab\u6ca1\u6709\u591a\u5927\u5b9e\u9645\u7528\u9014\uff0c\u4e3a\u4e86\u8ba9\u8fd9\u4e9b\u7279\u5f81\u53d1\u6325\u4f5c\u7528\uff0c\u58f0\u97f3\u514b\u9686\u901a\u5e38\u4e0e <code>TTS<\/code>\uff08\u6587\u672c\u8f6c\u8bed\u97f3\uff09\u6280\u672f\u7ed3\u5408\uff0c\u878d\u5408\u514b\u9686\u7684\u58f0\u97f3\u7279\u5f81\uff0c\u5c06\u6587\u672c\u751f\u6210\u4e3a\u4e0e\u514b\u9686\u58f0\u97f3\u76f8\u4f3c\u7684\u8bed\u97f3\u3002<\/p>\n<p>\u4e0d\u5c11 <code>TTS<\/code> \u6a21\u578b\u4e5f\u4f1a\u76f4\u63a5\u652f\u6301\u58f0\u97f3\u514b\u9686\u7684\u529f\u80fd\uff0c\u5982\u4f55\u8c03\u7528\u5219\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u6a21\u578b\u3002\u4f8b\u5982\u4e0a\u4f8b\u4e2d\u7684 <code>OuteAI\/OuteTTS-0.2-500M<\/code> \u6a21\u578b\u53ef\u4ee5\u8f93\u5165\u4e00\u6bb5\u97f3\u9891\u521b\u5efa\u5177\u6709\u8be5\u97f3\u9891\u7279\u5f81\u7684 speaker\uff1a<\/p>\n<pre><code class=\"python\"># Optional: Create a speaker profile (use a 10-15 second audio clip)\nspeaker = interface.create_speaker(\n    audio_path=&quot;path\/to\/audio\/file&quot;,\n    transcript=&quot;Transcription of the audio file.&quot;\n)<\/code><\/pre>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u8bed\u97f3\u6280\u672f\u4f5c\u4e3a <code>AI<\/code> \u5e94\u7528\u4e2d\u7684\u91cd\u8981\u5206\u652f\uff0c\u6b63\u5728\u6539\u53d8\u4eba\u673a\u4ea4\u4e92\u7684\u65b9\u5f0f\u3002\u4ece\u57fa\u7840\u7684\u6570\u5b57\u97f3\u9891\u5904\u7406\u5230 <code>ASR<\/code> \u548c <code>TTS<\/code> \u6280\u672f\u7684\u6210\u719f\uff0c\u518d\u5230\u58f0\u97f3\u514b\u9686\u8d4b\u4e88 <code>AI<\/code> \u4e2a\u6027\u5316\u8868\u8fbe\u80fd\u529b\uff0c\u8fd9\u4e9b\u6280\u672f\u4e0d\u4ec5\u6ee1\u8db3\u4e86\u81ea\u52a8\u5316\u9700\u6c42\uff0c\u8fd8\u4e3a\u865a\u62df\u52a9\u624b\u3001\u5a31\u4e50\u3001\u533b\u7597\u3001\u6559\u80b2\u7b49\u9886\u57df\u5e26\u6765\u4e86\u521b\u65b0\u53ef\u80fd\u6027\u3002\u5e0c\u671b\u672c\u6587\u7684\u4ecb\u7ecd\u80fd\u4e3a\u4f60\u6253\u5f00\u63a2\u7d22 AI \u58f0\u97f3\u9886\u57df\u7684\u5927\u95e8\uff01<\/p>\n<hr>\n<p>(\u6211\u662f\u51cc\u865a\uff0c\u5173\u6ce8\u6211\uff0c\u65e0\u5e7f\u544a\uff0c\u4e13\u6ce8\u6280\u672f\uff0c\u4e0d\u717d\u52a8\u60c5\u7eea\uff0c\u6b22\u8fce\u4e0e\u6211\u4ea4\u6d41)<\/p>\n<hr>\n<p>\u53c2\u8003\u8d44\u6599\uff1a<\/p>\n<ul>\n<li><em><a href=\"https:\/\/link.segmentfault.com\/?enc=BLyT85A7duBU87eVrVGVaw%3D%3D.HhtPeyFJ2iIiWXoeLlQDRs4YBcehsvLeniazlAZSWmCgY7mY9750Bpl7iyXFaZ8H\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/github.com\/openai\/whisper<\/a><\/em><\/li>\n<li><em><a href=\"https:\/\/link.segmentfault.com\/?enc=6fodFtcvBg4mAXLmm%2FD3bw%3D%3D.gATsEhMidAH259XBF5RIzpBFO8a3U2CdCnjO1Z42uwjUfhmR8Qn8oQSQFksIqOJ4\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/huggingface.co\/OuteAI\/OuteTTS-0.2-500M<\/a><\/em><\/li>\n<\/ul>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000045514215\">https:\/\/segmentfault.com\/a\/1190000045514215<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u73b0\u4ee3 AI \u6280\u672f\u7684\u63a8\u52a8\u4e0b\uff0c\u58f0\u97f3\u5904\u7406\u9886\u57df\u53d6\u5f97\u4e86\u5de8\u5927\u8fdb\u5c55\u3002\u4ece\u8bed\u97f3\u8bc6\u522b\uff08ASR\uff09\u5230\u6587\u672c\u8f6c\u8bed\u97f3\uff08TTS\uff09\uff0c\u518d\u5230\u4e2a\u6027\u5316 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020426","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020426"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020426\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}