ให้ 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. ถ้าคุณใช้ 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 https://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: ... 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 ~/.garudust/.env IAPP API KEY=iapp live xxxxxxxxxxxxxxxx รับ key ได้จาก iapp.co.th/dashboard https://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 ให้เอง: python 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 https://github.com/garudust-org/garudust-agent — ติดตามหรือ contribute ได้เลย 🦅