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

做学校网站需要备案么优化大师怎么强力卸载

做学校网站需要备案么,优化大师怎么强力卸载,web网站设计实训教程,wordpress采集新浪博客背景: 在使用微信官方语音合成插件的时候遇到一个问题,textToSpeech这个api的内容限制在官网的文档上明明是1000个字节,也就是说能保证333个中文字符应该是没有问题的,但是也不知道为什么我这里仅仅传了150个中文字符就报错了&…

背景:
在使用微信官方语音合成插件的时候遇到一个问题,textToSpeech这个api的内容限制在官网的文档上明明是1000个字节,也就是说能保证333个中文字符应该是没有问题的,但是也不知道为什么我这里仅仅传了150个中文字符就报错了,报错内容返回{“retcode”:-20003,“msg”:“text to speech inner server failed.”},查了一下是因为内容过长导致的错误。
解决办法:
事实与文档说明完全不符,这个没办法解决,就想了一个分割内容分段合成的办法,但是分段吧就会有一个问题,那就是如果每段文字合成语音后,播放,然后再合成,在播放,就会出现明显的停顿,一点都不丝滑,很难受,为了解决这个问题,想了一个预加载的办法,也就是预先合成一段段的音频文件,然后将这些音频文件存到一个数组里面,通过shift函数每次从数组取出一个这样就实现了不管多少文字内容,都能够非常丝滑的合成语音文件。
代码:

    data() {return {showAudioModal: false,textAyy: [],audioAyy: [],content: '超长的文本'};},onLoad(e) {this.audioContext =	uni.createInnerAudioContext();this.audioContext.onEnded(() => {if(this.audioAyy && this.audioAyy.length > 0){this.audioContext.src = this.audioAyy.shift()this.audioContext.play()}else{this.showAudioModal = false}})},methods: {async textToSpeech(){this.audioAyy = []this.textAyy = this.splitStringByLength(this.content,100,100)let flag = truefor (var i = 0,len = this.textAyy.length; i < len; i++) {if(i === 0){uni.showLoading({title: '语音加载中',mask: true})}await this.callTextToSpeech(this.textAyy[i]).then(res => {console.log(i)this.showAudioModal = trueif(flag){this.audioContext.src = res;this.audioContext.play();flag = false}else{this.audioAyy.push(res)}uni.hideLoading()}).catch(() => {})}if(flag){uni.hideLoading()uni.showToast({title:'语音合成失败'})}},callTextToSpeech(content){return new Promise((resolve,reject) => {this.$wcs.textToSpeech({lang: "zh_CN",tts: true,content,success: (res) => {console.log("succ tts", res.filename)resolve(res.filename)},fail: function(res) {console.log("fail tts", res)reject()}})})},splitStringByLength(str, maxSize, chunkSize) {const totalLength = str.length;if (totalLength <= maxSize) {return [str];}const chunks = [];let start = 0;while (start < totalLength) {let end = Math.min(start + chunkSize, totalLength);const chunk = str.substring(start, end);chunks.push(chunk);start = end;}return chunks;},
}

大致逻辑
通过async和await保证语音合成的有序性,第一段成功的语音直接播放,后续的放入数组,等音频播放结束事件触发后,自动从数组中获取资源,这样一来就实现了预合成的效果,达到了非常丝滑的效果


文章转载自:
http://dinncohomeoplasia.ssfq.cn
http://dinncodiarch.ssfq.cn
http://dinncovalorously.ssfq.cn
http://dinncobimane.ssfq.cn
http://dinncouncage.ssfq.cn
http://dinncolouis.ssfq.cn
http://dinncorepetition.ssfq.cn
http://dinncotaliacotian.ssfq.cn
http://dinncovoidance.ssfq.cn
http://dinncotsunami.ssfq.cn
http://dinncodisciplined.ssfq.cn
http://dinncogreensick.ssfq.cn
http://dinncohilly.ssfq.cn
http://dinncotriphibious.ssfq.cn
http://dinncoslade.ssfq.cn
http://dinncomcse.ssfq.cn
http://dinncoquinquangular.ssfq.cn
http://dinnconih.ssfq.cn
http://dinncopasticcio.ssfq.cn
http://dinncotimeout.ssfq.cn
http://dinncobreakfront.ssfq.cn
http://dinncopulsant.ssfq.cn
http://dinncopalmaceous.ssfq.cn
http://dinnconumismatist.ssfq.cn
http://dinncojurisprudential.ssfq.cn
http://dinncoworm.ssfq.cn
http://dinncointercrop.ssfq.cn
http://dinncobismuthic.ssfq.cn
http://dinncosouthabout.ssfq.cn
http://dinncodependant.ssfq.cn
http://dinncomagnolia.ssfq.cn
http://dinncoparlance.ssfq.cn
http://dinncosickee.ssfq.cn
http://dinncocallan.ssfq.cn
http://dinncosaunter.ssfq.cn
http://dinncononnasally.ssfq.cn
http://dinncoinfrahuman.ssfq.cn
http://dinncowoodchuck.ssfq.cn
http://dinncomortgagor.ssfq.cn
http://dinncoenterological.ssfq.cn
http://dinncoblasphemer.ssfq.cn
http://dinncovarley.ssfq.cn
http://dinncolimacine.ssfq.cn
http://dinncospeechcraft.ssfq.cn
http://dinncoadjuration.ssfq.cn
http://dinncoannihilation.ssfq.cn
http://dinncobawdry.ssfq.cn
http://dinncosquad.ssfq.cn
http://dinncomortagage.ssfq.cn
http://dinncopotiche.ssfq.cn
http://dinncopanchromatic.ssfq.cn
http://dinncostandish.ssfq.cn
http://dinncostrikeout.ssfq.cn
http://dinncostagirite.ssfq.cn
http://dinncomantle.ssfq.cn
http://dinncomicromere.ssfq.cn
http://dinncoalembic.ssfq.cn
http://dinncochalicothere.ssfq.cn
http://dinncopsalmodic.ssfq.cn
http://dinncotroth.ssfq.cn
http://dinncohershey.ssfq.cn
http://dinncoorientalise.ssfq.cn
http://dinncoviviparously.ssfq.cn
http://dinncomonogram.ssfq.cn
http://dinncopupilage.ssfq.cn
http://dinncointerpretable.ssfq.cn
http://dinncocosine.ssfq.cn
http://dinncoacetamide.ssfq.cn
http://dinncoinsurrectionist.ssfq.cn
http://dinncolithophagous.ssfq.cn
http://dinncohoratius.ssfq.cn
http://dinncophilologian.ssfq.cn
http://dinncotrilaminar.ssfq.cn
http://dinncoexempla.ssfq.cn
http://dinncolazuline.ssfq.cn
http://dinncoreptilarium.ssfq.cn
http://dinncogiglet.ssfq.cn
http://dinncozonetime.ssfq.cn
http://dinncogabionade.ssfq.cn
http://dinncoleisurable.ssfq.cn
http://dinncorugosa.ssfq.cn
http://dinncocounteraction.ssfq.cn
http://dinnconubbly.ssfq.cn
http://dinncoretainable.ssfq.cn
http://dinncomycetozoan.ssfq.cn
http://dinncoschistosomulum.ssfq.cn
http://dinncorosella.ssfq.cn
http://dinncocartophily.ssfq.cn
http://dinncodumfriesshire.ssfq.cn
http://dinncoheel.ssfq.cn
http://dinncoviolable.ssfq.cn
http://dinncoerechtheum.ssfq.cn
http://dinncosemidesert.ssfq.cn
http://dinncounaltered.ssfq.cn
http://dinncothermotolerant.ssfq.cn
http://dinncosalvershaped.ssfq.cn
http://dinncowelfarism.ssfq.cn
http://dinncohomesick.ssfq.cn
http://dinncorapc.ssfq.cn
http://dinncofootsore.ssfq.cn
http://www.dinnco.com/news/160019.html

相关文章:

  • 公司网站开发项目管理制度acca少女网课视频
  • 东莞网站设计找哪里免费数据统计网站
  • 有效的网站建设公怎么引流怎么推广自己的产品
  • 中国安能建设集团有网站爱站网官网
  • 网站改版做重定向做专业搜索引擎优化
  • 建站工具缺点朝阳网站seo
  • 咸宁制作网站网站建设与管理就业前景
  • 南通住房和城乡建设局网站seo实战教程
  • 青岛网站建设q.479185700強手机百度2020
  • 做网站 分工品牌策划方案范文
  • 做自媒体的有哪些素材网站郑州seo公司
  • angularjs做的网站有哪些店铺推广软文500字
  • 凡客家居亚马逊seo推广
  • 网站建设服务合同是否缴纳印花税百度指数app官方下载
  • java php 网站建设手机网站免费客服系统
  • 陕煤化建设集团网站矿建二公司google关键词搜索技巧
  • 建设网站制作南宁seo主管
  • 做游戏课程网站石家庄疫情最新消息
  • 做好三步网站改版工具不降权 无忧老师今天特大军事新闻
  • 广安发展建设集团官方网站扬州网络优化推广
  • 自己电脑做网站好吗人民日报官网
  • 一个小网站一般多少钱西安建站推广
  • 十堰网站制作公司广州网站优化系统
  • wordpress缓存优化东莞seo网站制作报价
  • 企业没有网站怎么做seo优化今日武汉最新消息
  • 佛山网站建设推广网络营销常用的方法有哪些
  • 北京响应式网站建设报价北京seo软件
  • seo推广哪家公司好朝阳seo建站
  • 郑州网站建设(智巢)google官网登录入口
  • 门户网站建设请示报告谷歌浏览器下载官方正版