{"slug": "aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts", "title": "ให้ AI พูดภาษาไทยได้ด้วย Garudust Agent + iApp TTS", "summary": "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.", "body_md": "ถ้าคุณใช้ Garudust Agent อยู่แล้ว การเพิ่มความสามารถให้ AI **พูดภาษาไทยออกมาเป็นเสียง** ทำได้ในไม่กี่ขั้นตอน — ไม่ต้องแก้โค้ดใด ๆ เพราะ Garudust มีระบบ script tool ที่ pluggable อยู่แล้ว\n\n## TTS คืออะไร และทำไมต้อง iApp\n\n**TTS (Text-to-Speech)** คือการแปลงข้อความเป็นเสียงพูด เหมาะกับ use case เช่น\n\n- ตอบกลับผู้ใช้ด้วยเสียงแทนข้อความบน LINE / Telegram\n- สร้างไฟล์เสียงสำหรับ podcast / narration อัตโนมัติ\n- Accessibility — ผู้ใช้ที่อ่านหน้าจอยาก\n\n**iApp Technology** เป็นบริษัทไทยที่มี TTS API รองรับภาษาไทยโดยเฉพาะ เสียงฟังเป็นธรรมชาติ รองรับสูงสุด 10,000 ตัวอักษรต่อ request คิดค่าใช้จ่าย 1 IC ต่อ 400 ตัวอักษร สมัครได้ที่ [iapp.co.th](https://iapp.co.th)\n\n## ขั้นตอนที่ 1 — ติดตั้ง tts tool จาก Hub\n\nGarudust มี Hub รวม script tool ให้ install ได้ทันที\n\n```\ngarudust tool install tts\n```\n\nระบบจะดึง `tool.yaml`\n\nและ `run.py`\n\nมาไว้ที่ `~/.garudust/tools/tts/`\n\nและ register ใน registry อัตโนมัติ\n\n## ขั้นตอนที่ 2 — เพิ่ม Provider Profile ใน config.yaml\n\nGarudust ใช้ระบบ **provider profile** จัดการ API endpoint และ key — ไม่ต้อง hardcode ใน script\n\nเปิด `~/.garudust/config.yaml`\n\nแล้วเพิ่ม:\n\n```\nproviders:\n  # ... providers ที่มีอยู่แล้ว ...\n  tts-iapp:\n    url: https://api.iapp.co.th/v3/store/audio/tts\n    key: ${IAPP_API_KEY}\n\ntools:\n  tts:\n    model: tts-iapp   # ชี้ไปที่ profile ข้างบน\n```\n\nGarudust จะ inject\n\n`GARUDUST_BASE_URL`\n\nและ`GARUDUST_API_KEY`\n\nเข้า script อัตโนมัติตอน runtime\n\n## ขั้นตอนที่ 3 — เพิ่ม API Key ใน .env\n\n```\n# ~/.garudust/.env\nIAPP_API_KEY=iapp_live_xxxxxxxxxxxxxxxx\n```\n\nรับ key ได้จาก [iapp.co.th/dashboard](https://iapp.co.th/dashboard)\n\n## ทดสอบผ่าน CLI\n\n```\ngarudust \"ใช้ tts tool แปลงข้อความว่า สวัสดีครับ ผมคือ Garudust ผู้ช่วย AI ของคุณ แล้วบอก path ไฟล์ที่ได้\"\n```\n\nผลลัพธ์:\n\n```\nสร้างไฟล์เสียงสำเร็จ\nเสียงอยู่ที่: /tmp/tts_88b5bba372dd41a7acc7e37ea75df89b.wav\n```\n\nเปิดฟัง:\n\n```\nopen /tmp/tts_88b5bba372dd41a7acc7e37ea75df89b.wav\n```\n\n## เบื้องหลัง — run.py ทำงานยังไง\n\niApp TTS API คืน **raw PCM** มาโดยไม่มี WAV header ดังนั้น `run.py`\n\nจัดการ wrap header ให้เอง:\n\n``` python\ndef pcm_to_wav(pcm: bytes, sample_rate: int = 24000, channels: int = 1, bits: int = 16) -> bytes:\n    byte_rate   = sample_rate * channels * bits // 8\n    block_align = channels * bits // 8\n    data_size   = len(pcm)\n    header = struct.pack(\n        \"<4sI4s4sIHHIIHH4sI\",\n        b\"RIFF\", 36 + data_size, b\"WAVE\",\n        b\"fmt \", 16,\n        1, channels, sample_rate, byte_rate, block_align, bits,\n        b\"data\", data_size,\n    )\n    return header + pcm\n```\n\nผลที่ได้คือ **RIFF WAV 16-bit mono 24kHz** — เปิดได้กับทุก audio player\n\n## เปลี่ยน Provider ได้ทันทีโดยไม่แตะโค้ด\n\nนี่คือจุดแข็งของ Garudust provider profile — ถ้าอยากลอง provider อื่นเช่น AIS หรือ local model แค่เพิ่ม profile และเปลี่ยน `tools.tts.model`\n\nบรรทัดเดียว:\n\n```\nproviders:\n  tts-ais:\n    url: https://your-ais-tts-endpoint/api/tts\n    key: ${AIS_TTS_API_KEY}\n\ntools:\n  tts:\n    model: tts-ais   # เปลี่ยนแค่นี้\n```\n\n`run.py`\n\nไม่ต้องแตะเลย เพราะอ่าน `GARUDUST_BASE_URL`\n\nและ `GARUDUST_API_KEY`\n\nจาก profile เสมอ\n\n## ขั้นต่อไปที่ทำได้\n\n-\n**LINE voice message**— เพิ่ม`OutboundMessage::Audio`\n\nใน Garudust core แล้วส่งไฟล์ WAV เป็น voice message บน LINE ได้เลย -\n**Auto TTS reply**— สั่งให้ agent เรียก`tts`\n\nทุกครั้งที่ตอบ โดย inject ใน system prompt -\n**Speaker selection**— iApp มีหลายเสียง ตั้ง`TTS_SPEAKER_ID`\n\nใน`.env`\n\nเพื่อเลือกเสียงที่ชอบ\n\n## สรุป\n\n| ขั้นตอน | คำสั่ง |\n|---|---|\n| ติดตั้ง tool | `garudust tool install tts` |\n| เพิ่ม profile | แก้ `config.yaml`\n|\n| เพิ่ม key | แก้ `~/.garudust/.env`\n|\n| ใช้งาน | สั่ง agent พูดภาษาไทย |\n\nGarudust Agent เป็น open source ที่ [github.com/garudust-org/garudust-agent](https://github.com/garudust-org/garudust-agent) — ติดตามหรือ contribute ได้เลย 🦅", "url": "https://wpnews.pro/news/aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts", "canonical_source": "https://dev.to/garudust/aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts-35n2", "published_at": "2026-05-19 02:29:43+00:00", "updated_at": "2026-05-19 03:05:08.595614+00:00", "lang": "en", "topics": ["artificial-intelligence", "developer-tools", "products"], "entities": ["Garudust Agent", "iApp TTS", "iApp Technology", "Garudust"], "alternates": {"html": "https://wpnews.pro/news/aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts", "markdown": "https://wpnews.pro/news/aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts.md", "text": "https://wpnews.pro/news/aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts.txt", "jsonld": "https://wpnews.pro/news/aih-ai-phuudphaasaaaithyaiddwy-garudust-agent-iapp-tts.jsonld"}}