惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
MyScale Blog
MyScale Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
N
Netflix TechBlog - Medium
MongoDB | Blog
MongoDB | Blog
I
InfoQ
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
H
Help Net Security

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
ให้ AI พูดภาษาไทยได้ด้วย Garudust Agent + iApp TTS
Garudust · 2026-05-19 · via DEV Community
Cover image for ให้ AI พูดภาษาไทยได้ด้วย Garudust Agent + iApp TTS

Garudust

ถ้าคุณใช้ Garudust Agent อยู่แล้ว การเพิ่มความสามารถให้ AI พูดภาษาไทยออกมาเป็นเสียง ทำได้ในไม่กี่ขั้นตอน — ไม่ต้องแก้โค้ดใด ๆ เพราะ Garudust มีระบบ script tool ที่ pluggable อยู่แล้ว


TTS คืออะไร และทำไมต้อง iApp

TTS (Text-to-Speech) คือการแปลงข้อความเป็นเสียงพูด เหมาะกับ use case เช่น

  • ตอบกลับผู้ใช้ด้วยเสียงแทนข้อความบน LINE / Telegram
  • สร้างไฟล์เสียงสำหรับ podcast / narration อัตโนมัติ
  • Accessibility — ผู้ใช้ที่อ่านหน้าจอยาก

iApp Technology เป็นบริษัทไทยที่มี TTS API รองรับภาษาไทยโดยเฉพาะ เสียงฟังเป็นธรรมชาติ รองรับสูงสุด 10,000 ตัวอักษรต่อ request คิดค่าใช้จ่าย 1 IC ต่อ 400 ตัวอักษร สมัครได้ที่ iapp.co.th


ขั้นตอนที่ 1 — ติดตั้ง tts tool จาก Hub

Garudust มี Hub รวม script tool ให้ install ได้ทันที

garudust tool install tts

Enter fullscreen mode Exit fullscreen mode

ระบบจะดึง tool.yaml และ run.py มาไว้ที่ ~/.garudust/tools/tts/ และ register ใน registry อัตโนมัติ


ขั้นตอนที่ 2 — เพิ่ม Provider Profile ใน config.yaml

Garudust ใช้ระบบ provider profile จัดการ API endpoint และ key — ไม่ต้อง hardcode ใน script

เปิด ~/.garudust/config.yaml แล้วเพิ่ม:

providers:
  # ... providers ที่มีอยู่แล้ว ...
  tts-iapp:
    url: https://api.iapp.co.th/v3/store/audio/tts
    key: ${IAPP_API_KEY}

tools:
  tts:
    model: tts-iapp   # ชี้ไปที่ profile ข้างบน

Enter fullscreen mode Exit fullscreen mode

Garudust จะ inject GARUDUST_BASE_URL และ GARUDUST_API_KEY เข้า script อัตโนมัติตอน runtime


ขั้นตอนที่ 3 — เพิ่ม API Key ใน .env

# ~/.garudust/.env
IAPP_API_KEY=iapp_live_xxxxxxxxxxxxxxxx

Enter fullscreen mode Exit fullscreen mode

รับ key ได้จาก iapp.co.th/dashboard


ทดสอบผ่าน CLI

garudust "ใช้ tts tool แปลงข้อความว่า สวัสดีครับ ผมคือ Garudust ผู้ช่วย AI ของคุณ แล้วบอก path ไฟล์ที่ได้"

Enter fullscreen mode Exit fullscreen mode

ผลลัพธ์:

สร้างไฟล์เสียงสำเร็จ
เสียงอยู่ที่: /tmp/tts_88b5bba372dd41a7acc7e37ea75df89b.wav

Enter fullscreen mode Exit fullscreen mode

เปิดฟัง:

open /tmp/tts_88b5bba372dd41a7acc7e37ea75df89b.wav

Enter fullscreen mode Exit fullscreen mode


เบื้องหลัง — run.py ทำงานยังไง

iApp TTS API คืน raw PCM มาโดยไม่มี WAV header ดังนั้น run.py จัดการ wrap header ให้เอง:

def pcm_to_wav(pcm: bytes, sample_rate: int = 24000, channels: int = 1, bits: int = 16) -> bytes:
    byte_rate   = sample_rate * channels * bits // 8
    block_align = channels * bits // 8
    data_size   = len(pcm)
    header = struct.pack(
        "<4sI4s4sIHHIIHH4sI",
        b"RIFF", 36 + data_size, b"WAVE",
        b"fmt ", 16,
        1, channels, sample_rate, byte_rate, block_align, bits,
        b"data", data_size,
    )
    return header + pcm

Enter fullscreen mode Exit fullscreen mode

ผลที่ได้คือ RIFF WAV 16-bit mono 24kHz — เปิดได้กับทุก audio player


เปลี่ยน Provider ได้ทันทีโดยไม่แตะโค้ด

นี่คือจุดแข็งของ Garudust provider profile — ถ้าอยากลอง provider อื่นเช่น AIS หรือ local model แค่เพิ่ม profile และเปลี่ยน tools.tts.model บรรทัดเดียว:

providers:
  tts-ais:
    url: https://your-ais-tts-endpoint/api/tts
    key: ${AIS_TTS_API_KEY}

tools:
  tts:
    model: tts-ais   # เปลี่ยนแค่นี้

Enter fullscreen mode Exit fullscreen mode

run.py ไม่ต้องแตะเลย เพราะอ่าน GARUDUST_BASE_URL และ GARUDUST_API_KEY จาก profile เสมอ


ขั้นต่อไปที่ทำได้

  • LINE voice message — เพิ่ม OutboundMessage::Audio ใน Garudust core แล้วส่งไฟล์ WAV เป็น voice message บน LINE ได้เลย
  • Auto TTS reply — สั่งให้ agent เรียก tts ทุกครั้งที่ตอบ โดย inject ใน system prompt
  • Speaker selection — iApp มีหลายเสียง ตั้ง TTS_SPEAKER_ID ใน .env เพื่อเลือกเสียงที่ชอบ

สรุป

ขั้นตอน คำสั่ง
ติดตั้ง tool garudust tool install tts
เพิ่ม profile แก้ config.yaml
เพิ่ม key แก้ ~/.garudust/.env
ใช้งาน สั่ง agent พูดภาษาไทย

Garudust Agent เป็น open source ที่ github.com/garudust-org/garudust-agent — ติดตามหรือ contribute ได้เลย 🦅