# Tuyaos/mic

> TuyaOS microphone capture via tkl_ai_* + optional file write (tkl_fs). 麦克风、录音、tkl_ai、采集音频。

- Skill: `tuya/tuyaos-mic` (Agent Skill)
- Install (CLI): `npx skillmds@latest add tuya/tuyaos-mic`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tuya/tuyaos-mic/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tuya (https://skillmd.com/u/tuya)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tuya/tuyaos-mic

---


# TuyaOS Mic / Recorder (`tkl_ai`)

**Demo:** `…/examples/driver_mic/example_recorder.c` (+ `wav_encode.*`)

## Key APIs

| Function | Role |
|----------|------|
| `tkl_ai_init` / `tkl_ai_start` / `tkl_ai_set_vol` | capture path |
| `tkl_ao_set_vol` / `tkl_ao_put_frame` | playback path if looping |
| `tkl_fs_mount` / `tkl_fopen` / `tkl_fwrite` / … | save WAV/PCM |
| `tkl_system_psram_malloc` / `_free` | large buffers |
| `tkl_gpio_*` | optional trigger pin |

## Guidance

1. Open the demo and copy the `TKL_AUDIO` config struct fields for this SDK.
2. Confirm sample rate / channels / trigger GPIO with the user.
3. PSRAM may be required on T5-class chips — follow demo allocators.
4. This is **not** TuyaOpen `tdl_audio_*`.

