Proprietary pure-C Whisper and Parakeet-TDT speech recognition, multi-speaker streaming ASR, and Silero Neural VAD library distributed via Bark.
Documentation
Manual Pages
libstigma
Minimal, backend-agnostic pure-C Automatic Speech Recognition (ASR), multi-speaker streaming runtime, Silero Neural VAD, and GGML hardware discovery library.
libstigma encapsulates whisper.cpp (Whisper, Parakeet-TDT, Silero VAD, and GGML GPU/CPU backends) behind stable C headers (<ttypt/stigma.h>, <ttypt/stigma_stream.h>) and a shared library (libstigma.so / libstigma.dylib / libstigma.dll), plus a matching WASM32 static archive (libstigma-wasm.a) and browser host module (stigma-cap.js), so consumers never link GGML/Vulkan/CUDA/Metal or vendor whisper.cpp directly.
Features
- Unified ASR lifecycle: file and in-memory buffer loading via
stigma_open,stigma_open_backend,stigma_open_buffer,stigma_open_backend_buffer,stigma_transcribe, andstigma_close. - Multi-backend auto-detection: supports Whisper GGML models and NVIDIA Parakeet-TDT models (
STIGMA_BACKEND_AUTO,STIGMA_BACKEND_WHISPER,STIGMA_BACKEND_PARAKEET). - Decoding controls: word-level timestamps (
stigma_word_t), abort callbacks (stigma_abort_fn), hallucination rejection filters (stigma_reject_fn), single-segment partials, beam search, prompt bias, andno_speech_prob/ token-probability gating. - Multi-speaker streaming ASR (
<ttypt/stigma_stream.h>): 16 kHz RMS-VAD utterance chunker (stigma_chunker_*), Latin-1 UTF-8 hallucination filter (stigma_is_junk/stigma_is_junk_with), prompt-echo stripper (stigma_drop_prompt), Whisper repetition loop cutter (stigma_cut_loops), duration-proportionalmax_tokenscapping, and async streaming runtime (stigma_stream_*) serving local microphone and up toSTIGMA_MAX_SPEAKERSwatched remote speakers on a single shared model, with structuredstigma_stream_state_tlifecycle callbacks,stigma_stream_queue_seconds, andstigma_stream_has_gpu. - Browser WASM32 & JS capability adapter: compiles
wasm/stigma_wasm.c+src/stigma_chunker.cintolibstigma-wasm.a, paired with zero-dependencyjs/stigma-cap.js(createStigmaHost,createStigmaAsrWorker, built-in 16 kHz AudioWorklet tap, WebGPU/WASM Whisper worker, opt-inpartsUrlchunked model loading) andtools/vendor-model.mjsfor bundling ONNX Whisper assets. - Streaming Silero Neural VAD:
stigma_vad_open/stigma_vad_process/stigma_vad_reset/stigma_vad_close. - Hardware tier discovery:
stigma_hw_probereports the active GGML backend (CUDA,Metal,Vulkan, orCPU), device description, and tier (STIGMA_HW_CPU,STIGMA_HW_IGPU,STIGMA_HW_FAST_GPU).
Quick Example
#include <stdio.h>
#include <ttypt/stigma.h>
int main(void) {
stigma_ctx_t *ctx = stigma_open("/path/to/ggml-model.bin", true);
if (!ctx) return 1;
stigma_req_t req = {
.pcm = samples, /* 16 kHz mono float32 in [-1, 1] */
.n_samples = n_samples,
.sample_rate = STIGMA_SAMPLE_RATE,
.lang = "auto",
};
char text[4096];
stigma_res_t res = { .text = text, .text_cap = sizeof(text) };
if (stigma_transcribe(ctx, &req, &res) == 0 && !res.all_silent) {
printf("[%s] %s\n", res.detected_lang, res.text);
}
stigma_close(ctx);
return 0;
}
In-Memory Model Loading
For RAM-only weight loading (e.g., models fetched over HTTP or embedded in memory), use stigma_open_buffer / stigma_open_backend_buffer:
stigma_ctx_t *ctx = stigma_open_buffer(model_bytes, model_len, true);
Streaming Multi-Speaker ASR
<ttypt/stigma_stream.h> provides an async streaming runtime that runs on a background pthread natively and delegates through libstigma-wasm.a + js/stigma-cap.js in the browser:
#include <ttypt/stigma_stream.h>
stigma_stream_cbs_t cbs = {
.on_state = on_state_cb, /* stigma_stream_state_t + progress_pct */
.on_speaker_text = on_speaker_text_cb, /* speaker_id ("" = local), text, ms */
};
stigma_stream_t *s = stigma_stream_create(&cbs, user);
stigma_stream_cfg_t cfg = {
.language = "en",
.model_path = "/path/to/ggml-large-v3-turbo-q5_0.bin",
.prompt = "Optional domain or dialect prompt",
};
stigma_stream_start(s, &cfg);
stigma_stream_watch_speaker(s, "peer-1", 1);
/* Feed 48 kHz or 16 kHz float32 audio and poll on the UI/event loop */
stigma_stream_push_pcm48k(s, local_pcm48k, n_frames);
stigma_stream_push_speaker_pcm48k(s, "peer-1", peer_pcm48k, n_frames);
stigma_stream_poll(s);
Browser WASM & Asset Vendoring
When clang-18 (or a wasm32-wasi clang via STIGMA_WASM_CC) is installed, make / make wasm-lib builds lib/libstigma-wasm.a. make install installs the WASM archive, stigma-cap.js, and vendor-model.mjs into ${PREFIX}/share/stigma/ and exposes their paths via pkg-config:
pkg-config --variable=wasm_lib stigma
pkg-config --variable=cap_js stigma
pkg-config --variable=vendor_script stigma
# Vendor ONNX Whisper weights (splitting >20 MiB files into .partN + models/parts.json)
node "$(pkg-config --variable=vendor_script stigma)" --out ./public onnx-community/whisper-large-v3-turbo q4,q4f16
In browser hosts, import createStigmaHost (and optionally createStigmaAsrWorker) from stigma-cap.js and pass host.imports into the WASM module's env import table.
Distribution & Bark SDK Integration
libstigma is distributed as a proprietary Bark-protected platform plugin (BARK_PLUGINS := stigma) inside the Bark SDK for authorized Bark publishers (BPL-1.0) and first-party tty.pt applications (BUL-1.0).
- Native & WASM32: Add
BARK_PLUGINS := stigmato your applicationMakefile(usinginclude ttypt/bark.mk) and#include <bark/stigma.h>โ the Bark runtime delivers the shared encrypted ASR runtime on desktop andstigma-cap.jsin the browser.
Build, Test & Install (Internal / Authorized Source Builds)
Builds use the shared libstele makefile rules (include ttypt/include.mk, or resolved via TTYPT_MK / pkg-config --variable=include_mk stele) and support Linux, macOS, OpenBSD, FreeBSD, NetBSD, DragonFly, Windows (MSYS2/MinGW), Android, and iOS.
git submodule update --init --recursive
# Auto-selects Metal (macOS), CUDA, Vulkan, or CPU+OpenBLAS
make
# Override backend explicitly: auto | vulkan | cuda | metal | cpu
make STIGMA_BACKEND=cpu
# Build WASM32 streaming adapter explicitly
make wasm-lib
# Run standalone unit tests (HW probe, Whisper, Parakeet, Silero VAD, streaming chunker)
make test
# Remove build artifacts (use distclean to also remove whisper.cpp CMake build dirs)
make clean
make distclean
# Install to user prefix (~/.local) or system prefix (/usr)
make PREFIX="$HOME/.local" install
Link via pkg-config:
cc app.c $(pkg-config --cflags --libs stigma) -o app
License
Proprietary โ Bark Usage Licence (BUL-1.0) (and BPL-1.0 when consumed as a Bark platform plugin). See LICENSE, THIRD_PARTY_NOTICES, and https://tty.pt/licences.