Skip to content

Latest commit

 

History

History
276 lines (224 loc) · 15.6 KB

README.md

File metadata and controls

276 lines (224 loc) · 15.6 KB

snowlearner

A pixel-art frost mage lives on your desktop and slowly freezes your screen — right over whatever you're working on. Snow piles up, then frost creeps in from the edges. The only way to win your screen back: speak the language you're learning. Every answer you get right melts some of it; ignore him and it only gets worse.

overlay mode: the frost mage over a code editor, a lesson, the fire mage melts the ice

curl -fsSL https://raw.githubusercontent.com/AxeForging/snowlearner/main/install.sh | sh

That's it: it installs, downloads the offline speech model and registers the shortcuts. Then open Snowlearner from your app menu (or run snowlearner). More in Install.

  • 🧙 The frost mage patrols the bottom of the screen throwing ice, calls icicle rain, and summons snowmen and penguins that burst frost onto the screen edges; once the snow is deep, an ice owl flies over dropping snowballs. He asks the questions — and taunts you.
  • 🔥 Start a lesson and your fire mage teleports in. Answer out loud; get it right and a fireball melts part of the ice. Every phrase comes short, complete and polished: the fuller your answer, the bigger the spell and the more it melts. Three in a row call the sun, six a comet that lands on the frost mage and leaves little fire people dashing to the snow, arms flailing, melting it as they run.
  • ⚔️ A warrior tries to survive: builds fogueiras, sword-fights frost slimes and bats, gives you tips (false friends, pronunciation traps), slides down steep snow piles — and freezes solid if you ignore him.
  • 🌎 Speak Portuguese or English: pick My language in the panel and everything — texts, meanings, situations, the voice reading them — follows. Portuguese speakers learn English or Spanish; English speakers learn Spanish or Brazilian Portuguese.
  • 🪜 You start from zero: first single words (hello, water, thanks), then short expressions (good morning, the check please), and only then full phrases — pre-A1 (no English at all) to B2. A few new items at a time; learning one opens the next, and it tells you so.
  • 🗣️ Everything is a real situation (meetings, travel, restaurant, doctor, phone, small talk…), and you tick the topics you want in the panel (Enter on any option lists them all, with how many items each topic has at your level): new items you hear and repeat, known ones you say from memory. Missed ones come back until you get them. Answers are checked by how they sound (Spanish poyo is pollo, accents never matter), and a slip of a letter or two doesn't count against you; a longer answer counts only when the word the lesson teaches is in it.
  • 📈 Progress (Ctrl+Alt+P): what you already know, what you're learning now and what comes next, per stage and per topic.
  • 🎙️ It listens like a patient teacher: thinking time before you start, room to hesitate mid-sentence, a live mic meter, and your hotkey to say "done".
  • 🔊 Voices: your OS's own, or Kokoro / any OpenAI-compatible TTS server, or any command (Piper…). Pick mics, speakers and voices — and test them — in the panel.
  • 🌀 A magic orb sits in a corner: click to practice, Ctrl+click for the panel, right-click to pause — everything gets sucked into a black hole until you're back.
  • ✋ Hold Ctrl+Alt (or snowlearner grab) and a magic hand lets you pick the mage (grumpy) or the warrior (shy) up and drop them in the snow.
  • 🖥️ Every monitor gets its own snow; the mage and the lesson stay on the main one.
  • 🌙 At the end of the day it shows and reads back everything you practiced.
A lesson (window mode) Icicle rain, summons, mobs Deep snow: ice owl, sliding
lesson fight ice owl
Six in a row: the comet and its fire people Pause = black hole
comet black hole

No cloud, no LLM required: recognition is whisper.cpp running offline. A Whisper server you run, or Groq's cloud with your own key, can do it instead (stt_engine, below); only then does your answers' audio leave the machine. No GPU needed: everything is drawn on the CPU and blitted to the window, redrawing only what changed. About 2–3% of one CPU core and ~30 MB RAM while running (release build; the speech model adds ~150 MB during a lesson and is freed 2 minutes after).

Install

Linux (x86_64) and macOS (Apple Silicon):

curl -fsSL https://raw.githubusercontent.com/AxeForging/snowlearner/main/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/AxeForging/snowlearner/main/install.sh | sh -s -- --lang es   # Spanish
curl -fsSL https://raw.githubusercontent.com/AxeForging/snowlearner/main/install.sh | sh -s -- --native en --lang pt-BR   # English speaker, Portuguese

Windows (PowerShell):

irm https://raw.githubusercontent.com/AxeForging/snowlearner/main/install.ps1 | iex

The installer downloads the latest release, checks its SHA-256, puts snowlearner in ~/.local/bin (Windows: your user programs + PATH + Start menu) and runs snowlearner setup, which is safe to run again any time:

  • writes the config (--lang en|es|pt-BR, --native pt-BR|en), downloads the ~142 MB offline speech model (--no-model skips it),
  • registers the shortcuts on GNOME, adds Snowlearner to the app menu (Linux).

Then start it from the app menu or with snowlearner. snowlearner doctor tells you what works on your machine and how to fix the rest; started from the menu, the app logs to snowlearner.log (snowlearner config path). Linux needs a voice installed for the app to talk (speech-dispatcher or espeak-ng, present on most desktops). No GPU required.

From source: cargo install --git https://github.com/AxeForging/snowlearner, then snowlearner setup. Build dependencies: Rust ≥ 1.85, CMake and a C/C++ compiler (for whisper.cpp). Linux also needs ALSA and libclang headers (dnf install alsa-lib-devel clang-devel / apt install libasound2-dev libclang-dev) and, at runtime, speech-dispatcher or espeak-ng. On Windows set the two variables below before building, or whisper.cpp is compiled without optimization and recognition takes about five times longer (the released binaries are built with them):

$env:CMAKE_C_FLAGS_RELEASE = "-MD -O2 -Ob2 -DNDEBUG"
$env:CMAKE_CXX_FLAGS_RELEASE = "-MD -O2 -Ob2 -DNDEBUG"

A build inside the repository also turns on whisper.cpp's faster matrix code (GGML_LLAMAFILE, .cargo/config.toml); cargo install --git does not read that file, so set GGML_LLAMAFILE=ON yourself before it ($env:GGML_LLAMAFILE = "ON" on Windows).

Feature flags: stt (default: mic + recognition), audio (devices + playback only), gpu (default: only used for see-through windows on native Wayland/macOS), none (hotkey confirms your answer, CPU-only drawing). SNOWLEARNER_RENDERER=cpu|gpu forces one.

Use

Action Hotkey / mouse Command
Practice a phrase · "I'm done talking" · next Ctrl+Alt+M · click the orb snowlearner say
Control panel (game, audio, keys, progress tabs) Ctrl+Alt+K · Ctrl+click the orb snowlearner menu
Your progress: known · learning · next Ctrl+Alt+P snowlearner progress (--print in the terminal)
Magic hand (15 s) hold Ctrl+Alt · Ctrl+Alt+G snowlearner grab
Pause (black hole) / resume right-click the orb · P snowlearner pause
Today's recap Ctrl+Alt+J · S snowlearner summary
Shortcut cheat sheet hover the orb · hold Ctrl+Alt —
Quit — snowlearner quit

A hotkey another program already uses (NVIDIA's overlay takes Ctrl+Alt+M, for one) does nothing: the app says so at startup and marks it (in use) in the panel's keys tab, where each hotkey can be moved to a free key. The change applies at once, and every on-screen hint follows it.

Window mode extras: H help, 1–4 commitment, L switch language, click characters to poke them.

Commitment level (compromisso): chill | steady | committed | relentless — how often the mage attacks, summons and nudges you, and how much each answer melts (12–25%).

Audio & voices

snowlearner audio mics            # list microphones (* = configured)
snowlearner audio speakers
snowlearner audio test-mic        # live meter, then shows what the recognizer heard
snowlearner model bench           # how long recognition takes on this machine (no mic needed)
snowlearner voices list --lang pt-BR
snowlearner voices test --lang en --voice af_heart

Or open the panel's ÁUDIO tab: microphone, Testar microfone, voice engine, Endereço (TTS server, e.g. 192.168.0.10:8880), pt-BR voice, target-language voice, Testar vozes, speaker. Changes apply live and are saved.

Voice engines (tts_engine):

engine what config
system OS voices: spd-say/espeak-ng, macOS say, Windows SAPI —
http any OpenAI-compatible server, e.g. Kokoro-FastAPI — natural pt-BR/en/es voices tts_url = "http://localhost:8880/v1", tts_model = "kokoro"
command anything else: {text} {lang} {voice} {out} placeholders, run without a shell tts_command = "piper --model pt_BR.onnx --output_file {out}"

New engines implement one trait (speech::voices::SpeechEngine: describe / available / voices / speak) and get device choice, playback, the panel pickers and the CLI for free.

Recognition (stt_engine): who turns your answer into text.

engine what config
local (default) whisper.cpp inside the app, offline: nothing leaves the machine model = "base"
openai a Whisper server with the OpenAI-compatible API: POST {stt_url}/audio/transcriptions stt_url = "http://192.168.0.10:9000/v1", stt_model = "" (server default)
asr Whisper ASR Webservice's own API: POST {stt_url}/asr stt_url = "http://192.168.0.10:9000"
groq Groq's cloud, whisper-large-v3-turbo, free plan available stt_key = "gsk_…" (from console.groq.com/keys)

With openai or asr, each answer's audio is sent to stt_url (plain HTTP on your network unless the URL is https), and to nowhere else. The local model is then neither needed nor loaded. The panel's Reconhecimento and Servidor rows set it; typing an address that ends in /v1 picks openai, any other picks asr. snowlearner doctor says whether the server answers, and snowlearner audio test-mic tries it. A server that is down, slower than 30 s or answering an error ends the turn like a failed recognition: you confirm the answer yourself, and the reason goes to snowlearner.log.

With groq, each answer's audio goes to Groq's servers (api.groq.com, over HTTPS), under Groq's terms. Pick Groq (nuvem) in Reconhecimento: the Chave field opens; paste your key (Ctrl+V) and press Enter, and the panel says at once whether Groq takes it. The key is saved in plain text in the config file, like the other settings, and is shown only as gsk_…1a2b on screen, in the log and in snowlearner doctor. A refused key or a reached limit (HTTP 429) is said in your language and the lesson goes on by self-confirmation. Groq's model is fixed; stt_model is only for your own openai server. stt_key is also sent, as a Bearer token, to an openai server that needs one.

How listening works: the mic ignores the first 250 ms (echo of the voice), gives you 6 s to start (10 s when recalling from memory — listen_seconds tunes it), calibrates on the quietest moments, lets you pause ~1.8 s mid-phrase until you've said roughly what's expected, and caps the turn relative to when you started. Stock whisper hallucinations ("Thank you for watching") count as silence.

Platforms

Windows macOS Linux X11 Linux Wayland
Default display transparent overlay transparent overlay transparent overlay window (--mode overlay runs through XWayland)
Global hotkeys ✓ ✓ ✓ snowlearner setup registers them (GNOME), or bind snowlearner say/menu/summary/grab/progress
Hold Ctrl+Alt (cheat sheet, hand) ✓ ✓ ✓ hover the orb / Ctrl+Alt+G
Voice (system) SAPI via PowerShell say spd-say / espeak-ng same
Recognition whisper.cpp whisper.cpp whisper.cpp whisper.cpp

Tested hands-on on Fedora 42 (GNOME Wayland) and Windows 11; macOS binaries are built by the release workflow on every v* tag (CI itself runs on Linux: gh workflow run ci).

Configure

Everything is editable live in the panel; it's saved to config.toml (snowlearner config path):

learning = "en"          # "en", "es" or "pt-BR" built in, or your own decks/<name>.toml
native = "pt-BR"         # your own language: "pt-BR" or "en" (never the one you learn)
commitment = "steady"    # chill | steady | committed | relentless
practice = "auto"        # auto | repeat | recall
topics = []              # [] = all, or e.g. ["trabalho", "viagem"] (old `topic = "x"` still works)
max_level = "B2"         # PRE-A1 | A1..C2
daily_goal = 10
listen_seconds = 6.0     # time to start answering (recall gets +4)
mic = ""                 # "" = system default (see `snowlearner audio mics`)
speaker = ""
tts_engine = "system"    # system | http | command
stt_engine = "local"     # local | openai | asr (a Whisper server at stt_url) | groq (see Audio & voices)
stt_key = ""             # API key for groq (or an openai server that needs one)
voice_native = ""        # "" = automatic
voice_learning = ""
mode = "auto"            # auto | window | overlay
summary_time = "21:00"
model = "base"           # tiny | base | small
keep_recordings = false  # true = keep your last 20 answers as WAV (see below)

keep_recordings is for diagnosing what the speech model heard. Each answer it transcribes is saved to recordings/ in the folder of snowlearner.log, exactly as the model got it, and only the newest 20 are kept. They are your voice: nothing sends them anywhere. Replay one with snowlearner model bench --wav <file>. Set it back to false and delete the folder when done.

Your own phrases

Drop a deck at <config>/decks/en.toml (it overrides the built-in one):

language = "en"
native = "pt-BR"
language_name = "inglês"
title = "Trabalho"

[[tip]]
text = "Falso amigo: 'actually' é 'na verdade'."

[[phrase]]
topic = "trabalho"
level = "B1"
situation = "Você quer marcar uma reunião com o time."
say = "Let's schedule a meeting"
accept = ["Let's set up a meeting"]
meaning = "Vamos marcar uma reunião"
tip = "Schedule: 'skédjul' no americano."

The built-in decks combine hand-written phrases, the first words and expressions (decks/<lang>.basics.toml) and the Lexicaster curriculum (node scripts/port-lexicaster.mjs ../learn-lang-game regenerates decks/*.lexicaster.toml).

Develop

make test               # unit + binary tests
make test-speech        # real speech recognition end-to-end (needs model + espeak-ng)
make lint               # rustfmt --check + clippy -D warnings (all feature sets)
gh workflow run release --ref <branch>  # build the three OS archives as artifacts, without publishing
scripts/render-docs.sh  # re-render the README clips (animated WebP) from the real scene

See CLAUDE.md for layout and conventions and docs/specs for specs.