闲社服务运行正常AI智能体自动化平台
s

天气语音播报

技能标识:senseaudio-weather-broadcast

Fetch weather data and generate a spoken weather broadcast using SenseAudio TTS.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.0
检测标记
后台标记通过
免费
免费获取
0
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

天气语音播报

Weather Broadcast / 天气播报

Fetch real-time weather data and generate a natural-sounding weather broadcast audio using SenseAudio TTS.

获取实时天气数据,并使用 SenseAudio TTS 生成自然流畅的天气播报音频。

Quick Start / 快速开始

1. Get Weather + Generate Broadcast / 获取天气并生成播报

bash

Set your API key / 设置 API 密钥


export SENSEAUDIOAPIKEY=yourapikey

Fetch weather and generate broadcast for Beijing / 获取北京天气并生成播报

CITY=Beijing WEATHER=$(curl -s wttr.in/${CITY}?format=%l:+%c+%t+%h+%w&lang=zh)

Generate broadcast text / 生成播报文本

BROADCAST_TEXT=天气播报:${WEATHER}。祝您出行愉快!

Call SenseAudio TTS / 调用 SenseAudio TTS

curl -X POST https://api.senseaudio.cn/v1/t2a_v2 \ -H Authorization: Bearer $SENSEAUDIOAPIKEY \ -H Content-Type: application/json \ -d { \model\: \SenseAudio-TTS-1.0\, \text\: \$BROADCAST_TEXT\, \stream\: false, \voice_setting\: { \voiceid\: \male0004_a\, \speed\: 0.95 }, \audio_setting\: { \format\: \mp3\, \sample_rate\: 32000 } } -o response.json

Extract and save audio / 提取并保存音频

jq -r .data.audio response.json | xxd -r -p > weather_broadcast.mp3

Weather Data Sources / 天气数据源

wttr.in (Primary / 主要)

Free weather service, no API key required. / 免费天气服务,无需 API 密钥。

bash

Quick one-liner / 快速查询


curl -s wttr.in/Shanghai?format=3

Output: Shanghai: ⛅️ +18°C

Detailed format / 详细格式

curl -s wttr.in/Shanghai?format=%l:+%c+%t+%h+%w

Output: Shanghai: ⛅️ +18°C 65% ↙12km/h

Chinese output / 中文输出

curl -s wttr.in/上海?lang=zh&format=3

Format codes / 格式代码:

  • - %c condition / 天气状况
  • %t temperature / 温度
  • %h humidity / 湿度
  • %w wind / 风速
  • %l location / 地点
  • %m moon phase / 月相

Options / 选项:

  • - ?lang=zh Chinese / 中文
  • ?m metric / 公制
  • ?1 today only / 仅今天
  • ?0 current only / 仅当前

Open-Meteo (Fallback / 备用)

Free JSON API for programmatic use. / 免费 JSON API,适合程序化使用。

bash

Get coordinates first, then query / 先获取坐标,再查询


Beijing: 39.9, 116.4


curl -s https://api.open-meteo.com/v1/forecast?latitude=39.9&longitude=116.4¤t_weather=true

Complete Python Example / 完整 Python 示例

python
import requests
import os

SENSEAUDIOAPIKEY = os.environ.get(SENSEAUDIOAPIKEY)
TTSURL = https://api.senseaudio.cn/v1/t2av2

def get_weather(city: str, lang: str = zh) -> str:
Fetch weather from wttr.in / 从 wttr.in 获取天气
url = fhttps://wttr.in/{city}?format=%l:+%c+%t+%h+%w&lang={lang}
resp = requests.get(url, timeout=10)
return resp.text.strip()

def generatebroadcasttext(weather: str, lang: str = zh) -> str:
Generate broadcast script / 生成播报文本
if lang == zh:
return f天气播报:{weather}。请根据天气情况合理安排出行,祝您生活愉快!
else:
return fWeather report: {weather}. Please plan your day accordingly. Have a great day!

def texttospeech(text: str, outputfile: str = weatherbroadcast.mp3, voiceid: str = male0004_a):
Convert text to speech using SenseAudio TTS / 使用 SenseAudio TTS 转换文本为语音
headers = {
Authorization: fBearer {SENSEAUDIOAPIKEY},
Content-Type: application/json
}
payload = {
model: SenseAudio-TTS-1.0,
text: text,
stream: False,
voice_setting: {
voiceid: voiceid,
speed: 0.95,
vol: 1.0,
pitch: 0
},
audio_setting: {
format: mp3,
sample_rate: 32000
}
}

resp = requests.post(TTS_URL, json=payload, headers=headers, timeout=30)
result = resp.json()

if result.get(data) and result[data].get(audio):
audio_bytes = bytes.fromhex(result[data][audio])
with open(output_file, wb) as f:
f.write(audio_bytes)
print(fAudio saved: {output_file})
print(fDuration: {result[extrainfo][audiolength]}ms)
return output_file
else:
raise Exception(fTTS failed: {result.get(baseresp, {}).get(statusmsg, Unknown error)})

def weatherbroadcast(city: str, outputfile: str = weather_broadcast.mp3, lang: str = zh):
Main function: fetch weather and generate broadcast / 主函数:获取天气并生成播报
print(fFetching weather for {city}...)
weather = get_weather(city, lang)
print(fWeather: {weather})

broadcasttext = generatebroadcast_text(weather, lang)
print(fBroadcast text: {broadcast_text})

print(Generating audio...)
return texttospeech(broadcasttext, outputfile)

if name == main:
# Example usage / 示例用法
weatherbroadcast(Beijing, beijingweather.mp3, zh)
# weatherbroadcast(London, londonweather.mp3, en)

Voice Options / 音色选项

Voice IDDescription / 描述Style / 风格
male0004aWarm male / 温暖男声News anchor / 新闻主播
female0001a
Sweet female / 甜美女声 | Friendly / 亲切 |

See SenseAudio Voice List for all available voices.

查看 SenseAudio 音色列表 获取所有可用音色。

TTS Parameters / TTS 参数

Parameter / 参数Type / 类型Default / 默认Range / 范围Description / 描述
speedfloat1.00.5-2.0Speech rate / 语速
vol
float | 1.0 | 0-10 | Volume / 音量 | | pitch | int | 0 | -12 to 12 | Pitch adjustment / 音调 |

Audio Output / 音频输出

Format / 格式Sample Rate / 采样率Use Case / 适用场景
mp332000General use / 通用
wav
48000 | High quality / 高品质 | | pcm | 16000 | IoT devices / 物联网设备 |

Tips / 提示

  1. 1. Use to add pauses in broadcast / 使用 在播报中添加停顿
  2. Set speed: 0.95 for clearer broadcast / 设置 speed: 0.95 使播报更清晰
  3. URL-encode city names with spaces: New+York / 城市名有空格时需 URL 编码
  4. Use ?lang=

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 weather-broadcast-1776075363 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 weather-broadcast-1776075363 技能

通过命令行安装

skillhub install weather-broadcast-1776075363

下载

⬇ 下载 senseaudio-weather-broadcast v1.0.0(免费)

文件大小: 4.04 KB | 发布时间: 2026-4-15 14:54

v1.0.0 最新 2026-4-15 14:54
- Initial release: fetches real-time weather data and generates spoken weather broadcasts using SenseAudio TTS.
- Supports wttr.in (primary) and Open-Meteo (fallback) as weather data sources.
- Provides bash and Python examples for fetching weather, generating broadcast text, and converting it to audio.
- Includes customizable TTS parameters (voice, speed, volume, pitch) and output audio formats (mp3, wav, pcm).
- Documentation covers usage, voice/style options, parameter settings, tips, and error handling.
返回顶部