当前位置: 首页 > news >正文

桔子建站wordpress 美观插件

桔子建站,wordpress 美观插件,php 金融网站源码,家装用什么软件设计1、之前写过离线能力调用#xff0c;今天来个终极版#xff0c;实现智能交互或者结合大模型的智能交互示例#xff0c;下面进入正题。上B站效果离线唤醒离线合成离线命令词实现智能交互_哔哩哔哩_bilibili 2、到讯飞开放平台下载唤醒合成命令词的离线组合包#xff0c;找到…1、之前写过离线能力调用今天来个终极版实现智能交互或者结合大模型的智能交互示例下面进入正题。上B站效果离线唤醒离线合成离线命令词实现智能交互_哔哩哔哩_bilibili 2、到讯飞开放平台下载唤醒合成命令词的离线组合包找到msc_64.dll复制三份出来一定要注意路径位置不然会出现错误。msc直接下载的原封不动的拷贝就行 3、常量类的定义各位直接复制粘贴即可注意换自己的APPID不然报错的 package com.day.config;import com.sun.jna.ptr.IntByReference;import javax.sound.sampled.*; import java.io.ByteArrayOutputStream; import java.io.FileInputStream;public class Constants {// 构造16K 16BIT 单声道音频public static final String APPID 5e11538f; // APPIDpublic static final String WORK_DIR src/main/resources;// 1、唤醒相关 ssb_param一定注意IVW_SSB_PARAMS的fo|xxx资源的路径xxx取值是指WORK_DIR目录下/msc/xxx xxx是以后的路径开始拼接的public static final AudioFormat IVW_ASR_AUDIO_FORMAT new AudioFormat(16000F, 16, 1, true, false);public static final String IVW_DLL_PATH src/main/resources/ivw_msc_x64.dll; // windows动态库路径public static final String IVW_LOGIN_PARAMS appid APPID , work_dir WORK_DIR;public static final String IVW_SSB_PARAMS ivw_threshold0:1450,sstwakeup,ivw_shot_word1,ivw_res_path fo|res/ivw/wakeupresource.jet;public static IntByReference IVW_ERROR_CODE new IntByReference(-100);public static final Integer IVW_FRAME_SIZE 6400; // 一定要每200ms写10帧,否则会出现唤醒一段时间后无法唤醒的问题一帧的大小为640B,其他大小可能导致无法唤醒。public static Integer IVW_AUDIO_STATUS 1;public static DataLine.Info IVW_ASR_DATA_LINE_INFO new DataLine.Info(TargetDataLine.class, IVW_ASR_AUDIO_FORMAT);public static TargetDataLine IVW_ASR_TARGET_DATA_LINE; // 录音static {try {IVW_ASR_TARGET_DATA_LINE (TargetDataLine) AudioSystem.getLine(IVW_ASR_DATA_LINE_INFO);} catch (LineUnavailableException e) {e.printStackTrace();}}// 2、合成相关public static final AudioFormat TTS_AUDIO_FORMAT new AudioFormat(16000F, 16, 1, true, false);public static final String TTS_DLL_PATH src/main/resources/tts_msc_x64.dll; // windows动态库路径public static final String TTS_LOGIN_PARAMS appid APPID , work_dir WORK_DIR;public static final String TTS_SESSION_BEGIN_PARAMS engine_type local, voice_name xiaoyan, text_encoding UTF8, tts_res_path fo|res/tts/xiaoyan.jet;fo|res/tts/common.jet, sample_rate 16000, speed 50, volume 50, pitch 50, rdn 2;public static IntByReference TTS_ERROR_CODE new IntByReference(-100);public static IntByReference TTS_AUDIO_LEN new IntByReference(-100);public static IntByReference TTS_SYNTH_STATUS new IntByReference(-100);public static String TTS_TEXT; // 合成文本public static Integer TTS_TOTAL_AUDIO_LENGTH; // 合成音频长度public static ByteArrayOutputStream TTS_BYTE_ARRAY_OUTPUT_STREAM; // 合成音频流public static DataLine.Info TTS_DATA_LINE_INFO new DataLine.Info(SourceDataLine.class, TTS_AUDIO_FORMAT, AudioSystem.NOT_SPECIFIED);public static SourceDataLine TTS_SOURCE_DATA_LINE; // 播放static {try {TTS_SOURCE_DATA_LINE (SourceDataLine) AudioSystem.getLine(Constants.TTS_DATA_LINE_INFO);} catch (LineUnavailableException e) {e.printStackTrace();}}// 3、离线命令词相关public static final String ASR_DLL_PATH src/main/resources/asr_msc_x64.dll; // windows动态库路径public static final String ASR_LOGIN_PARAMS appid APPID , work_dir WORK_DIR;public static final String ASR_CALL_BNF_PATH src/main/resources/msc/res/asr/call.bnf;public static final String ASR_BUILD_PARAMS engine_type local,asr_res_path fo|res/asr/common.jet, sample_rate 16000,grm_build_path res/asr/GrmBuilld_x64;public static final String ASR_LEX_PARAMS engine_typelocal,asr_res_path fo|res/asr/common.jet, sample_rate 16000,grm_build_path res/asr/GrmBuilld_x64, grammar_list call;public static IntByReference ASR_ERROR_CODE new IntByReference(-100);public static final String ASR_SESSION_PARAMS vad_bos 3000 ,vad_eos 10000,engine_type local,asr_res_path fo|res/asr/common.jet, sample_rate 16000,grm_build_path res/asr/GrmBuilld_x64, local_grammar call,result_type json, result_encoding UTF8;public static IntByReference ASR_EP_STATUS new IntByReference(-100);public static IntByReference ASR_RECOG_STATUS new IntByReference(-100);public static Integer ASR_AUDIO_STATUS 1;public static Integer ASR_FRAME_SIZE 640; // 16k采样率的16位音频一帧的大小为640Byte(来自Windows SDK的说明)public static FileInputStream ASR_FILE_INPUT_STREAM;public static String ASR_GRAMMAR_CONTENT;public static IntByReference ASR_RESULT_STATUS new IntByReference(-100); }4、唤醒方法重写唤醒成功执行回调函数往下看 package com.day.service;import com.day.config.Constants; import com.day.service.imp.IvwCallback; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.ptr.IntByReference;public interface IvwService extends Library {/*** 重点* 1.char * 对应 String* 2.int * 对应 IntByReference* 3.void * 对应 Pointer或byte[]* 4.int 对应 int* 5.无参 对应 无参* 6.回调函数 对应 根据文档自定义回调函数实现接口Callback*///加载dll动态库并实例化,从而使用其内部的方法IvwService INSTANCE Native.loadLibrary(Constants.IVW_DLL_PATH, IvwService.class);//定义登录方法 MSPLogin(const char *usr, const char *pwd, const char *params)public Integer MSPLogin(String usr, String pwd, String params);//定义开始方法 QIVWSessionbegin(const char *grammarList, const char *params, int *errorCode)public String QIVWSessionBegin(String grammarList, String params, IntByReference errorCode);//定义写音频方法 QIVWAudioWrite(const char *sessionID, const void *audioData, unsigned int audioLen, int audioStatus)public Integer QIVWAudioWrite(String sessionID, byte[] audioData, int audioLen, int audioStatus);//定义结束方法 QIVWSessionEnd(const char *sessionID, const char *hints)public Integer QIVWSessionEnd(String sessionID, String hints);//定义获取结果方法 QIVWRegisterNotify(const char *sessionID, ivw_ntf_handler msgProcCb, void *userData)public Integer QIVWRegisterNotify(String sessionID, IvwCallback ivwCallback, byte[] userData);//定义退出方法 唤醒一般不用退出public Integer MSPLogout(); }5、合成方法重写 package com.day.service;import com.day.config.Constants; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.ptr.IntByReference;public interface TtsService extends Library {/*** 重点* 1.char * 对应 String* 2.int * 对应 IntByReference* 3.void * 对应 byte[]/Pointer回调函数里此类型需用String来对应。* 4.int 对应 int* 5.无参 对应 void* 6.回调函数 对应 根据文档自定义回调函数实现接口Callback离线语音合成无回调*///加载dll动态库并实例化,从而使用其内部的方法TtsService INSTANCE Native.loadLibrary(Constants.TTS_DLL_PATH, TtsService.class);//定义登录方法public Integer MSPLogin(String usr, String pwd, String params);//开始一次普通离线语音合成public String QTTSSessionBegin(String params, IntByReference errorCode);//写入需要合成的文本public Integer QTTSTextPut(String sessionID, String textString, int textLen, String params);//获取离线合成的音频public Pointer QTTSAudioGet(String sessionID, IntByReference audioLen, IntByReference synthStatus, IntByReference errorCode);//结束本次普通离线语音合成public Integer QTTSSessionEnd(String sessionID, String hints);//定义退出方法public Integer MSPLogout(); } 6、离线命令词方法重写 package com.day.service;import com.day.config.Constants; import com.day.service.imp.AsrGrammarCallback; import com.day.service.imp.AsrLexiconCallback; import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.ptr.IntByReference;public interface AsrService extends Library {/*** 重点* 1.char * 对应 String* 2.int * 对应 IntByReference* 3.void * 对应 byte[]回调函数里此类型需用String来对应。* 4.int 对应 int* 5.无参 对应 void* 6.回调函数 对应 根据文档自定义回调函数实现接口Callback*///加载dll动态库并实例化,从而使用其内部的方法AsrService INSTANCE Native.loadLibrary(Constants.ASR_DLL_PATH, AsrService.class);//定义登录方法public Integer MSPLogin(String usr, String pwd, String params);//开始一次语音识别。public String QISRSessionBegin(String grammarList, String params, IntByReference errorCode);//写入本次识别的音频public Integer QISRAudioWrite(String sessionID, byte[] byteArrayAudioData, int waveLen, int audioStatus, IntByReference epStatus, IntByReference recogStatus);//获取识别结果。public String QISRGetResult(String sessionID, IntByReference rsltStatus, int waitTime, IntByReference errorCode);//结束本次语音识别。public Integer QISRSessionEnd(String sessionID, String hints);//获取当次语音识别信息如上行流量、下行流量等public Integer QISRGetParam(String sessionID, String paramName, String paramValue, IntByReference valueLen);//构建语法生成语法ID。有回调public Integer QISRBuildGrammar(String grammarType, String grammarContent, int grammarLength, String params, AsrGrammarCallback asrGrammarCallback, byte[] userData);//更新本地语法词典。有回调public Integer QISRUpdateLexicon(String lexiconName, String lexiconContent, int lexiconLength, String params, AsrLexiconCallback asrLexiconCallback, byte[] userData);//定义退出方法public Integer MSPLogout(); }7、回调函数的定义1个唤醒的2个离线命令词的 package com.day.service.imp;import com.day.AIMain; import com.sun.jna.Callback;public class IvwCallback implements Callback {public int cb_ivw_msg_proc(String sessionID, int msg, int param1, int param2,String info, String userData) {System.out.println(回调函数返回的唤醒结果... info);AIMain.startTts(在的请说指令);AIMain.startAsr(); // 答复完毕调用命令词return 0;} }package com.day.service.imp;import com.sun.jna.Callback;public class AsrGrammarCallback implements Callback {public int build_grm_cb(int errorCode, String info, String userData) {System.out.println(构建语法返回的ID信息... info 错误码... errorCode);return 0;} }package com.day.service.imp;import com.sun.jna.Callback;public class AsrLexiconCallback implements Callback {public int LexiconCallBack(int errorCode, String info, String userData) {System.out.println(更新词典返回的信息... info 错误码... errorCode);return 0;} }8、为了方便各位看官上POM文件 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparent!--父工程坐标############################################################################################--groupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.1.6.RELEASE/versionrelativePath/ !-- lookup parent from repository --/parent!--自己被别人引用的坐标#########################################################################################--groupIdcom.example/groupIdartifactIdday/artifactIdversion0.0.1-SNAPSHOT/versionnameday/namedescriptionday/description!--指定JDK版本################################################################################################--propertiesjava.version1.8/java.version/properties!--总体依赖JAR################################################################################################--dependencies!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --dependencygroupIdcom.google.code.gson/groupIdartifactIdgson/artifactIdversion2.10.1/version/dependency!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna --dependencygroupIdnet.java.dev.jna/groupIdartifactIdjna/artifactIdversion5.5.0/version/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdversion2.1.6.RELEASE/version/plugin/plugins/build!--配置阿里云仓库下载--repositoriesrepositoryidnexus-aliyun/idnamenexus-aliyun/nameurlhttps://maven.aliyun.com/nexus/content/groups/public//urlreleasesenabledtrue/enabled/releasessnapshotsenabledfalse/enabled/snapshots/repository/repositoriespluginRepositoriespluginRepositoryidpublic/idnamenexus-aliyun/nameurlhttps://maven.aliyun.com/nexus/content/groups/public//urlreleasesenabledtrue/enabled/releasessnapshotsenabledfalse/enabled/snapshots/pluginRepository/pluginRepositories/project9、命令词也给一份示例Call.bnf老生常谈注意放置位置 #BNFIAT 1.0; !grammar call; !slot enter; !slot scanSolicitation; !slot scanDelivery; !slot exit; !start callStart; callStart:[enter][scanSolicitation][scanDelivery][exit]; enter:立刻|马上|一分钟后|十分钟后|半小时后; scanSolicitation:打开|关闭|调量|调暗|调高|调低; scanDelivery:主卧|次卧|书房|客厅; exit:空调|点灯|窗户|窗帘|衣柜; 10、实现完美的智能语音交互感兴趣的可以结合下大模型做智能问答场景。
http://www.pierceye.com/news/225375/

相关文章:

  • 织梦cms仿网站教程怎么做网站板块
  • 建设厅网站更改登陆密码wordpress主题 水墨
  • 彩云小梦ai写作网站机关网站建设情况汇报
  • 合肥专业网站优化手机界面设计素材
  • 台州网站建设惠店王烨烨
  • 工程建设比选公告固价方式网站wordpress html5的关系
  • 广州市网站建设 乾图信息科技潍坊市建设监理协会网站
  • 网站建优化网页脚本设计
  • 手机能访问电脑上自己做的网站吗网页设计作品到哪个网站
  • 网站推广成功案例城乡住房建设部官网查询
  • 养殖类网站模板那个网站的公众后推广做的好
  • 网站开发属于什么类型软件建站之星如何建网站
  • 微信做淘宝优惠券但网站是怎么建设但深圳市深圳市住房和建设局网站
  • 后端网站开发免费域名 网站
  • 综合信息网站建设方案网页浏览器排行榜前十名
  • 北京网站开发建设 58同城网站建设改版公司
  • 如何做网站预览网站设计线框图
  • 电子商务的网站的建设内容珠海自适应网站
  • 站酷海洛设计网站官网wordpress选了中文还是英文
  • 软件最全网站如何上传织梦做的网站
  • 做系统前的浏览网站能找回吗湖南网站建设价位
  • 工程服务建设网站那个网站可以做视频app制作
  • 国外网站访问速度慢企业网络营销策划案
  • 网站建设 亿安网络wordpress 调取菜单
  • 帝国网站管理系统安装教程互联网怎么做网站
  • 模板手机网站建设公司河南最新新闻事件今天
  • 企业网站备案要钱吗商标设计费用一般是多少
  • 天津专业网站制作新乡商城网站建设价格
  • 建筑业务网站建设泉州公司做网站
  • 做网站遇到的问题及解决方法网站快速查找