Coder Social home page Coder Social logo

tencent / face2facetranslator Goto Github PK

View Code? Open in Web Editor NEW
838.0 33.0 215.0 281 KB

面对面翻译小程序是微信团队针对面对面沟通的场景开发的流式语音翻译小程序,通过微信同声传译插件提供了语音识别,文本翻译等功能。

License: Other

JavaScript 100.00%

face2facetranslator's Introduction

面对面翻译小程序

面对面翻译小程序是微信团队针对中英文面对面沟通的场景开发的流式语音翻译小程序,基于微信同声传译插件封装实现,提供了中英文语音识别,文本翻译等功能。

预览

面对面翻译小程序

下载与使用

  1. 克隆代码
  2. project.config.json 中的 appid 替换成在公众平台申请的项目 id
  3. 公众平台 → 设置 → 第三方服务 → 插件管理 中 添加微信同声传译插件 (wx069ba97219f66d99)
  4. 打开微信开发者工具中添加项目

微信版本要求

基础库版本 >= 1.9.94

  • 使用插件,需要基础库版本 >= 1.9.6
  • 插件内调用wx.getRecorderManager接口,需要基础库版本 >= 1.9.94

微信同声传译插件支持功能

  • 语音识别 (目前支持 zh_CN(**大陆), en_US(英语), zh_HK(粤语), sichuanhua(四川话))
  • 文本翻译 (目前支持 zh_CN(**大陆),  en_US(英语))
  • 语音合成 (目前支持 zh_CN(**大陆),  en_US(英语))

FAQ

什么时候开放英语语音合成?

插件语音合成支持en_US(英语)正在加紧开发中

插件语音合成目前已经支持en_US(英语)

对于插件有新需求,可描述具体使用场景发送邮件至[email protected]

License

The MIT License

face2facetranslator's People

Contributors

aminhuang avatar xt1024 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face2facetranslator's Issues

不能导入同声传译插件

当我在我的微信小程序使用MQTT协议的时候,不能导入同声传译的插件会出现如下的问题。
QQ截图20190506210526

插件内报错Cannot read property 'method'

刚上线使用语言识别的插件
就频繁告警

Cannot read property 'method' of null;at socketTask.onopen callback function
TypeError: Cannot read property 'method' of null
at Object._buildWebsocketFrame (https://usr/app-service.js:1086:19965)
at Object.internalSend (https://usr/app-service.js:1086:20603)
at Function.<anonymous> (https://usr/app-service.js:1086:21402)
at i.emit (https://lib/WASubContext.js:1:371583)
at https://lib/WASubContext.js:1:699502
at https://lib/WASubContext.js:1:381835

排查是插件内导致,主要是socket方法原小程序内没有使用过,且这个错误发现是新版本才有的

合成问题

语音合成的时候能不能多加一个合成语音文件的长度。

不调用onError和onStop

下面是我的测试调用代码,怎么都不触发onError和onStop,但是触发了onStart和onRecognize

const plugin = requirePlugin("WechatSI");
const manager = plugin.getRecordRecognitionManager();
Page({
    data: {

    },

    onLoad: function (options) {
        this.initRecord();
    },

    
    onReady: function () {

    },

    initRecord: function () {
        manager.onStart = function (res) {
            console.log("成功开始录音识别", res)
        }
        manager.onStop(function (res) {
            console.log("onStop");
            console.log(res);
        })
        manager.onError(function (err) {
            console.log(err);
        });
        manager.onRecognize = function (res) {
            console.log("current result", res.result)
        }

    },
    startRecord: function (e) {
        console.log("long");
        manager.start();
    },
    endRecord: function (e) {
        
        manager.stop();
        console.log("end");
    }
})

支持vue3吗

在vue3项目里引入报错,找不到名称“requirePlugin”。ts(2304)

插件内 socket部分处理不当呀,一直在报错

Cannot read property 'close' of null;at api connectSocket fail callback function
TypeError: Cannot read property 'close' of null
at Object.closeWebsocket (https://usr/app-service.js:1086:23027)
at Object._reconnectWebosocket (https://usr/app-service.js:1086:19527)
at Function.fail (https://usr/app-service.js:1086:23427)

猜测是

wx.connectSocket({
    fail() {
// 这处代码是不是有问题呀, 比如某个变量是null,却又 取了 null.close 属性
    }
})

还有一个地方错误

Cannot read property 'method' of null;at socketTask.onopen callback function
TypeError: Cannot read property 'method' of null
at Object._buildWebsocketFrame (https://usr/app-service.js:1086:19965)
at Object.internalSend (https://usr/app-service.js:1086:20603)
at Function.<anonymous> (https://usr/app-service.js:1086:21402)

猜测

wx.onSocketOpen(()=>{
// 是不是一样的问题, 取了 null.method
})

相同位置还有一个报错

null is not an object (evaluating 't.method');at socketTask.onopen callback function
_buildWebsocketFrame@https://usr/app-service.js:1086:19964
internalSend@https://usr/app-service.js:1086:20623
https://usr/app-service.js:1086:21414
https://lib/WAService.js:1:101985
emit@https://lib/WAService.js:1:244006
https://lib/WAService.js:1:532917
https://lib/WAService.js:1:254330
S@https://lib/WAService.js:1:1769

很着急,一直在报警

一直忙,收不到结果

插件版本0.2.2
当网络或者操作频繁时,会报下面的异常,无法进行二次解析。
{retcode: -30011, msg: "please wait recognition finished"}
希望能提供强制取消识别的功能。

希望语音识别增加时间线返回

目前语音识别是实时返回,只返回了语音的内容,但是没有时间线,这样像歌词滚动播放这样的功能就无法实现,希望增加时间线的返回

语音合成问题

英语语音合成的时候报错:20001,中文合成语音正常,请问,英语是还没有开放嘛?那为什么面对面翻译这个demo能用呢?

录音解析报错

开发工具版本1.02.18.3210
基础调试库1.9.94
报错{retcode: -30009, msg: "server failed when create session message"}

引入插件后报错 “TypeError: buf.writeUInt8 is not a function”

你好
个人做的一个MQTT客户端小程序,一旦在app.json中引入插件后就报错
"plugins": { "WechatSI": { "version": "0.3.4", "provider": "wx069ba97219f66d99" } },


报错信息如下:

页面【pages/control/control]错误:
TypeError: buf.writeUInt8 is not a function
at mqtt.min.js? [sm]:1
at Array.map ()
at mqtt.min.js? [sm]:1
at Array.map ()
at mqtt.min.js? [sm]:1
at Array.map ()
at genHeader (mqtt.min.js? [sm]:1)
at Object.82.safe-buffer (mqtt.min.js? [sm]:1)
at o (mqtt.min.js? [sm]:1)
at mqtt.min.js? [sm]:1
(anonymous) @ VM66:48
doWhenAllScriptLoaded @ VM64:140
scriptLoaded @ VM64:160
(anonymous) @ VM64:185
Promise.then (async)
(anonymous) @ VM64:211
(anonymous) @ VM64:215
loadScripts @ assubloader.js:1
async function (async)
loadScripts @ assubloader.js:1
loadAppResourceScripts @ assubloader.js:1
(anonymous) @ VM59:1
t.loadScripts @ VM16 asdebug.js:1
loadAppService @ VM16 asdebug.js:1
messagerCallback @ VM16 asdebug.js:1
(anonymous) @ VM16 asdebug.js:1
f @ VM16 asdebug.js:1
g @ VM16 asdebug.js:1
(anonymous) @ VM16 asdebug.js:1
_ws.onmessage @ VM16 asdebug.js:1
VM66:49 Uncaught TypeError: buf.writeUInt8 is not a function
at mqtt.min.js? [sm]:1
at Array.map ()
at mqtt.min.js? [sm]:1
at Array.map ()
at mqtt.min.js? [sm]:1
at Array.map ()
at genHeader (mqtt.min.js? [sm]:1)
at Object.82.safe-buffer (mqtt.min.js? [sm]:1)
at o (mqtt.min.js? [sm]:1)
at mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
genHeader @ mqtt.min.js? [sm]:1
82.safe-buffer @ mqtt.min.js? [sm]:1
o @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
88../constants @ mqtt.min.js? [sm]:1
o @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
84../generate @ mqtt.min.js? [sm]:1
o @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
1../store @ mqtt.min.js? [sm]:1
o @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
9.../client @ mqtt.min.js? [sm]:1
o @ mqtt.min.js? [sm]:1
r @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
(anonymous) @ mqtt.min.js? [sm]:1
require @ WAService.js:1
(anonymous) @ WAService.js:1
(anonymous) @ control.js? [sm]:4
require @ WAService.js:1
(anonymous) @ VM66:45
doWhenAllScriptLoaded @ VM64:140
scriptLoaded @ VM64:160
(anonymous) @ VM64:185
Promise.then (async)
(anonymous) @ VM64:211
(anonymous) @ VM64:215
loadScripts @ assubloader.js:1
async function (async)
loadScripts @ assubloader.js:1
loadAppResourceScripts @ assubloader.js:1
(anonymous) @ VM59:1
t.loadScripts @ VM16 asdebug.js:1
loadAppService @ VM16 asdebug.js:1
messagerCallback @ VM16 asdebug.js:1
(anonymous) @ VM16 asdebug.js:1
f @ VM16 asdebug.js:1
g @ VM16 asdebug.js:1
(anonymous) @ VM16 asdebug.js:1
_ws.onmessage @ VM16 asdebug.js:1
Show 2 more frames
WAService.js:1 Page "pages/device/device" has not been registered yet.

困扰很久 请问有什么排查建议吗?

谢谢

语音识别反馈速度问题

我在微信原生的“语音输入”中发现说话后反馈的及时性非常好,大概0.3秒左右改变一下识别内容。但是我发现在插件的反馈速度 和 及时性大概是1秒左右。能否调整反馈速度 或者 提供一些解决方案的建议。谢谢!

搜索不到

在设置=>第三方设置=>插件管理=>添加插件搜索不到怎么回事?

在 result-bubble 组件中,防止冒泡事件的写法是不是有问题

在 result-bubble 组件中

<view class="play-icon" catchtap="playTranslateVoice" cattouchstart="playTranslateVoice" wx:if="{{recordStatus == 2}}">
        <play-icon play-type="{{playType}}"></play-icon>
      </view>

cattouchstart="playTranslateVoice" 不是应该是 catchtouchstart="playTranslateVoice" 这样的写法阻止触摸触发 playTranslateVoice 的事件向上冒泡吗?

同声传译插件的英语语音合成发音问题

plugin.textToSpeech({
lang: "en_US",
tts: true,
content: 'like',

以上代码是在合成like的发音,正常应该为lai四声ke轻声,我多次反复尝试后发现都是读成「立刻」。不知道有什么办法纠错不?

安卓机型录音时报错30010

你好,我们现在需求是语音转文字,进入小程序时会让用户授权获取用户信息,第一次点击录音时会让用户授权录音功能,小程序接口在远程调试中可以正常运行,发布到线上使用安卓手机测试点击录音时会报30010错误(苹果手机目前未发现问题)。
我想问一下'30010发送鉴权请求失败'应该怎么理解,或者失败的原因有可能是什么。谢谢🙏。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.