Skip to main content
Audio commands handle recording, transcription, audio device selection, and transcription history.

Recording Commands

start_recording

Start recording audio from the selected microphone.
Usage:
Behavior:
  1. Validates license status and model availability
  2. Loads recording configuration from settings
  3. Creates a timestamped WAV file in the recordings directory
  4. Starts audio capture from the selected (or default) microphone
  5. Emits recording-state-changed events during state transitions
  6. Shows pill widget if pill_indicator_mode is not "never"
  7. Plays system sound if play_sound_on_recording is enabled
Events Emitted:
  • recording-state-changed: { state: 'starting' }{ state: 'recording' }
  • recording-started: Legacy event for compatibility
  • audio-level: Real-time audio level updates (0.0 - 1.0)
Errors:
  • "Already recording" - Recording already in progress
  • "No speech recognition models installed" - No models downloaded
  • "License required to record" - License expired or missing
  • "Microphone permission denied" - Permission not granted
  • "No microphone found" - No input device available
Example with Error Handling:

stop_recording

Stop the current recording and start transcription.
Returns: Transcribed text as a string Usage:
Behavior:
  1. Stops audio capture and saves WAV file
  2. Plays system sound if play_sound_on_recording_end is enabled
  3. Validates audio file (rejects if empty or header-only)
  4. Selects transcription engine based on current_model_engine setting
  5. Transcribes audio using selected model
  6. Applies AI enhancement if ai_enabled is true
  7. Saves transcription to history
  8. Inserts text at cursor position
  9. Hides pill widget based on pill_indicator_mode
Events Emitted:
  • recording-state-changed: { state: 'stopping' }{ state: 'transcribing' }{ state: 'idle' }
  • transcription-started: Transcription process began
  • transcription-complete: { text: string } - Transcription finished
Errors:
  • "Not currently recording" - No active recording
  • "No audio captured" - WAV file is empty
  • "Model not found" - Selected model is not available
  • "Transcription failed" - Engine returned an error

cancel_recording

Cancel the current recording without transcribing.
Usage:
Behavior:
  1. Sets cancellation flag in AppState
  2. Stops recording if active
  3. Deletes the audio file
  4. Hides pill widget
  5. Returns to idle state without transcribing
User Trigger: Pressing ESC during recording (if registered)

Transcription Commands

transcribe_audio_file

Transcribe an audio file from a path.
string
required
Absolute path to the audio file (WAV format)
Returns: Transcribed text Usage:

Audio Device Commands

get_audio_devices

Get a list of available audio input devices.
Returns: Array of device names Usage:
Example:

get_current_audio_device

Get the currently selected audio device.
Returns: Device name or null if using system default Usage:

Transcription History Commands

save_transcription

Save a transcription to history.
string
required
Transcribed text to save
string
required
Model name used for transcription
Usage:

get_transcription_history

Retrieve transcription history.
number
default:"100"
Maximum number of entries to return
Returns: Array of transcription entries
Usage:

cleanup_old_transcriptions

Delete transcriptions older than the configured retention period.
Returns: Number of transcriptions deleted Usage:
Behavior:
  • Reads transcription_cleanup_days from settings
  • If null, keeps all transcriptions (no cleanup)
  • If set, deletes transcriptions older than N days

State Management

Audio commands emit state changes through the recording-state-changed event:

Recording States

See Also