MCPcopy Index your code
hub / github.com/abb128/LiveCaptions

github.com/abb128/LiveCaptions @v0.4.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.2 ↗ · + Follow
256 symbols 410 edges 29 files 26 documented · 10% updated 16mo agov0.4.2 · 2024-06-08★ 1,76271 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Live Captions

Screenshot of the application

Live Captions is an application that provides live captioning for the Linux desktop.

<a href='https://flathub.org/apps/details/net.sapples.LiveCaptions'>
    <img width='240' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-en.png'/>
</a>

Join the Discord Chat if you're interested in keeping in touch.

Only the English language is supported currently. Other languages may produce gibberish or a bad phonetic translation.

Features: * Simple interface * Caption desktop/mic audio locally, audio is never sent anywhere * Does not rely on any proprietary services/libraries * Adjust font, font size, and text casing * Optional token-level confidence text fading

Running this requires a somewhat-decent CPU that can perform realtime captioning, especially if you want to be doing other tasks (such as video decode) while running Live Captions. It has been tested working on: * Intel i7-2670QM (2011) * Intel i7-7820HQ (2017) * Intel i5-8265U (2018) * AMD Ryzen 5 1600 (2017) * Steam Deck

GPU is not required or used.

Accuracy

The live captions may not be accurate. It may make mistakes, including when it comes to numbers. Please do not rely on the results for anything critical or important.

More models may be trained and released in the future with better and more robust accuracy.

Library

This application is built using aprilasr, a new library for realtime speech recognition.

Model credit

Thanks to Fangjun Kuang for the pretrained model, and thanks to the icefall contributors for creating the model recipes.

Building

You must make sure to do a recursive clone to get dependencies:

$ git clone --recursive https://github.com/abb128/LiveCaptions.git

If you forgot, you can initialize submodules like so:

$ git submodule update --init --recursive

Option 1: Building with GNOME Builder (easy)

You can build this easily with GNOME Builder. After cloning, open the project directory in GNOME Builder, download the SDK if it asks you, and click the play button to build and run.

If you are using Flatpak GNOME Builder and experience issues running this (for example, some cryptic X Window System error), please try using your distro's native packaged version of GNOME Builder instead of Flatpak (e.g. sudo apt install gnome-builder).

Option 2: Building from the terminal (not as easy)

First you must download ONNXRuntime v1.14.1 (Linux) or ONNXRuntime v.1.14.1 (Mac OS x86), extract it somewhere, and set the environment variables to point to it.

Make ONNX available

Linux:

$ export ONNX_ROOT=/path/to/onnxruntime-linux-x64-1.14.1/
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/onnxruntime-linux-x64-1.14.1/lib

Alternatively you should also be able to locally build and install ONNXRuntime, in which case that step shouldn't be necessary.

Mac OS:

$ export ONNX_ROOT=/path/to/onnxruntime-osx-x86_64-1.14.1/
$ cp /path/to/onnxruntime-osx-x86_64-1.14.1/lib/libonnxruntime.1.14.1.dylib /usr/local/lib/libonnxruntime.1.14.1.dylib
$ cp /path/to/onnxruntime-osx-x86_64-1.14.1/lib/libonnxruntime.dylib /usr/local/lib/libonnxruntime.dylib

Other dependencies

You will also need the following prerequisites:

pulseaudio
libadwaita
meson
ninja

If you're on macOS, you may have to run the following command for Pulseaudio to be registered as a background service:

brew services restart pulseaudio

and to stop it, just change restart for stop.

Set up the build

To set up a build, run these commands:

$ meson setup builddir
$ meson devenv -C builddir

Build and run

Now you can build the application by running ninja.

Before being able to run the app, you must also download the model and export APRIL_MODEL_PATH to where the model is. For example:

$ wget https://april.sapples.net/april-english-dev-01110_en.april
$ export APRIL_MODEL_PATH=`pwd`/april-english-dev-01110_en.april

You should now be able to run the app with src/livecaptions

If you're on MacOS, now, go to security settings and confirm the prompt which asks to allow libonnxruntime, then, the application should work as intended.

Core symbols most depended-on inside this repo

asr_thread_update_model
called by 6
src/asrproc.c
token_capitalizer_next
called by 4
src/line-gen.c
asr_thread_pause
called by 3
src/asrproc.c
add_text
called by 3
src/livecaptions-history-window.c
load_to
called by 3
src/livecaptions-history-window.c
set_window_keep_above
called by 3
src/window-helper.c
asr_thread_enqueue_audio
called by 2
src/asrproc.c
asr_thread_set_text_stream_active
called by 2
src/asrproc.c

Shape

Function 194
Class 60
Enum 2

Languages

C88%
C++12%

Modules by API surface

src/dbus-interface.c55 symbols
src/livecaptions-history-window.c19 symbols
src/livecaptions-settings.c18 symbols
src/livecaptions-application.c18 symbols
src/history.c17 symbols
src/asrproc.c17 symbols
src/audiocap-pw.c16 symbols
src/line-gen.c15 symbols
src/livecaptions-welcome.c14 symbols
src/livecaptions-window.c12 symbols
src/audiocap-pa.c9 symbols
src/dbus-interface.h8 symbols

For agents

$ claude mcp add LiveCaptions \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact