시작하기 — Linux
speech-android는 임베디드 Linux 플랫폼(자동차, Yocto, 엣지 디바이스)을 위한 C API를 포함합니다. ARM64와 x86_64를 타겟으로 하며, Android와 동일한 speech-core 파이프라인을 사용합니다.
요구사항
- ARM64 또는 x86_64 Linux
- ONNX Runtime
설정
git clone --recursive https://github.com/soniqo/speech-android.git
cd speech-android/linux
./setup_linux.sh
cmake -B build -DORT_DIR=../ort-linux
cmake --build build
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을 sysroot의 ONNX Runtime 설치 경로로 설정하고 적절한 CMake 툴체인 파일을 사용하세요.
소스 코드: github.com/soniqo/speech-android/tree/main/linux
다음 단계
- Android 시작하기 — Android SDK 설정
- 벤치마크 — Android/Linux 추론 성능