Traducere automată · Originalul în engleză

Noţiuni de bază început Linux

speech-core include un C API pentru platformele integrate Linux (automotive, Yocto, dispozitive de margine) sub examples/linux/. Acelaşi motor de conductă C++ care are puteri Android, care vizează ARM64 și x86_64. ONNX Runtime este preluat automat de scriptul de configurare.

Cerințe

Configurare

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

# Optional — run the integration tests against real models
scripts/download_models.sh
SPEECH_MODEL_DIR=scripts/models ctest --test-dir build --output-on-failure

C API Exemplu

#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);
Important

Pentru Yocto cross-compilation, set ORT_DIR to your sysroot's ONNX Runtime install and use the potrivable CMake toolchain file.

Codul sursă: github.com/soniqo/speech-core/tree/main/exemplu/linux

Următoarele etape