はじめに — Linux

speech-androidには、embedded Linuxプラットフォーム(自動車、Yocto、エッジデバイス)向けのC APIが含まれています。Androidと同じspeech-coreパイプラインで、ARM64とx86_64をターゲットにしています。

動作要件

セットアップ

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

次のステップ