欧美三级国产三级日韩三级_亚洲熟妇丰满大屁股熟妇_欧美亚洲成人一区二区三区_国产精品久久久久久模特

搭建https的silk錄音文件語(yǔ)音識(shí)別服務(wù)的調(diào)用過(guò)程 - 新聞資訊 - 云南小程序開(kāi)發(fā)|云南軟件開(kāi)發(fā)|云南網(wǎng)站建設(shè)-昆明葵宇信息科技有限公司

159-8711-8523

云南網(wǎng)建設(shè)/小程序開(kāi)發(fā)/軟件開(kāi)發(fā)

知識(shí)

不管是網(wǎng)站,軟件還是小程序,都要直接或間接能為您產(chǎn)生價(jià)值,我們?cè)谧非笃湟曈X(jué)表現(xiàn)的同時(shí),更側(cè)重于功能的便捷,營(yíng)銷(xiāo)的便利,運(yùn)營(yíng)的高效,讓網(wǎng)站成為營(yíng)銷(xiāo)工具,讓軟件能切實(shí)提升企業(yè)內(nèi)部管理水平和效率。優(yōu)秀的程序?yàn)楹笃谏?jí)提供便捷的支持!

您當(dāng)前位置>首頁(yè) » 新聞資訊 » 小程序相關(guān) >

搭建https的silk錄音文件語(yǔ)音識(shí)別服務(wù)的調(diào)用過(guò)程

發(fā)表時(shí)間:2021-4-22

發(fā)布人:葵宇科技

瀏覽次數(shù):141


這次的改動(dòng)是基于原來(lái)的“遙知之”版本v0.2基礎(chǔ)之上的。加上了語(yǔ)音識(shí)別,界面變化較大 。下面主要介紹一下新版本首頁(yè)面的功能和代碼實(shí)現(xiàn)。


實(shí)現(xiàn)功能

實(shí)現(xiàn)一個(gè)智能生活信息查詢(xún)的小秘書(shū)功能,支持查天氣、新聞、日歷、匯率、笑話(huà)、故事、百科、詩(shī)詞、郵編、區(qū)號(hào)、菜譜、股票、節(jié)目預(yù)告,還支持閑聊、算24點(diǎn)、數(shù)學(xué)計(jì)算、單位換算、購(gòu)物、搜索等功能。


使用方式:

新版上線(xiàn)支持語(yǔ)音識(shí)別,按下說(shuō)話(huà),松開(kāi)發(fā)送。

老版本上支持搖一搖、點(diǎn)界面按鈕、手動(dòng)輸入、下拉刷新這四種方式。


掃碼試用(左右皆可)

小程序碼小 二維碼小

界面展示

新版本界面展示

新版本界面展示2

開(kāi)發(fā)資源

  1. 免費(fèi)開(kāi)放語(yǔ)義接口平臺(tái) olami.ai
  2. 微信小程序平臺(tái)
  3. js, css
  4. 我自己搭建的https的語(yǔ)音識(shí)別API接口

源碼分析

這里主要介紹新版本首頁(yè)相關(guān)的代碼,其它部分代碼在 微信小程序——智能小秘“遙知之”源碼分享(語(yǔ)義理解基于olami)(注:這個(gè)是原來(lái)不支持語(yǔ)音識(shí)別的版本) 的基礎(chǔ)上,變化不怎么大,具體可參考那篇文章。

asr.js源碼:

/**
 * 作者:happycxz
 * 時(shí)間:2017.09.19
 * 源碼分享鏈接:http://blog.csdn.net/happycxz/article/details/78024986
 * 
 * https的silk語(yǔ)音識(shí)別API(專(zhuān)供微信小程序調(diào)用):https://api.happycxz.com/test/silk2asr/olami/asr
 * 該API服務(wù)搭建全過(guò)程解析及源碼分享貼:http://blog.csdn.net/happycxz/article/details/78016299
 * 需要使用此API請(qǐng)聯(lián)系作者QQ:404499164
 * 
 * 遵循開(kāi)放、分享、自由、免費(fèi)的精神,把開(kāi)源堅(jiān)持到底
 */

//獲取應(yīng)用實(shí)例 
var app = getApp()

var UTIL = require('../../utils/util.js');
var GUID = require('../../utils/GUID.js');
var NLI = require('../../utils/NLI.js');

const appkey = require('../../config').appkey
const appsecret = require('../../config').appsecret

//彈幕定時(shí)器
var timer;

var pageSelf = undefined;

var doommList = [];
class Doomm {
  constructor() {
    this.text = UTIL.getRandomItem(app.globalData.corpus);
    this.top = Math.ceil(Math.random() * 40);
    this.time = Math.ceil(Math.random() * 8 + 6);
    this.color = getRandomColor();
    this.display = true;
    let that = this;
    setTimeout(function () {
      doommList.splice(doommList.indexOf(that), 1);
      doommList.push(new Doomm());

      pageSelf.setData({
        doommData: doommList
      })
    }, this.time * 1000)
  }
}
function getRandomColor() {
  let rgb = []
  for (let i = 0; i < 3; ++i) {
    let color = Math.floor(Math.random() * 256).toString(16)
    color = color.length == 1 ? '0' + color : color
    rgb.push(color)
  }
  return '#' + rgb.join('')
}

Page({
  data: {
    j: 1,//幀動(dòng)畫(huà)初始圖片 
    isSpeaking: false,//是否正在說(shuō)話(huà)
    outputTxt : "", //輸出識(shí)別結(jié)果

    doommData: []
  },

  initDoomm: function () {
    doommList.push(new Doomm());
    doommList.push(new Doomm());
    doommList.push(new Doomm());
    this.setData({
      doommData: doommList
    })
  },

  onLoad: function () {
    pageSelf = this;
    this.initDoomm();
  },

  //手指按下 
  touchdown: function () {
    UTIL.log("手指按下了... new date : " + new Date)
    var _this = this;
    speaking.call(this);
    this.setData({
      isSpeaking: true
    })
    //開(kāi)始錄音 
    wx.startRecord({
      success: function (res) {
        //臨時(shí)路徑,下次進(jìn)入小程序時(shí)無(wú)法正常使用
        var tempFilePath = res.tempFilePath;
        UTIL.log('record SUCCESS file path:' + tempFilePath)
        _this.setData({
          recordPath: tempFilePath
        });
      },
      fail: function (res) {
        //錄音失敗 
        wx.showModal({
          title: '提示',
          content: '錄音的姿勢(shì)不對(duì)!',
          showCancel: false,
          success: function (res) {
            if (res.confirm) {
              UTIL.log('用戶(hù)點(diǎn)擊確定')
              return
            }
          }
        })
      }
    })
  },
  //手指抬起 
  touchup: function (