『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: sasukebinbin

[新奇玩法] 更新: TTS教程 -DIY WiFi音响 - TTS,播放Mp3,成品样样都要有

  [复制链接]

80

主题

388

帖子

1680

积分

金牌会员

Rank: 6Rank: 6

积分
1680
金钱
1292
HASS币
0
发表于 2022-4-10 23:45:02 | 显示全部楼层
获取 tts

[
    {
        "id": "1c893a2.860cac6",
        "type": "tab",
        "label": "tts",
        "disabled": false,
        "info": ""
    },
    {
        "id": "f3e70c14.b85b7",
        "type": "http request",
        "z": "1c893a2.860cac6",
        "name": "Post TTS ",
        "method": "POST",
        "ret": "obj",
        "paytoqs": "query",
        "url": "http://192.168.1.2:8123/api/tts_get_url",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "bearer",
        "senderr": false,
        "x": 700,
        "y": 380,
        "wires": [
            [
                "2ce1858.4ed177a",
                "23f0804377564bc6"
            ]
        ]
    },
    {
        "id": "ac8fe3a0.fc39b",
        "type": "inject",
        "z": "1c893a2.860cac6",
        "name": "",
        "props": [
            {
                "p": "payload",
                "v": "",
                "vt": "date"
            },
            {
                "p": "topic",
                "v": "",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 320,
        "wires": [
            [
                "85e920ac.9be84"
            ]
        ]
    },
    {
        "id": "85e920ac.9be84",
        "type": "function",
        "z": "1c893a2.860cac6",
        "name": "google TTS setting",
        "func": "msg.headers = {};\nmsg.headers={\n    'Content-Type': 'application/json'\n};\nmsg.payload = {\n    "message": '当前光猫温度为: ' + msg.payload + '摄氏度',\n    "platform": "google_translate",\n    "language": "zh-CN"\n};\n\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 380,
        "wires": [
            [
                "f3e70c14.b85b7"
            ]
        ]
    },
    {
        "id": "2ce1858.4ed177a",
        "type": "function",
        "z": "1c893a2.860cac6",
        "name": "Get media path",
        "func": "\nmsg.headers={\n    'Content-Type': 'application/json'\n};\n\nmsg.payload = msg.payload.url;\n\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 880,
        "y": 380,
        "wires": [
            [
                "f0401e4e4132c326",
                "07da12be0285394b"
            ]
        ]
    },
    {
        "id": "23f0804377564bc6",
        "type": "debug",
        "z": "1c893a2.860cac6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 870,
        "y": 440,
        "wires": []
    },
    {
        "id": "f0401e4e4132c326",
        "type": "debug",
        "z": "1c893a2.860cac6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 320,
        "wires": []
    },
    {
        "id": "07da12be0285394b",
        "type": "mqtt out",
        "z": "1c893a2.860cac6",
        "name": "",
        "topic": "mrdiynotifier/play",
        "qos": "1",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "8a1c1b60.7c6f78",
        "x": 1130,
        "y": 380,
        "wires": []
    },
    {
        "id": "8724d3986b246ba8",
        "type": "server-state-changed",
        "z": "1c893a2.860cac6",
        "name": "pon temperature",
        "server": "e8349c19021c66e6",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.pon_temp",
        "entityidfiltertype": "substring",
        "outputinitially": false,
        "state_type": "num",
        "haltifstate": "",
        "halt_if_type": "num",
        "halt_if_compare": "gte",
        "outputs": 1,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "seconds",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "x": 280,
        "y": 380,
        "wires": [
            [
                "85e920ac.9be84"
            ]
        ]
    },
    {
        "id": "8a1c1b60.7c6f78",
        "type": "mqtt-broker",
        "name": "Mosquitto",
        "broker": "192.168.1.2",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "e8349c19021c66e6",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": false,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": true,
        "heartbeatInterval": "30"
    }
]
回复

使用道具 举报

80

主题

388

帖子

1680

积分

金牌会员

Rank: 6Rank: 6

积分
1680
金钱
1292
HASS币
0
发表于 2022-4-10 23:46:17 | 显示全部楼层
获取 tts

[
    {
        "id": "1c893a2.860cac6",
        "type": "tab",
        "label": "tts",
        "disabled": false,
        "info": ""
    },
    {
        "id": "f3e70c14.b85b7",
        "type": "http request",
        "z": "1c893a2.860cac6",
        "name": "Post TTS ",
        "method": "POST",
        "ret": "obj",
        "paytoqs": "query",
        "url": "http://192.168.1.2:8123/api/tts_get_url",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "bearer",
        "senderr": false,
        "x": 700,
        "y": 380,
        "wires": [
            [
                "2ce1858.4ed177a",
                "23f0804377564bc6"
            ]
        ]
    },
    {
        "id": "ac8fe3a0.fc39b",
        "type": "inject",
        "z": "1c893a2.860cac6",
        "name": "",
        "props": [
            {
                "p": "payload",
                "v": "",
                "vt": "date"
            },
            {
                "p": "topic",
                "v": "",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 320,
        "wires": [
            [
                "85e920ac.9be84"
            ]
        ]
    },
    {
        "id": "85e920ac.9be84",
        "type": "function",
        "z": "1c893a2.860cac6",
        "name": "google TTS setting",
        "func": "msg.headers = {};\nmsg.headers={\n    'Content-Type': 'application/json'\n};\nmsg.payload = {\n    "message": '当前光猫温度为: ' + msg.payload + '摄氏度',\n    "platform": "google_translate",\n    "language": "zh-CN"\n};\n\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 380,
        "wires": [
            [
                "f3e70c14.b85b7"
            ]
        ]
    },
    {
        "id": "2ce1858.4ed177a",
        "type": "function",
        "z": "1c893a2.860cac6",
        "name": "Get media path",
        "func": "\nmsg.headers={\n    'Content-Type': 'application/json'\n};\n\nmsg.payload = msg.payload.url;\n\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 880,
        "y": 380,
        "wires": [
            [
                "f0401e4e4132c326",
                "07da12be0285394b"
            ]
        ]
    },
    {
        "id": "23f0804377564bc6",
        "type": "debug",
        "z": "1c893a2.860cac6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 870,
        "y": 440,
        "wires": []
    },
    {
        "id": "f0401e4e4132c326",
        "type": "debug",
        "z": "1c893a2.860cac6",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 320,
        "wires": []
    },
    {
        "id": "07da12be0285394b",
        "type": "mqtt out",
        "z": "1c893a2.860cac6",
        "name": "",
        "topic": "mrdiynotifier/play",
        "qos": "1",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "8a1c1b60.7c6f78",
        "x": 1130,
        "y": 380,
        "wires": []
    },
    {
        "id": "8724d3986b246ba8",
        "type": "server-state-changed",
        "z": "1c893a2.860cac6",
        "name": "pon temperature",
        "server": "e8349c19021c66e6",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.pon_temp",
        "entityidfiltertype": "substring",
        "outputinitially": false,
        "state_type": "num",
        "haltifstate": "",
        "halt_if_type": "num",
        "halt_if_compare": "gte",
        "outputs": 1,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "seconds",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            }
        ],
        "x": 280,
        "y": 380,
        "wires": [
            [
                "85e920ac.9be84"
            ]
        ]
    },
    {
        "id": "8a1c1b60.7c6f78",
        "type": "mqtt-broker",
        "name": "Mosquitto",
        "broker": "192.168.1.2",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "e8349c19021c66e6",
        "type": "server",
        "name": "Home Assistant",
        "version": 2,
        "addon": false,
        "rejectUnauthorizedCerts": false,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": true,
        "heartbeatInterval": "30"
    }
]


回复

使用道具 举报

3

主题

21

帖子

90

积分

注册会员

Rank: 2

积分
90
金钱
69
HASS币
0
发表于 2022-4-21 11:56:21 | 显示全部楼层
THANK'S,學習中,謝謝
回复

使用道具 举报

0

主题

27

帖子

141

积分

注册会员

Rank: 2

积分
141
金钱
114
HASS币
0
发表于 2022-4-22 21:33:08 | 显示全部楼层
万分感谢,正需要
回复

使用道具 举报

0

主题

53

帖子

1061

积分

金牌会员

Rank: 6Rank: 6

积分
1061
金钱
1008
HASS币
0
发表于 2022-4-22 22:00:43 | 显示全部楼层
谢谢分享
回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
发表于 2022-4-30 01:36:12 | 显示全部楼层
我看看,好不好玩
回复

使用道具 举报

18

主题

218

帖子

1847

积分

论坛技术达人

积分
1847
金钱
1629
HASS币
10
发表于 2022-5-13 20:11:18 | 显示全部楼层
不知道楼主在播放mp3的时候有没有一些杂音,我的怎么都有杂音
回复

使用道具 举报

18

主题

218

帖子

1847

积分

论坛技术达人

积分
1847
金钱
1629
HASS币
10
发表于 2022-5-20 19:47:12 | 显示全部楼层
我也同样这样做了  不过我在播放的时候会有杂音。不知道楼主的怎么样
回复

使用道具 举报

25

主题

640

帖子

2913

积分

金牌会员

Rank: 6Rank: 6

积分
2913
金钱
2263
HASS币
40
 楼主| 发表于 2022-5-22 00:17:14 | 显示全部楼层
有杂音的问题原因很多,我也有遇到过,一般重启下路由器就能解决. 8266的网络性能实在是弱.
经过一段时间的折腾,打算不同这个方案了, 听音乐还是用智能音响算了, HomePod mini, GoogleHome都不错.
如果只是TTS,为了省钱的话,这个方案还算可行.
回复

使用道具 举报

0

主题

38

帖子

282

积分

中级会员

Rank: 3Rank: 3

积分
282
金钱
244
HASS币
0
发表于 2022-5-22 13:34:47 | 显示全部楼层

有点意思
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2025-1-4 15:10 , Processed in 0.131705 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表