เริ่มต้น — Linux
speech-core มี C API สำหรับแพลตฟอร์ม Linux แบบฝังตัว (ยานยนต์, Yocto, อุปกรณ์ edge) อยู่ใน examples/linux/ ใช้ engine ไปป์ไลน์ C++ ตัวเดียวกับที่ขับเคลื่อน Android รองรับ ARM64 และ x86_64 ONNX Runtime จะถูกดึงมาอัตโนมัติโดยสคริปต์ติดตั้ง
ข้อกำหนด
- Linux ARM64 หรือ x86_64
- cmake 3.16+, build-essential
- libasound2-dev (สำหรับเดโม ALSA — ไม่บังคับ)
การติดตั้ง
git clone https://github.com/soniqo/speech-core.git
cd speech-core
./examples/linux/setup_linux.sh
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DSPEECH_CORE_WITH_ONNX=ON \
-DSPEECH_CORE_BUILD_EXAMPLES=ON \
-DORT_DIR=ort-linux
cmake --build build
# ไม่บังคับ — รันการทดสอบ integration กับโมเดลจริง
scripts/download_models.sh
SPEECH_MODEL_DIR=scripts/models ctest --test-dir build --output-on-failure
ตัวอย่าง C API
#include <speech.h>
void on_event(const speech_event_t* event, void* ctx) {
if (event->type == SPEECH_EVENT_TRANSCRIPTION)
printf("%s\n", event->text);
}
speech_config_t cfg = speech_config_default();
cfg.model_dir = "/opt/speech/models";
speech_pipeline_t p = speech_create(cfg, on_event, NULL);
speech_start(p);
speech_push_audio(p, samples, 512);
สำคัญ
สำหรับการคอมไพล์ข้ามด้วย Yocto ให้ตั้งค่า ORT_DIR ให้ชี้ไปยังการติดตั้ง ONNX Runtime ใน sysroot ของคุณ และใช้ไฟล์ toolchain ของ CMake ที่เหมาะสม
ซอร์สโค้ด: github.com/soniqo/speech-core/tree/main/examples/linux
ขั้นตอนถัดไป
- เริ่มต้น Android — การติดตั้ง SDK ของ Android
- Benchmarks — ประสิทธิภาพการ inference บน Android/Linux