How to Change the Default ASR Engine in VoiceStudio
VoiceStudio uses pytorch-whisper as its default Automatic Speech Recognition (ASR) engine, and you can switch to a different backend by updating the asr_backend preference to another installed identifier such as "moonshine".
VoiceStudio is an open-source audio processing framework that supports pluggable ASR backends for transcription tasks. Understanding how the default engine is initialized—and how to override it—is critical for optimizing latency, accuracy, or hardware compatibility. This guide walks through identifying the active backend and switching it programmatically or via the UI, based on the VoiceStudio source code.
What Is the Default ASR Engine in VoiceStudio?
VoiceStudio ships with pytorch-whisper configured as the built-in default ASR backend. This default is enforced when no user-specific preference exists in the configuration store.
According to the test suite in tests/test_engines.py, the application asserts that asr_backend.active_backend_id() returns the string "pytorch-whisper" immediately after initialization, confirming this is the fallback identifier used before any custom overrides are applied.
How to Check the Current ASR Engine
To programmatically inspect which ASR backend is currently active, import the asr_backend service and query its identifier:
from services import asr_backend
current_id = asr_backend.active_backend_id()
print(current_id) # Output: pytorch-whisper
The active_backend_id() function reads the asr_backend key from the preferences store. If the key is absent, it returns the hard-coded default (pytorch-whisper).
How to Change the ASR Engine
You can switch ASR engines at runtime without restarting VoiceStudio. The preferences system updates the active backend reference immediately, and subsequent calls to the backend loader instantiate the new engine.
Via the Preferences API
The most direct method is to use the prefs module to set the asr_backend key to the identifier of your chosen engine. For example, to switch to the Moonshine backend:
from services import prefs
# Update the preference to Moonshine
prefs.set_("asr_backend", "moonshine")
# Verify the change
from services import asr_backend
print(asr_backend.active_backend_id()) # Output: moonshine
Once the preference is updated, calling asr_backend.get_active_asr_backend() will instantiate and return the class associated with the "moonshine" identifier rather than the default Whisper implementation.
Via the UI Settings
For non-programmatic configuration, open the Settings panel in the VoiceStudio interface. Locate the ASR Engine dropdown menu, which enumerates all installed backends by their string identifiers (e.g., pytorch-whisper, moonshine). Selecting a different option writes the new value to the preferences store automatically, taking effect for the next transcription job.
Where Configuration Is Stored
The asr_backend preference persists via the module located at services/prefs.py, which serializes user settings to a local JSON configuration file. This ensures your selected engine remains active across application restarts.
The backend registry itself is implemented in services/asr_backend.py. This module maintains a mapping between identifier strings (such as "pytorch-whisper" and "moonshine") and their corresponding Python classes. When get_active_asr_backend() is invoked, it consults the preference store, retrieves the current identifier, and returns an instantiated instance of the mapped class.
Summary
- VoiceStudio defaults to
pytorch-whisperas its ASR engine, validated by assertions intests/test_engines.py. - Query the current backend by calling
asr_backend.active_backend_id(), which checks theasr_backendpreference key. - Switch engines programmatically using
prefs.set_("asr_backend", "new_id")where"new_id"is the target backend string. - The registry in
services/asr_backend.pyhandles lazy instantiation of the correct class based on the active preference. - Changes are applied dynamically without requiring an application restart.
Frequently Asked Questions
What is the default ASR engine in VoiceStudio?
VoiceStudio uses pytorch-whisper as its default ASR engine. The test file tests/test_engines.py asserts that asr_backend.active_backend_id() returns "pytorch-whisper" when no user override is present in the preferences store.
How do I switch from Whisper to Moonshine in VoiceStudio?
Update the asr_backend preference via the prefs module. Execute prefs.set_("asr_backend", "moonshine") in your Python environment. The subsequent call to asr_backend.get_active_asr_backend() will instantiate the Moonshine engine class instead of the default Whisper implementation.
Do I need to restart VoiceStudio after changing the ASR engine?
No, the change takes effect immediately. VoiceStudio reads the asr_backend preference dynamically when get_active_asr_backend() is invoked, so new transcription requests use the updated engine without requiring a restart.
Where does VoiceStudio store the ASR engine preference?
The preference is stored and managed by services/prefs.py, which persists settings to a local JSON file. The asr_backend key in this file determines which class services/asr_backend.py instantiates when the active backend is requested.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →