Test Scripts

May 22, 2026 ยท View on GitHub

Fast automated tests live under tests/unit/ and are documented in testing.md. This page explains the Python scripts directly under tests/. Most of them are demos, manual checks, regression harnesses, or legacy experiments rather than maintained unit tests.

Run scripts from the repository root so relative imports and model paths work.

Maintained Regression And Benchmark Harnesses

ScriptCategoryPurpose
tests/final_transcription_gap_regression.pyRegression harnessStreams a WAV file while AudioToTextRecorder.text() runs in parallel to reproduce slow final-transcription gaps. Can generate expected JSON and compare CPU output.
tests/realtime_transcription_count_comparison.pyManual integration benchmarkCompares timer-based realtime transcription with syllable-boundary scheduling on deterministic WAV input. Reports realtime model-call counts and validates final text.
tests/realtime_boundary_detector_live_test.pyManual detector checkLightweight live check for the realtime boundary detector.
tests/realtime_boundary_detector_microphone.pyManual detector visualizerMicrophone visualizer for syllable/speech boundary detection. Useful when tuning boundary sensitivity.

These are useful during recorder and realtime scheduling work, but they are not the default fast unit test suite.

Core RealtimeSTT Demos

ScriptCategoryPurpose
tests/simple_test.pyMinimal demoSmallest microphone transcription smoke script.
tests/realtimestt_test.pyFull interactive demoRich console demo with realtime transcription, final text, and optional keyboard typing.
tests/realtimestt_test_whispercpp.pyEngine demowhisper.cpp version of the interactive demo with CPU profiles.
tests/realtimestt_omnilingual_test.pyEngine smoke/demoLinux/WSL2 Omnilingual ASR script with deterministic file smoke, init-only check, and interactive microphone mode.
tests/feed_audio.pyExternal-audio demoOpens a PyAudio stream manually and feeds chunks through feed_audio() with use_microphone=False.
tests/openwakeword_test.pyWake word demoOpenWakeWord demo using local sample wake word models in the tests/ folder.
tests/realtime_loop_test.pyRealtime demoExercises realtime transcription in a loop.
tests/realtimestt_chinese.pyLanguage demoDemonstrates Chinese transcription settings.
tests/vad_test.pyVAD demoManual VAD behavior check.

Use these when developing locally with a microphone and real models. They may load models, use optional packages, write to the keyboard, or require audio device permissions.

Application Experiments

ScriptCategoryPurpose
tests/advanced_talk.pyAssistant demoCombines RealtimeSTT with RealtimeTTS and LLM calls. Requires API keys and TTS dependencies.
tests/minimalistic_talkbot.pyAssistant demoSmall talkbot example using speech input and generated responses.
tests/openai_voice_interface.pyAssistant demoVoice interface experiment using OpenAI-compatible client setup.
tests/translator.pyTranslation demoSpeech translation workflow experiment.
tests/type_into_textbox.pyUtility demoTypes recognized text into the focused text box.
tests/recorder_client.pyClient demoUses the packaged recorder client/server path.

Treat these as examples, not correctness tests. Check credentials, local model servers, and package imports before running them.

Speech Endpoint And Hotkey Experiments

ScriptCategoryPurpose
tests/realtimestt_speechendpoint.pyLegacy/manual experimentExperiments with speech endpoint detection and display behavior.
tests/realtimestt_speechendpoint_binary_classified.pyLegacy/manual experimentVariant of the speech endpoint experiment with binary classification logic.
tests/realtimestt_test_hotkeys_v2.pyManual UI/hotkey demoRich console and hotkey workflow for dictation-style usage.
tests/realtimestt_test_stereomix.pyManual audio-device demoTests stereo mix/system audio input behavior.

These scripts may be useful as reference material, but behavior is less stable than the unit tests and maintained regression harnesses.

Helpers And Data

FileCategoryPurpose
tests/install_packages.pyHelperPrompts or installs demo dependencies used by older scripts. Avoid it in automated test runs.
tests/samanta.tfliteData/modelOpenWakeWord model artifact used by demos.
tests/suh_mahn_thuh.onnxData/modelOpenWakeWord model artifact used by openwakeword_test.py.
tests/suh_man_tuh.onnxData/modelOpenWakeWord model artifact used by openwakeword_test.py.
tests/README.mdLegacy noteShort OpenWakeWord test note.
tests/__init__.pyPackage markerLets unit tests import from tests.

Running The Maintained Scripts

Final transcription gap regression:

python tests/final_transcription_gap_regression.py --mode both

Realtime scheduling comparison:

python tests/realtime_transcription_count_comparison.py --mode both

whisper.cpp interactive demo:

python -m pip install "RealtimeSTT[whisper-cpp]" rich pyautogui colorama
python tests/realtimestt_test_whispercpp.py --profile balanced

Boundary detector microphone visualizer:

python tests/realtime_boundary_detector_microphone.py --sensitivity 0.6

Safety Notes

  • Scripts with pyautogui, keyboard, or hotkey support can type into the active application.
  • Scripts using real engines may download large models or require CUDA.
  • Microphone scripts require OS audio permissions.
  • Assistant demos can call local or hosted LLM/TTS services depending on their configuration.