cd /news/artificial-intelligence/aih-ai-phuudphaasaaaithyaiddwy-garud… · home topics artificial-intelligence article
[ARTICLE · art-666] src=dev.to pub= topic=artificial-intelligence verified=true sentiment=↑ positive

ให้ AI พูดภาษาไทยได้ด้วย Garudust Agent + iApp TTS

To enable Thai text-to-speech (TTS) for the Garudust AI agent using iApp Technology's TTS API, requiring no code changes due to Garudust's pluggable script tool system. Users can install the TTS tool via a single command, configure the API endpoint and key in a provider profile, and then have the AI speak Thai naturally, with the system automatically handling audio format conversion. The setup also allows easy switching between different TTS providers, such as AIS or local models, by simply changing the provider profile.

read2 min views10 publishedMay 19, 2026

ถ้าคุณใช้ 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

ระบบจะดึง 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:
  tts-iapp:
    url: https://api.iapp.co.th/v3/store/audio/tts
    key: ${IAPP_API_KEY}

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

Garudust จะ inject

GARUDUST_BASE_URL

และGARUDUST_API_KEY

เข้า script อัตโนมัติตอน runtime

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

IAPP_API_KEY=iapp_live_xxxxxxxxxxxxxxxx

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

ทดสอบผ่าน CLI #

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

ผลลัพธ์:

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

เปิดฟัง:

open /tmp/tts_88b5bba372dd41a7acc7e37ea75df89b.wav

เบื้องหลัง — 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

ผลที่ได้คือ 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   # เปลี่ยนแค่นี้

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 ได้เลย 🦅

── more in #artificial-intelligence 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/aih-ai-phuudphaasaaa…] indexed:0 read:2min 2026-05-19 ·