{"id":76185,"date":"2026-02-21T22:25:44","date_gmt":"2026-02-21T14:25:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/76185.html"},"modified":"2026-02-21T22:25:44","modified_gmt":"2026-02-21T14:25:44","slug":"flutter%e4%b8%89%e6%96%b9%e5%ba%93%e9%80%82%e9%85%8dopenharmony%e3%80%90flutter_speech%e3%80%91-%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/76185.html","title":{"rendered":"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5"},"content":{"rendered":"<h3>\u524d\u8a00<\/h3>\n<p>\u6b22\u8fce\u52a0\u5165\u5f00\u6e90\u9e3f\u8499\u8de8\u5e73\u53f0\u793e\u533a&#xff1a;https:\/\/openharmonycrossplatform.csdn.net<\/p>\n<p>flutter_speech\u7684\u6838\u5fc3\u529f\u80fd\u5df2\u7ecf\u8dd1\u901a\u4e86&#xff0c;\u4f46&#034;\u80fd\u7528&#034;\u548c&#034;\u597d\u7528&#034;\u4e4b\u95f4\u8fd8\u6709\u4e00\u6bb5\u8ddd\u79bb\u3002\u6027\u80fd\u4f18\u5316\u5c31\u662f\u7f29\u77ed\u8fd9\u6bb5\u8ddd\u79bb\u7684\u5173\u952e\u3002<\/p>\n<p>\u8bed\u97f3\u8bc6\u522b\u63d2\u4ef6\u7684\u6027\u80fd\u4e3b\u8981\u4f53\u73b0\u5728\u4e09\u4e2a\u65b9\u9762&#xff1a;\u54cd\u5e94\u901f\u5ea6&#xff08;\u4ece\u70b9\u51fb\u5230\u5f00\u59cb\u8bc6\u522b\u7684\u5ef6\u8fdf&#xff09;\u3001\u8bc6\u522b\u5ef6\u8fdf&#xff08;\u4ece\u8bf4\u5b8c\u8bdd\u5230\u51fa\u7ed3\u679c\u7684\u65f6\u95f4&#xff09;\u3001\u8d44\u6e90\u6d88\u8017&#xff08;CPU\u3001\u5185\u5b58\u3001\u7535\u91cf&#xff09;\u3002\u8fd9\u4e09\u8005\u5f80\u5f80\u9700\u8981\u6743\u8861\u2014\u2014\u66f4\u5feb\u7684\u54cd\u5e94\u53ef\u80fd\u610f\u5473\u7740\u66f4\u9ad8\u7684\u8d44\u6e90\u6d88\u8017\u3002<\/p>\n<p>\u4eca\u5929\u5206\u4eab\u4e00\u4e9b\u5b9e\u7528\u7684\u4f18\u5316\u7b56\u7565\u3002<\/p>\n<h3>\u4e00\u3001\u8bed\u97f3\u8bc6\u522b\u5f15\u64ce\u590d\u7528\u7b56\u7565<\/h3>\n<h4>1.1 \u5f53\u524d\u7684\u95ee\u9898<\/h4>\n<p>flutter_speech\u793a\u4f8bApp\u6bcf\u6b21\u70b9\u51fbListen\u90fd\u4f1a\u91cd\u65b0activate&#xff1a;<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">activate<\/span><span class=\"token punctuation\">(<\/span>selectedLang<span class=\"token punctuation\">.<\/span>code<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">then<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>_<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n      <span class=\"token keyword\">return<\/span> _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">listen<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">then<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>result<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">setState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> _isListening <span class=\"token operator\">&#061;<\/span> result<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n      <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u6bcf\u6b21activate\u90fd\u4f1a&#xff1a;<\/p>\n<li>\u7533\u8bf7\u6743\u9650&#xff08;\u5df2\u6388\u6743\u65f6\u5f88\u5feb&#xff0c;\u4f46\u4ecd\u6709\u5f00\u9500&#xff09;<\/li>\n<li>\u68c0\u6d4b\u80fd\u529b<\/li>\n<li>\u521b\u5efa\u5f15\u64ce&#xff08;500ms-3\u79d2&#xff09;<\/li>\n<li>\u8bbe\u7f6e\u76d1\u542c\u5668<\/li>\n<p>\u5982\u679c\u7528\u6237\u9891\u7e41\u4f7f\u7528\u8bed\u97f3\u8bc6\u522b&#xff0c;\u6bcf\u6b21\u90fd\u91cd\u65b0\u521b\u5efa\u5f15\u64ce\u662f\u5f88\u5927\u7684\u6d6a\u8d39\u3002<\/p>\n<h4>1.2 \u5f15\u64ce\u590d\u7528\u65b9\u6848<\/h4>\n<p><span class=\"token comment\">\/\/ \u6539\u8fdb&#xff1a;\u53ea\u5728\u9996\u6b21\u6216\u8bed\u8a00\u53d8\u5316\u65f6activate<\/span><br \/>\n<span class=\"token class-name\">String<\/span><span class=\"token operator\">?<\/span> _activatedLocale<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>_activatedLocale <span class=\"token operator\">!&#061;<\/span> selectedLang<span class=\"token punctuation\">.<\/span>code<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u8bed\u8a00\u53d8\u5316\u6216\u9996\u6b21\u4f7f\u7528&#xff0c;\u9700\u8981\u91cd\u65b0activate<\/span><br \/>\n    <span class=\"token keyword\">await<\/span> _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">activate<\/span><span class=\"token punctuation\">(<\/span>selectedLang<span class=\"token punctuation\">.<\/span>code<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    _activatedLocale <span class=\"token operator\">&#061;<\/span> selectedLang<span class=\"token punctuation\">.<\/span>code<span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u76f4\u63a5listen&#xff0c;\u590d\u7528\u5df2\u6709\u5f15\u64ce<\/span><br \/>\n  <span class=\"token keyword\">final<\/span> result <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">await<\/span> _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">listen<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token function\">setState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> _isListening <span class=\"token operator\">&#061;<\/span> result<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>1.3 \u539f\u751f\u7aef\u7684\u914d\u5408<\/h4>\n<p>\u5f53\u524d\u539f\u751f\u7aef\u6bcf\u6b21activate\u90fd\u4f1a\u521b\u5efa\u65b0\u5f15\u64ce\u3002\u53ef\u4ee5\u52a0\u4e00\u4e2a\u5f15\u64ce\u590d\u7528\u5224\u65ad&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token function\">activate<\/span><span class=\"token punctuation\">(<\/span>locale<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> result<span class=\"token operator\">:<\/span> MethodResult<span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> <span class=\"token builtin\">Promise<\/span><span class=\"token operator\">&lt;<\/span><span class=\"token keyword\">void<\/span><span class=\"token operator\">&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token comment\">\/\/ \u5982\u679c\u5f15\u64ce\u5df2\u5b58\u5728\u4e14\u8bed\u8a00\u76f8\u540c&#xff0c;\u76f4\u63a5\u8fd4\u56de\u6210\u529f<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>asrEngine <span class=\"token operator\">&amp;&amp;<\/span> <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>currentLocale <span class=\"token operator\">&#061;&#061;&#061;<\/span> locale<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token builtin\">console<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">info<\/span><span class=\"token punctuation\">(<\/span><span class=\"token constant\">TAG<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#039;reusing existing engine&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>channel<span class=\"token operator\">?.<\/span><span class=\"token function\">invokeMethod<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;speech.onSpeechAvailability&#039;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    result<span class=\"token punctuation\">.<\/span><span class=\"token function\">success<\/span><span class=\"token punctuation\">(<\/span><span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">return<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u5982\u679c\u5f15\u64ce\u5b58\u5728\u4f46\u8bed\u8a00\u4e0d\u540c&#xff0c;\u5148\u9500\u6bc1<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>asrEngine<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">destroyEngine<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><\/p>\n<p>  <span class=\"token comment\">\/\/ \u521b\u5efa\u65b0\u5f15\u64ce&#8230;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>1.4 \u590d\u7528\u7684\u6536\u76ca<\/h4>\n<table>\n<tr>\u573a\u666f\u4e0d\u590d\u7528\u590d\u7528\u8282\u7701<\/tr>\n<tbody>\n<tr>\n<td>\u7b2c1\u6b21\u8bc6\u522b<\/td>\n<td>~2\u79d2<\/td>\n<td>~2\u79d2<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c2\u6b21\u8bc6\u522b&#xff08;\u540c\u8bed\u8a00&#xff09;<\/td>\n<td>~2\u79d2<\/td>\n<td>&lt;100ms<\/td>\n<td>~1.9\u79d2<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c3\u6b21\u8bc6\u522b&#xff08;\u540c\u8bed\u8a00&#xff09;<\/td>\n<td>~2\u79d2<\/td>\n<td>&lt;100ms<\/td>\n<td>~1.9\u79d2<\/td>\n<\/tr>\n<tr>\n<td>\u5207\u6362\u8bed\u8a00\u540e<\/td>\n<td>~2\u79d2<\/td>\n<td>~2\u79d2<\/td>\n<td>0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u5f15\u64ce\u590d\u7528\u662f\u6700\u6709\u6548\u7684\u4f18\u5316\u3002\u5bf9\u4e8e\u9891\u7e41\u4f7f\u7528\u8bed\u97f3\u8bc6\u522b\u7684\u573a\u666f&#xff0c;\u53ef\u4ee5\u5c06\u54cd\u5e94\u65f6\u95f4\u4ece2\u79d2\u964d\u5230100\u6beb\u79d2\u4ee5\u5185\u3002<\/p>\n<h3>\u4e8c\u3001VAD&#xff08;Voice Activity Detection&#xff09;\u53c2\u6570\u8c03\u4f18<\/h3>\n<h4>2.1 VAD\u53c2\u6570\u56de\u987e<\/h4>\n<p><span class=\"token keyword\">const<\/span> extraParam<span class=\"token operator\">:<\/span> Record<span class=\"token operator\">&lt;<\/span><span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> Object<span class=\"token operator\">&gt;<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token string-property property\">&#034;recognitionMode&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  <span class=\"token string-property property\">&#034;vadBegin&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">2000<\/span><span class=\"token punctuation\">,<\/span>    <span class=\"token comment\">\/\/ \u7b49\u5f85\u5f00\u53e3\u8d85\u65f6<\/span><br \/>\n  <span class=\"token string-property property\">&#034;vadEnd&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">3000<\/span><span class=\"token punctuation\">,<\/span>      <span class=\"token comment\">\/\/ \u9759\u97f3\u505c\u6b62\u8d85\u65f6<\/span><br \/>\n  <span class=\"token string-property property\">&#034;maxAudioDuration&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">60000<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>2.2 vadBegin\u8c03\u4f18<\/h4>\n<p>vadBegin\u5f71\u54cd&#034;\u7528\u6237\u70b9\u51fb\u540e\u5230\u8d85\u65f6\u62a5\u9519&#034;\u7684\u7b49\u5f85\u65f6\u95f4\u3002<\/p>\n<table>\n<tr>\u503c\u7528\u6237\u4f53\u9a8c\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>1000ms<\/td>\n<td>\u53cd\u5e94\u5feb\u4f46\u5bb9\u6613\u8bef\u8d85\u65f6<\/td>\n<td>\u719f\u7ec3\u7528\u6237\u3001\u8bed\u97f3\u6307\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>2000ms<\/td>\n<td>\u5e73\u8861&#xff08;\u9ed8\u8ba4&#xff09;<\/td>\n<td>\u901a\u7528\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>3000ms<\/td>\n<td>\u5bbd\u5bb9\u4f46\u7b49\u5f85\u4e45<\/td>\n<td>\u8001\u5e74\u7528\u6237\u3001\u601d\u8003\u578b\u8f93\u5165<\/td>\n<\/tr>\n<tr>\n<td>5000ms<\/td>\n<td>\u5f88\u5bbd\u5bb9<\/td>\n<td>\u7279\u6b8a\u9700\u6c42<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>2.3 vadEnd\u8c03\u4f18<\/h4>\n<p>vadEnd\u5f71\u54cd&#034;\u7528\u6237\u8bf4\u5b8c\u540e\u5230\u8fd4\u56de\u7ed3\u679c&#034;\u7684\u7b49\u5f85\u65f6\u95f4\u3002\u8fd9\u662f\u7528\u6237\u611f\u77e5\u6700\u660e\u663e\u7684\u5ef6\u8fdf\u3002<\/p>\n<table>\n<tr>\u503c\u7528\u6237\u4f53\u9a8c\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>1500ms<\/td>\n<td>\u5feb\u901f\u54cd\u5e94\u4f46\u53ef\u80fd\u622a\u65ad<\/td>\n<td>\u77ed\u6307\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>2000ms<\/td>\n<td>\u8f83\u5feb<\/td>\n<td>\u77ed\u53e5<\/td>\n<\/tr>\n<tr>\n<td>3000ms<\/td>\n<td>\u5e73\u8861&#xff08;\u9ed8\u8ba4&#xff09;<\/td>\n<td>\u901a\u7528\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>5000ms<\/td>\n<td>\u5141\u8bb8\u957f\u505c\u987f<\/td>\n<td>\u957f\u53e5\u3001\u601d\u8003\u578b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f3af; \u8c03\u4f18\u539f\u5219&#xff1a;vadEnd\u8d8a\u77ed&#xff0c;\u7528\u6237\u7b49\u5f85\u65f6\u95f4\u8d8a\u77ed&#xff0c;\u4f46\u8d8a\u5bb9\u6613\u5728\u7528\u6237\u505c\u987f\u65f6\u8bef\u5224\u4e3a&#034;\u8bf4\u5b8c\u4e86&#034;\u3002\u9700\u8981\u6839\u636e\u5b9e\u9645\u573a\u666f\u627e\u5e73\u8861\u70b9\u3002<\/p>\n<h4>2.4 \u52a8\u6001VAD\u8c03\u6574<\/h4>\n<p>\u66f4\u9ad8\u7ea7\u7684\u65b9\u6848\u662f\u6839\u636e\u7528\u6237\u884c\u4e3a\u52a8\u6001\u8c03\u6574VAD\u53c2\u6570&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u6839\u636e\u8bc6\u522b\u6a21\u5f0f\u52a8\u6001\u8bbe\u7f6eVAD<\/span><br \/>\n<span class=\"token keyword\">private<\/span> <span class=\"token function\">getVadParams<\/span><span class=\"token punctuation\">(<\/span>mode<span class=\"token operator\">:<\/span> <span class=\"token builtin\">string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token operator\">:<\/span> Record<span class=\"token operator\">&lt;<\/span><span class=\"token builtin\">string<\/span><span class=\"token punctuation\">,<\/span> Object<span class=\"token operator\">&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">switch<\/span> <span class=\"token punctuation\">(<\/span>mode<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">case<\/span> <span class=\"token string\">&#039;command&#039;<\/span><span class=\"token operator\">:<\/span>  <span class=\"token comment\">\/\/ \u8bed\u97f3\u6307\u4ee4\u6a21\u5f0f<\/span><br \/>\n      <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;vadBegin&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">1500<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;vadEnd&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">1500<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;maxAudioDuration&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">10000<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">case<\/span> <span class=\"token string\">&#039;dictation&#039;<\/span><span class=\"token operator\">:<\/span>  <span class=\"token comment\">\/\/ \u542c\u5199\u6a21\u5f0f<\/span><br \/>\n      <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;vadBegin&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">3000<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;vadEnd&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">5000<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;maxAudioDuration&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">300000<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">default<\/span><span class=\"token operator\">:<\/span>  <span class=\"token comment\">\/\/ \u9ed8\u8ba4\u6a21\u5f0f<\/span><br \/>\n      <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token string-property property\">&#034;vadBegin&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">2000<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;vadEnd&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">3000<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string-property property\">&#034;maxAudioDuration&#034;<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">60000<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u4e09\u3001\u91c7\u6837\u7387\u4e0e\u97f3\u9891\u8d28\u91cf\u7684\u5e73\u8861<\/h3>\n<h4>3.1 \u5f53\u524d\u914d\u7f6e<\/h4>\n<p><span class=\"token keyword\">const<\/span> audioParam<span class=\"token operator\">:<\/span> speechRecognizer<span class=\"token punctuation\">.<\/span>AudioInfo <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  audioType<span class=\"token operator\">:<\/span> <span class=\"token string\">&#039;pcm&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  sampleRate<span class=\"token operator\">:<\/span> <span class=\"token number\">16000<\/span><span class=\"token punctuation\">,<\/span>   <span class=\"token comment\">\/\/ 16kHz<\/span><br \/>\n  soundChannel<span class=\"token operator\">:<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span>     <span class=\"token comment\">\/\/ \u5355\u58f0\u9053<\/span><br \/>\n  sampleBit<span class=\"token operator\">:<\/span> <span class=\"token number\">16<\/span>        <span class=\"token comment\">\/\/ 16bit<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>3.2 \u6570\u636e\u91cf\u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u914d\u7f6e\u6570\u636e\u738760\u79d2\u6570\u636e\u91cf\u8bc6\u522b\u8d28\u91cf<\/tr>\n<tbody>\n<tr>\n<td>8kHz\/8bit\/mono<\/td>\n<td>8 KB\/s<\/td>\n<td>480 KB<\/td>\n<td>\u5dee<\/td>\n<\/tr>\n<tr>\n<td>16kHz\/16bit\/mono<\/td>\n<td>32 KB\/s<\/td>\n<td>1.9 MB<\/td>\n<td>\u597d&#xff08;\u63a8\u8350&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>44.1kHz\/16bit\/mono<\/td>\n<td>88 KB\/s<\/td>\n<td>5.3 MB<\/td>\n<td>\u597d&#xff08;\u6d6a\u8d39&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>44.1kHz\/16bit\/stereo<\/td>\n<td>176 KB\/s<\/td>\n<td>10.6 MB<\/td>\n<td>\u597d&#xff08;\u66f4\u6d6a\u8d39&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.3 \u4e3a\u4ec0\u4e48\u4e0d\u7528\u66f4\u9ad8\u91c7\u6837\u7387<\/h4>\n<p>16kHz\u5df2\u7ecf\u8986\u76d6\u4e86\u4eba\u7c7b\u8bed\u97f3\u7684\u4e3b\u8981\u9891\u7387\u8303\u56f4&#xff08;300Hz-3400Hz\u7684\u57fa\u9891&#xff0c;\u52a0\u4e0a\u8c10\u6ce2\u52308kHz&#xff09;\u3002\u66f4\u9ad8\u7684\u91c7\u6837\u7387\u53ea\u4f1a\u589e\u52a0\u6570\u636e\u91cf&#xff0c;\u4e0d\u4f1a\u663e\u8457\u63d0\u5347\u8bc6\u522b\u51c6\u786e\u7387\u3002<\/p>\n<p>\u8bed\u97f3\u8bc6\u522b\u6a21\u578b\u901a\u5e38\u572816kHz\u6570\u636e\u4e0a\u8bad\u7ec3&#xff0c;\u8f93\u5165\u5176\u4ed6\u91c7\u6837\u7387\u7684\u6570\u636e\u53cd\u800c\u53ef\u80fd\u964d\u4f4e\u51c6\u786e\u7387&#xff08;\u56e0\u4e3a\u7279\u5f81\u5206\u5e03\u4e0d\u540c&#xff09;\u3002<\/p>\n<h4>3.4 \u7f51\u7edc\u5e26\u5bbd\u8003\u8651<\/h4>\n<p>\u5728\u7ebf\u8bc6\u522b\u6a21\u5f0f\u4e0b&#xff0c;\u97f3\u9891\u6570\u636e\u9700\u8981\u4e0a\u4f20\u5230\u4e91\u7aef\u300232 KB\/s\u7684\u6570\u636e\u7387\u5bf9\u4e8e4G\/5G\/WiFi\u6765\u8bf4\u5b8c\u5168\u4e0d\u662f\u95ee\u9898&#xff0c;\u4f46\u5728\u5f31\u7f51\u73af\u5883\u4e0b\u53ef\u80fd\u4f1a\u6709\u5ef6\u8fdf\u3002<\/p>\n<p>32 KB\/s \u00d7 8 &#061; 256 kbps<\/p>\n<p>\u7f51\u7edc\u7c7b\u578b    \u5e26\u5bbd        \u662f\u5426\u8db3\u591f<br \/>\nWiFi       &gt;10 Mbps    \u2705 \u7ef0\u7ef0\u6709\u4f59<br \/>\n4G         &gt;1 Mbps     \u2705 \u8db3\u591f<br \/>\n3G         ~384 kbps   \u26a0\ufe0f \u521a\u597d\u591f<br \/>\n2G         ~64 kbps    \u274c \u4e0d\u591f<\/p>\n<h3>\u56db\u3001\u8bc6\u522b\u5ef6\u8fdf\u4f18\u5316&#xff1a;vadBegin \/ vadEnd \u914d\u7f6e<\/h3>\n<h4>4.1 \u5ef6\u8fdf\u7ec4\u6210\u5206\u6790<\/h4>\n<p>\u4ece\u7528\u6237\u70b9\u51fb&#034;Listen&#034;\u5230\u770b\u5230\u6700\u7ec8\u7ed3\u679c&#xff0c;\u603b\u5ef6\u8fdf\u7531\u4ee5\u4e0b\u90e8\u5206\u7ec4\u6210&#xff1a;<\/p>\n<p>\u603b\u5ef6\u8fdf &#061; \u5f15\u64ce\u542f\u52a8\u5ef6\u8fdf &#043; \u7528\u6237\u8bf4\u8bdd\u65f6\u95f4 &#043; VAD\u7b49\u5f85\u65f6\u95f4 &#043; \u7f51\u7edc\u4f20\u8f93\u65f6\u95f4 &#043; \u670d\u52a1\u7aef\u5904\u7406\u65f6\u95f4<\/p>\n<table>\n<tr>\u5ef6\u8fdf\u7ec4\u6210\u5178\u578b\u503c\u53ef\u4f18\u5316<\/tr>\n<tbody>\n<tr>\n<td>\u5f15\u64ce\u542f\u52a8<\/td>\n<td>100-500ms<\/td>\n<td>\u2705 \u5f15\u64ce\u590d\u7528<\/td>\n<\/tr>\n<tr>\n<td>\u7528\u6237\u8bf4\u8bdd<\/td>\n<td>1-10\u79d2<\/td>\n<td>\u274c \u7528\u6237\u51b3\u5b9a<\/td>\n<\/tr>\n<tr>\n<td>VAD\u7b49\u5f85(vadEnd)<\/td>\n<td>1.5-5\u79d2<\/td>\n<td>\u2705 \u53c2\u6570\u8c03\u4f18<\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u7edc\u4f20\u8f93<\/td>\n<td>100-500ms<\/td>\n<td>\u26a0\ufe0f \u53d6\u51b3\u4e8e\u7f51\u7edc<\/td>\n<\/tr>\n<tr>\n<td>\u670d\u52a1\u7aef\u5904\u7406<\/td>\n<td>200-1000ms<\/td>\n<td>\u274c \u670d\u52a1\u7aef\u51b3\u5b9a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>4.2 \u53ef\u4f18\u5316\u7684\u90e8\u5206<\/h4>\n<p>\u5f15\u64ce\u542f\u52a8\u5ef6\u8fdf&#xff1a;\u901a\u8fc7\u5f15\u64ce\u590d\u7528\u53ef\u4ee5\u4ece500ms\u964d\u5230&lt;100ms\u3002<\/p>\n<p>VAD\u7b49\u5f85\u65f6\u95f4&#xff1a;\u8fd9\u662f\u6700\u5927\u7684\u53ef\u4f18\u5316\u9879\u3002\u9ed8\u8ba4vadEnd&#061;3000ms\u610f\u5473\u7740\u7528\u6237\u8bf4\u5b8c\u540e\u8981\u7b493\u79d2\u624d\u80fd\u770b\u5230\u6700\u7ec8\u7ed3\u679c\u3002<\/p>\n<h4>4.3 \u51cf\u5c11\u611f\u77e5\u5ef6\u8fdf<\/h4>\n<p>\u5373\u4f7f\u4e0d\u80fd\u51cf\u5c11\u5b9e\u9645\u5ef6\u8fdf&#xff0c;\u4e5f\u53ef\u4ee5\u51cf\u5c11\u611f\u77e5\u5ef6\u8fdf&#xff1a;<\/p>\n<li>\u5b9e\u65f6\u663e\u793a\u90e8\u5206\u7ed3\u679c&#xff1a;\u7528\u6237\u8bf4\u8bdd\u65f6\u5c31\u80fd\u770b\u5230\u6587\u5b57&#xff0c;\u4e0d\u9700\u8981\u7b49\u6700\u7ec8\u7ed3\u679c<\/li>\n<li>\u52a8\u753b\u53cd\u9988&#xff1a;\u663e\u793a\u5f55\u97f3\u6ce2\u5f62\u6216\u8109\u51b2\u52a8\u753b&#xff0c;\u8ba9\u7528\u6237\u77e5\u9053\u7cfb\u7edf\u5728\u5de5\u4f5c<\/li>\n<li>\u9884\u6d4b\u6027UI&#xff1a;\u5728VAD\u7b49\u5f85\u671f\u95f4\u663e\u793a&#034;\u6b63\u5728\u5904\u7406\u2026&#034;<\/li>\n<p><span class=\"token comment\">\/\/ \u5b9e\u65f6\u663e\u793a\u90e8\u5206\u7ed3\u679c&#xff08;flutter_speech\u5df2\u5b9e\u73b0&#xff09;<\/span><br \/>\n_speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">setRecognitionResultHandler<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span> text<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token function\">setState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;<\/span><span class=\"token operator\">&gt;<\/span> transcription <span class=\"token operator\">&#061;<\/span> text<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5b9e\u65f6\u66f4\u65b0<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>4.4 \u624b\u52a8stop vs VAD\u81ea\u52a8\u505c\u6b62<\/h4>\n<table>\n<tr>\u65b9\u5f0f\u5ef6\u8fdf\u7528\u6237\u4f53\u9a8c<\/tr>\n<tbody>\n<tr>\n<td>VAD\u81ea\u52a8\u505c\u6b62<\/td>\n<td>&#043;vadEnd\u65f6\u95f4<\/td>\n<td>\u65e0\u9700\u64cd\u4f5c&#xff0c;\u4f46\u8981\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u624b\u52a8stop<\/td>\n<td>\u65e0\u989d\u5916\u5ef6\u8fdf<\/td>\n<td>\u9700\u8981\u70b9\u51fb\u6309\u94ae<\/td>\n<\/tr>\n<tr>\n<td>\u6309\u4f4f\u8bf4\u8bdd&#xff08;PTT&#xff09;<\/td>\n<td>\u65e0\u989d\u5916\u5ef6\u8fdf<\/td>\n<td>\u677e\u624b\u5373\u505c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u201c\u6309\u4f4f\u8bf4\u8bdd\u201d&#xff08;Push-to-Talk&#xff09;\u6a21\u5f0f\u53ef\u4ee5\u5b8c\u5168\u6d88\u9664VAD\u7b49\u5f85\u5ef6\u8fdf&#xff0c;\u4f46\u9700\u8981\u4fee\u6539UI\u4ea4\u4e92\u3002<\/p>\n<h3>\u4e94\u3001\u5185\u5b58\u5360\u7528\u76d1\u63a7\u4e0e\u4f18\u5316\u5efa\u8bae<\/h3>\n<h4>5.1 \u5185\u5b58\u5360\u7528\u6765\u6e90<\/h4>\n<table>\n<tr>\u7ec4\u4ef6\u9884\u4f30\u5185\u5b58\u751f\u547d\u5468\u671f<\/tr>\n<tbody>\n<tr>\n<td>FlutterSpeechPlugin\u5b9e\u4f8b<\/td>\n<td>&lt;1 KB<\/td>\n<td>App\u751f\u547d\u5468\u671f<\/td>\n<\/tr>\n<tr>\n<td>MethodChannel<\/td>\n<td>~10 KB<\/td>\n<td>\u5f15\u64ce\u7ed1\u5b9a\u671f\u95f4<\/td>\n<\/tr>\n<tr>\n<td>SpeechRecognitionEngine<\/td>\n<td>~5-20 MB<\/td>\n<td>activate\u5230destroy<\/td>\n<\/tr>\n<tr>\n<td>\u97f3\u9891\u7f13\u51b2\u533a<\/td>\n<td>~1-5 MB<\/td>\n<td>\u8bc6\u522b\u671f\u95f4<\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u7edc\u8fde\u63a5<\/td>\n<td>~100 KB<\/td>\n<td>\u5728\u7ebf\u8bc6\u522b\u671f\u95f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>5.2 \u5185\u5b58\u4f18\u5316\u7b56\u7565<\/h4>\n<p>\u7b56\u75651&#xff1a;\u53ca\u65f6\u91ca\u653e\u5f15\u64ce<\/p>\n<p>\u5982\u679c\u7528\u6237\u957f\u65f6\u95f4\u4e0d\u4f7f\u7528\u8bed\u97f3\u8bc6\u522b&#xff0c;\u53ef\u4ee5\u4e3b\u52a8\u91ca\u653e\u5f15\u64ce&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u9875\u9762\u4e0d\u53ef\u89c1\u65f6\u91ca\u653e\u5f15\u64ce<\/span><br \/>\n<span class=\"token metadata function\">&#064;override<\/span><br \/>\n<span class=\"token keyword\">void<\/span> <span class=\"token function\">didChangeAppLifecycleState<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">AppLifecycleState<\/span> state<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>state <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token class-name\">AppLifecycleState<\/span><span class=\"token punctuation\">.<\/span>paused<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ App\u8fdb\u5165\u540e\u53f0&#xff0c;\u91ca\u653e\u5f15\u64ce<\/span><br \/>\n    _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">cancel<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u53ef\u4ee5\u901a\u8fc7MethodChannel\u8c03\u7528destroy<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>state <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token class-name\">AppLifecycleState<\/span><span class=\"token punctuation\">.<\/span>resumed<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ App\u56de\u5230\u524d\u53f0&#xff0c;\u6309\u9700\u91cd\u65b0activate<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7b56\u75652&#xff1a;\u61d2\u52a0\u8f7d\u5f15\u64ce<\/p>\n<p>\u4e0d\u5728App\u542f\u52a8\u65f6\u5c31activate&#xff0c;\u800c\u662f\u5728\u7528\u6237\u7b2c\u4e00\u6b21\u70b9\u51fbListen\u65f6\u624dactivate&#xff1a;<\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">async<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>_speechRecognitionAvailable<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u9996\u6b21\u4f7f\u7528&#xff0c;\u5148activate<\/span><br \/>\n    <span class=\"token keyword\">await<\/span> _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">activate<\/span><span class=\"token punctuation\">(<\/span>selectedLang<span class=\"token punctuation\">.<\/span>code<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><br \/>\n  <span class=\"token keyword\">await<\/span> _speech<span class=\"token punctuation\">.<\/span><span class=\"token function\">listen<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u7b56\u75653&#xff1a;\u5f15\u64ce\u590d\u7528&#043;\u8d85\u65f6\u91ca\u653e<\/p>\n<p>\u590d\u7528\u5f15\u64ce\u4f46\u8bbe\u7f6e\u8d85\u65f6&#xff0c;\u957f\u65f6\u95f4\u4e0d\u7528\u5c31\u81ea\u52a8\u91ca\u653e&#xff1a;<\/p>\n<p><span class=\"token class-name\">Timer<\/span><span class=\"token operator\">?<\/span> _engineReleaseTimer<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">void<\/span> <span class=\"token function\">resetEngineTimer<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n  _engineReleaseTimer<span class=\"token operator\">?<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">cancel<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n  _engineReleaseTimer <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">Timer<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Duration<\/span><span class=\"token punctuation\">(<\/span>minutes<span class=\"token punctuation\">:<\/span> <span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ 5\u5206\u949f\u6ca1\u4f7f\u7528&#xff0c;\u91ca\u653e\u5f15\u64ce<\/span><br \/>\n    _activatedLocale <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u901a\u8fc7MethodChannel\u8c03\u7528destroy<\/span><br \/>\n  <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h4>5.3 \u5185\u5b58\u76d1\u63a7<\/h4>\n<p><span class=\"token comment\"># \u67e5\u770bApp\u5185\u5b58\u4f7f\u7528<\/span><br \/>\nhdc shell hidumper -p <span class=\"token operator\">&lt;<\/span>pid<span class=\"token operator\">&gt;<\/span> &#8211;mem<\/p>\n<p><span class=\"token comment\"># \u6301\u7eed\u76d1\u63a7<\/span><br \/>\n<span class=\"token function\">watch<\/span> -n <span class=\"token number\">2<\/span> <span class=\"token string\">&#034;hdc shell hidumper -p &lt;pid&gt; &#8211;mem | head -20&#034;<\/span><\/p>\n<p>\u5173\u6ce8\u4ee5\u4e0b\u6307\u6807&#xff1a;<\/p>\n<ul>\n<li>PSS&#xff08;Proportional Set Size&#xff09;&#xff1a;App\u5b9e\u9645\u5360\u7528\u7684\u7269\u7406\u5185\u5b58<\/li>\n<li>USS&#xff08;Unique Set Size&#xff09;&#xff1a;App\u72ec\u5360\u7684\u7269\u7406\u5185\u5b58<\/li>\n<li>RSS&#xff08;Resident Set Size&#xff09;&#xff1a;App\u7684\u5e38\u9a7b\u5185\u5b58<\/li>\n<\/ul>\n<h4>5.4 \u5185\u5b58\u6cc4\u6f0f\u68c0\u6d4b<\/h4>\n<p>\u5982\u679c\u53cd\u590dactivate\/destroy\u540e\u5185\u5b58\u6301\u7eed\u589e\u957f&#xff0c;\u53ef\u80fd\u6709\u6cc4\u6f0f&#xff1a;<\/p>\n<p>\u7b2c1\u6b21activate: PSS &#061; 50 MB<br \/>\n\u7b2c1\u6b21destroy:  PSS &#061; 45 MB  (\u6b63\u5e38&#xff0c;\u6709\u4e9b\u7f13\u5b58)<br \/>\n\u7b2c2\u6b21activate: PSS &#061; 55 MB<br \/>\n\u7b2c2\u6b21destroy:  PSS &#061; 50 MB  (\u6b63\u5e38)<br \/>\n\u7b2c3\u6b21activate: PSS &#061; 60 MB<br \/>\n\u7b2c3\u6b21destroy:  PSS &#061; 58 MB  \u2190 \u5982\u679c\u6301\u7eed\u589e\u957f&#xff0c;\u53ef\u80fd\u6709\u6cc4\u6f0f<\/p>\n<h3>\u516d\u3001\u7efc\u5408\u4f18\u5316\u65b9\u6848<\/h3>\n<h4>6.1 \u4f18\u5316\u524d\u540e\u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u6307\u6807\u4f18\u5316\u524d\u4f18\u5316\u540e\u6539\u5584<\/tr>\n<tbody>\n<tr>\n<td>\u9996\u6b21\u8bc6\u522b\u5ef6\u8fdf<\/td>\n<td>~3\u79d2<\/td>\n<td>~3\u79d2<\/td>\n<td>\u65e0&#xff08;\u9996\u6b21\u65e0\u6cd5\u4f18\u5316&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u540e\u7eed\u8bc6\u522b\u5ef6\u8fdf<\/td>\n<td>~3\u79d2<\/td>\n<td>&lt;500ms<\/td>\n<td>85%<\/td>\n<\/tr>\n<tr>\n<td>VAD\u7b49\u5f85<\/td>\n<td>3\u79d2<\/td>\n<td>2\u79d2&#xff08;\u573a\u666f\u5316&#xff09;<\/td>\n<td>33%<\/td>\n<\/tr>\n<tr>\n<td>\u7a7a\u95f2\u5185\u5b58<\/td>\n<td>20MB&#xff08;\u5f15\u64ce\u5e38\u9a7b&#xff09;<\/td>\n<td>5MB&#xff08;\u8d85\u65f6\u91ca\u653e&#xff09;<\/td>\n<td>75%<\/td>\n<\/tr>\n<tr>\n<td>\u611f\u77e5\u5ef6\u8fdf<\/td>\n<td>\u9ad8&#xff08;\u7b49\u6700\u7ec8\u7ed3\u679c&#xff09;<\/td>\n<td>\u4f4e&#xff08;\u5b9e\u65f6\u90e8\u5206\u7ed3\u679c&#xff09;<\/td>\n<td>\u663e\u8457<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>6.2 \u4f18\u5316\u4f18\u5148\u7ea7<\/h4>\n<li>\u5f15\u64ce\u590d\u7528&#xff08;\u6536\u76ca\u6700\u5927&#xff0c;\u6539\u52a8\u6700\u5c0f&#xff09;<\/li>\n<li>\u5b9e\u65f6\u663e\u793a\u90e8\u5206\u7ed3\u679c&#xff08;flutter_speech\u5df2\u5b9e\u73b0&#xff09;<\/li>\n<li>VAD\u53c2\u6570\u573a\u666f\u5316&#xff08;\u6839\u636e\u4e1a\u52a1\u8c03\u6574&#xff09;<\/li>\n<li>\u61d2\u52a0\u8f7d&#043;\u8d85\u65f6\u91ca\u653e&#xff08;\u51cf\u5c11\u5185\u5b58\u5360\u7528&#xff09;<\/li>\n<li>\u6309\u4f4f\u8bf4\u8bdd\u6a21\u5f0f&#xff08;\u6d88\u9664VAD\u5ef6\u8fdf&#xff0c;\u4f46\u9700\u6539UI&#xff09;<\/li>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u672c\u6587\u8bb2\u89e3\u4e86flutter_speech\u7684\u6027\u80fd\u4f18\u5316\u5b9e\u8df5&#xff1a;<\/p>\n<li>\u5f15\u64ce\u590d\u7528&#xff1a;\u907f\u514d\u91cd\u590d\u521b\u5efa\u5f15\u64ce&#xff0c;\u54cd\u5e94\u65f6\u95f4\u4ece2\u79d2\u964d\u5230100ms<\/li>\n<li>VAD\u8c03\u4f18&#xff1a;\u6839\u636e\u573a\u666f\u8c03\u6574vadBegin\/vadEnd&#xff0c;\u5e73\u8861\u54cd\u5e94\u901f\u5ea6\u548c\u51c6\u786e\u6027<\/li>\n<li>\u97f3\u9891\u53c2\u6570&#xff1a;16kHz\/16bit\/mono\u662f\u6700\u4f73\u914d\u7f6e&#xff0c;\u4e0d\u9700\u8981\u66f4\u9ad8<\/li>\n<li>\u5ef6\u8fdf\u4f18\u5316&#xff1a;\u5b9e\u65f6\u90e8\u5206\u7ed3\u679c&#043;\u624b\u52a8stop\u53ef\u4ee5\u663e\u8457\u51cf\u5c11\u611f\u77e5\u5ef6\u8fdf<\/li>\n<li>\u5185\u5b58\u7ba1\u7406&#xff1a;\u61d2\u52a0\u8f7d&#043;\u8d85\u65f6\u91ca\u653e&#xff0c;\u51cf\u5c11\u7a7a\u95f2\u65f6\u7684\u5185\u5b58\u5360\u7528<\/li>\n<p>\u4e0b\u4e00\u7bc7\u6211\u4eec\u8bb2\u5355\u5143\u6d4b\u8bd5\u4e0e\u96c6\u6210\u6d4b\u8bd5\u2014\u2014\u5982\u4f55\u9a8c\u8bc1flutter_speech\u7684\u6b63\u786e\u6027\u3002<\/p>\n<p>\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9&#xff0c;\u6b22\u8fce\u70b9\u8d5e\u3001\u6536\u85cf\u3001\u5173\u6ce8&#xff0c;\u4f60\u7684\u652f\u6301\u662f\u6211\u6301\u7eed\u521b\u4f5c\u7684\u52a8\u529b&#xff01;<\/p>\n<hr \/>\n<p>\u76f8\u5173\u8d44\u6e90&#xff1a;<\/p>\n<ul>\n<li>Core Speech Kit\u6027\u80fd\u6307\u5357<\/li>\n<li>OpenHarmony\u5185\u5b58\u7ba1\u7406<\/li>\n<li>VAD\u8bed\u97f3\u6d3b\u52a8\u68c0\u6d4b<\/li>\n<li>Flutter\u6027\u80fd\u6700\u4f73\u5b9e\u8df5<\/li>\n<li>flutter_speech OpenHarmony\u6e90\u7801<\/li>\n<li>\u5f00\u6e90\u9e3f\u8499\u8de8\u5e73\u53f0\u793e\u533a<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00<br \/>\n\u6b22\u8fce\u52a0\u5165\u5f00\u6e90\u9e3f\u8499\u8de8\u5e73\u53f0\u793e\u533a&#xff1a;https:\/\/openharmonycrossplatform.csdn.net<br \/>\nflutter_speech\u7684\u6838\u5fc3\u529f\u80fd\u5df2\u7ecf\u8dd1\u901a\u4e86&#xff0c;\u4f46\\&#8221;\u80fd\u7528\\&#8221;\u548c\\&#8221;\u597d\u7528\\&#8221;\u4e4b\u95f4\u8fd8\u6709\u4e00\u6bb5\u8ddd\u79bb\u3002\u6027\u80fd\u4f18\u5316\u5c31\u662f\u7f29\u77ed\u8fd9\u6bb5\u8ddd\u79bb\u7684\u5173\u952e\u3002<br \/>\n\u8bed\u97f3\u8bc6\u522b\u63d2\u4ef6\u7684\u6027\u80fd\u4e3b\u8981\u4f53\u73b0\u5728\u4e09\u4e2a\u65b9\u9762&#xff1a;\u54cd\u5e94\u901f\u5ea6&#xff08;\u4ece\u70b9\u51fb\u5230\u5f00\u59cb\u8bc6\u522b\u7684\u5ef6\u8fdf&#xff09;\u3001\u8bc6\u522b\u5ef6\u8fdf&#xff08;\u4ece\u8bf4\u5b8c\u8bdd\u5230\u51fa\u7ed3\u679c\u7684\u65f6\u95f4&#xff09;\u3001\u8d44\u6e90\u6d88\u8017&#xff08;C<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2878,56],"topic":[],"class_list":["post-76185","post","type-post","status-publish","format-standard","hentry","category-server","tag-flutter","tag-56"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/76185.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00 \u6b22\u8fce\u52a0\u5165\u5f00\u6e90\u9e3f\u8499\u8de8\u5e73\u53f0\u793e\u533a&#xff1a;https:\/\/openharmonycrossplatform.csdn.net flutter_speech\u7684\u6838\u5fc3\u529f\u80fd\u5df2\u7ecf\u8dd1\u901a\u4e86&#xff0c;\u4f46&quot;\u80fd\u7528&quot;\u548c&quot;\u597d\u7528&quot;\u4e4b\u95f4\u8fd8\u6709\u4e00\u6bb5\u8ddd\u79bb\u3002\u6027\u80fd\u4f18\u5316\u5c31\u662f\u7f29\u77ed\u8fd9\u6bb5\u8ddd\u79bb\u7684\u5173\u952e\u3002 \u8bed\u97f3\u8bc6\u522b\u63d2\u4ef6\u7684\u6027\u80fd\u4e3b\u8981\u4f53\u73b0\u5728\u4e09\u4e2a\u65b9\u9762&#xff1a;\u54cd\u5e94\u901f\u5ea6&#xff08;\u4ece\u70b9\u51fb\u5230\u5f00\u59cb\u8bc6\u522b\u7684\u5ef6\u8fdf&#xff09;\u3001\u8bc6\u522b\u5ef6\u8fdf&#xff08;\u4ece\u8bf4\u5b8c\u8bdd\u5230\u51fa\u7ed3\u679c\u7684\u65f6\u95f4&#xff09;\u3001\u8d44\u6e90\u6d88\u8017&#xff08;C\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/76185.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-21T14:25:44+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76185.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/76185.html\",\"name\":\"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-21T14:25:44+00:00\",\"dateModified\":\"2026-02-21T14:25:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/76185.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/76185.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/76185.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/76185.html","og_locale":"zh_CN","og_type":"article","og_title":"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u8a00 \u6b22\u8fce\u52a0\u5165\u5f00\u6e90\u9e3f\u8499\u8de8\u5e73\u53f0\u793e\u533a&#xff1a;https:\/\/openharmonycrossplatform.csdn.net flutter_speech\u7684\u6838\u5fc3\u529f\u80fd\u5df2\u7ecf\u8dd1\u901a\u4e86&#xff0c;\u4f46\"\u80fd\u7528\"\u548c\"\u597d\u7528\"\u4e4b\u95f4\u8fd8\u6709\u4e00\u6bb5\u8ddd\u79bb\u3002\u6027\u80fd\u4f18\u5316\u5c31\u662f\u7f29\u77ed\u8fd9\u6bb5\u8ddd\u79bb\u7684\u5173\u952e\u3002 \u8bed\u97f3\u8bc6\u522b\u63d2\u4ef6\u7684\u6027\u80fd\u4e3b\u8981\u4f53\u73b0\u5728\u4e09\u4e2a\u65b9\u9762&#xff1a;\u54cd\u5e94\u901f\u5ea6&#xff08;\u4ece\u70b9\u51fb\u5230\u5f00\u59cb\u8bc6\u522b\u7684\u5ef6\u8fdf&#xff09;\u3001\u8bc6\u522b\u5ef6\u8fdf&#xff08;\u4ece\u8bf4\u5b8c\u8bdd\u5230\u51fa\u7ed3\u679c\u7684\u65f6\u95f4&#xff09;\u3001\u8d44\u6e90\u6d88\u8017&#xff08;C","og_url":"https:\/\/www.wsisp.com\/helps\/76185.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-21T14:25:44+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/76185.html","url":"https:\/\/www.wsisp.com\/helps\/76185.html","name":"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-21T14:25:44+00:00","dateModified":"2026-02-21T14:25:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/76185.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/76185.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/76185.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Flutter\u4e09\u65b9\u5e93\u9002\u914dOpenHarmony\u3010flutter_speech\u3011\u2014 \u6027\u80fd\u4f18\u5316\u5b9e\u8df5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=76185"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/76185\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=76185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=76185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=76185"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=76185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}