无法使用带有节点红的IBM Watsown语音到文本将电报语音消息转码

时间:2019-01-22 10:32:21

标签: telegram ibm-watson speech-to-text node-red

尝试从Telegram语音消息中抄录音频,但是我从沃森的语音到文本节点出现“无法转码数据流音频/操作->音频/ x-float-array”错误。

我正在Raspberry上使用Node-Red,通过node-red-contrib-telegrambot和node-red-node-watson来简单地转录Telegram语音消息中的音频。

对于文本消息,我的代码具有魅力。 使用语音消息,我从沃森的语音到文本节点出现“无法对数据流音频/操作->音频/ x浮动数组进行代码转换”错误。

node-red flow images 我没有足够的声誉来发布图片:(

JSON流导出

[
    {
        "id": "b4106ec1.63dd58",
        "type": "tab",
        "label": "Telegram",
        "disabled": false,
        "info": ""
    },
    {
        "id": "d1198164.e38f68",
        "type": "telegram receiver",
        "z": "b4106ec1.63dd58",
        "name": "FMWatsonBot",
        "bot": "5f347711.7876d8",
        "saveDataDir": "",
        "x": 110,
        "y": 100,
        "wires": [
            [
                "f4b4ab25.5dde18",
                "f5d126df.5b6928"
            ],
            []
        ]
    },
    {
        "id": "c6ec445d.0840d8",
        "type": "telegram sender",
        "z": "b4106ec1.63dd58",
        "name": "Send2Telegram",
        "bot": "5f347711.7876d8",
        "x": 780,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "f4b4ab25.5dde18",
        "type": "debug",
        "z": "b4106ec1.63dd58",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 290,
        "y": 60,
        "wires": []
    },
    {
        "id": "f5d126df.5b6928",
        "type": "function",
        "z": "b4106ec1.63dd58",
        "name": "Save chat context",
        "func": "msg.chatId = msg.payload.chatId;\nmsg.type = msg.payload.type;\nmsg.content = msg.payload.content;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 230,
        "y": 160,
        "wires": [
            [
                "c3d1a92d.227568"
            ]
        ]
    },
    {
        "id": "276cfad7.cef62e",
        "type": "function",
        "z": "b4106ec1.63dd58",
        "name": "Set Chat Context",
        "func": "msg.payload = {\n  chatId : msg.chatId,\n  topic : msg.type,\n  type : \"message\",\n  content : msg.payload};\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "x": 730,
        "y": 220,
        "wires": [
            [
                "c6ec445d.0840d8"
            ]
        ]
    },
    {
        "id": "c3d1a92d.227568",
        "type": "switch",
        "z": "b4106ec1.63dd58",
        "name": "Check msg type",
        "property": "type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "message",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "voice",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 300,
        "y": 240,
        "wires": [
            [
                "e8452a44.f967c8"
            ],
            [
                "6aea6224.578d8c"
            ],
            []
        ]
    },
    {
        "id": "e8452a44.f967c8",
        "type": "function",
        "z": "b4106ec1.63dd58",
        "name": "Echo message",
        "func": "msg.payload = {\n  chatId : msg.chatId,\n  topic : \"Text Echo\",\n  type : msg.type,\n  content : msg.content};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 540,
        "y": 80,
        "wires": [
            [
                "c6ec445d.0840d8"
            ]
        ]
    },
    {
        "id": "6aea6224.578d8c",
        "type": "change",
        "z": "b4106ec1.63dd58",
        "name": "Set voice URL",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.weblink",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 440,
        "y": 300,
        "wires": [
            [
                "fc7b1590.557c"
            ]
        ]
    },
    {
        "id": "493d1bac.216d3c",
        "type": "change",
        "z": "b4106ec1.63dd58",
        "name": "Set transcription",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "transcription",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 680,
        "y": 300,
        "wires": [
            [
                "276cfad7.cef62e"
            ]
        ]
    },
    {
        "id": "fc7b1590.557c",
        "type": "watson-speech-to-text",
        "z": "b4106ec1.63dd58",
        "name": "S2T",
        "alternatives": 1,
        "speakerlabels": false,
        "smartformatting": false,
        "lang": "en-GB",
        "langhidden": "en-GB",
        "langcustom": "NoCustomisationSetting",
        "langcustomhidden": "",
        "custom-weight": "0.5",
        "band": "BroadbandModel",
        "bandhidden": "BroadbandModel",
        "keywords": "",
        "keywords-threshold": "0.5",
        "word-confidence": false,
        "password": "",
        "apikey": "#########CHANGED VALUE TO POST###########",
        "payload-response": false,
        "streaming-mode": false,
        "streaming-mute": true,
        "auto-connect": false,
        "discard-listening": false,
        "disable-precheck": false,
        "default-endpoint": true,
        "service-endpoint": "https://stream.watsonplatform.net/speech-to-text/api",
        "x": 530,
        "y": 360,
        "wires": [
            [
                "493d1bac.216d3c"
            ]
        ]
    },
    {
        "id": "5f347711.7876d8",
        "type": "telegram bot",
        "z": "",
        "botname": "FMWatsonBot",
        "usernames": "",
        "chatids": "",
        "baseapiurl": "",
        "updatemode": "polling",
        "pollinterval": "300",
        "bothost": "",
        "localbotport": "8443",
        "publicbotport": "8443",
        "privatekey": "",
        "certificate": "",
        "verboselogging": false
    }
]

有任何提示吗? 提前致谢 费鲁乔

2 个答案:

答案 0 :(得分:0)

它归结为您如何从Telegram获取音频。检查此相关问题的答案-https://developer.ibm.com/answers/questions/424777/help-how-do-i-use-speech-to-text-with-my-telegram/ 该示例显示了如何构建网址以发送到语音到文本节点。

答案 1 :(得分:0)

更新:Flow与电报节点v4.4.0完全兼容,但对于新版本5.1.5失败。

因此,关于“语音转文本”节点不是问题。