Automatische vertaling · Engels origineel

Aan de slag gaan met Linux

speech-core bevat een C API voor embedded Linux platforms (automotief, Yocto, randapparatuur) onder examples/linux/. Zelfde C++ pijplijnmotor die Android aanstuurt, zich richt ARM64 en x86_64. ONNX Runtime wordt automatisch opgehaald door het setup-script.

Vereisten

Instellen

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 Voorbeeld

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

Stel voor Yocto-cross-compilatie ORT_DIR in op de installatie ONNX Runtime en gebruik het juiste CMake gereedschapschainbestand.

Broncode: github.com/soniqo/speech-core/tree/main/examples/linux

Volgende stappen