ASR长语音识别,基于vue2

asr语音识别

前端负责语音识别有长语音识别和实时语音识别,有基于js和jquery做的简单demo,这里是vue+ js-audio-recorder。第三方插件给了丰富的功能,包括采样样本,采样率,声道,浏览器录音权限等。
`

录音上传

<div style="font-size: 14px">
  <h3>录音时长:{
   { recorder && recorder.duration.toFixed(4) }}</h3>
  <el-button type="primary" @click="handleStart">开始录音</el-button>
  <el-button type="info" @click="handlePause">暂停录音</el-button>
  <el-button type="success" @click="handleResume">继续录音</el-button>
  <el-button type="warning" @click="handleStop">停止录音</el-button>
  <h3>
    播放时长:{
   {
      recorder &&
      (playTime > recorder.duration
        ? recorder.duration.toFixed(4)
        : playTime.toFixed(4))
    }}
  </h3>
  <br />
  <div class="bo">
  <el-button type="primary" @click="handlePlay">播放录音</el-button>
  <el-button type="info" @click="handlePausePlay">暂停播放</el-button>
  <el-button type="success" @click="handleResumePlay">继续播放</el-button>
  <el-button type="warning" @click="handleStopPlay">停止播放</el-button>
  <el-button type="error" @click="handleDestroy">销毁录音</el-button>
  <el-button type="info" @click="downWAV">下载WAV</el-button>
  <el-button type="info" @click="downPCM">下载pcm</el-button>
  <el-button type="primary" @click="uploadRecord">上传</el-button>
  <el-button type="success" @click="getResults">识别结果</el-button>
  </div>
  <br />
  <br />
  <textarea
    name=""
    id="textarea"
    style="width: 100%; height: 100px"
    cols="30"
    rows="10"
    v-model="result"
  />
</div>

`

<script>
import Recorder from "js-audio-recorder";
//import MyRecorder from '../js/MyRecorder'
import {
    v4 as uuidv4 } from "uuid";
uuidv4();
//const baseURL = "http://10.34.23.133:8899/asr/non_real";

export default {
   
  data() {
   
    return {
   
      recorder: null,
      playTime: 0,
      timer: null,
      src: null,
      sessionId: "",
      audio: "",
      data: "",
      result: "",
    };
  },
  created() {
   },
  mounted() {
   
    this.dataRecorder = this.data;
  },
  methods: {
   
    // 开始录音
    handleStart() {
   
      const uuid = require("uuid");
      this.sessionId = uuid.v4();
      console.log(this.sessionId);

      this.recorder = new Recorder({
   
        sampleBits
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值