首页 > 解决方案 > 无法使用带有 Node-Red 的 IBM Watsown Speech to Text 对电报语音消息进行转码

问题描述

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

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

使用短信,我的代码就像一个魅力。使用语音消息时,我从 watson 的语音到文本节点出现“无法转码数据流音频/作品 -> 音频/x-float-array”错误。

节点红色流图像 我没有足够的声誉点来发布图像:(

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
    }
]

有什么提示吗?在此先感谢费鲁乔

标签: telegramibm-watsonspeech-to-textnode-red

解决方案


更新:Flow 与电报节点 v4.4.0 完美配合,但新版本 5.1.5 失败

因此,对于 Speech to Text 节点,这不是问题。


推荐阅读