Simple STT
A simple speech-to-text extension for VS Code that uses AssemblyAI's real-time streaming API to transcribe your speech directly into the editor.
Features
- Real-time transcription: Speak and see your words appear in the editor as you talk
- Live updates: Partial transcripts are shown in real-time and replaced with properly formatted, punctuated versions when complete
- Smart punctuation: Automatically adds missing periods between sentences when AssemblyAI doesn't provide them
- Auto-stop functionality:
- Stops after configurable seconds of voice inactivity (default: 20 seconds)
- Stops on keyboard input (manual typing)
- Stops when you switch tabs or windows
- Stops when you lose window focus
- Status bar indicator: Visual feedback showing when recording is active
- Keyboard shortcut: Quick toggle with
Cmd+Shift+V
(Mac) or Ctrl+Shift+V
(Windows/Linux)
Requirements
- AssemblyAI API Key: Get a free API key at https://www.assemblyai.com/
- sox (macOS only): Install with
brew install sox
- Internet connection: Required for streaming to AssemblyAI
Setup
1. Install the extension
Install from the VS Code marketplace or package it locally:
npm install
npm run package
code --install-extension simple-stt-0.0.1.vsix
You have two options:
Option A: Environment Variable (Recommended)
Set the ASSEMBLYAI_API_KEY
environment variable before launching VS Code:
export ASSEMBLYAI_API_KEY="your-api-key-here"
code
To make it permanent, add it to your shell profile (~/.bashrc
, ~/.zshrc
, etc.):
echo 'export ASSEMBLYAI_API_KEY="your-api-key-here"' >> ~/.zshrc
Option B: VS Code Settings
- Open VS Code settings (
Cmd+,
on Mac, Ctrl+,
on Windows/Linux)
- Search for "Simple STT"
- Enter your API key in the "Assembly Ai Api Key" field
Note: The VS Code setting takes precedence over the environment variable.
By default, recording stops after 20 seconds of silence. You can change this:
- Open VS Code settings
- Search for "Simple STT: Inactivity Timeout"
- Set your preferred timeout in seconds
Usage
- Open a file in VS Code
- Press
Cmd+Shift+V
(Mac) or Ctrl+Shift+V
(Windows/Linux) to start recording
- Speak into your microphone
- Your speech will be transcribed in real-time at the cursor position
- Press the hotkey again to stop, or recording will stop automatically when you:
- Stop speaking for the configured timeout period
- Start typing manually
- Switch to another tab or window
- Lose window focus
Alternatively, use the command palette (Cmd+Shift+P
or Ctrl+Shift+P
) and search for "Simple STT: Start/Stop Recording".
How It Works
Real-time Transcription
The extension uses AssemblyAI's v3 Streaming API with turn detection:
- Audio is captured from your microphone using the
mic
package and sox
- Audio is streamed to AssemblyAI via WebSocket connection
- Partial transcripts are shown in real-time as you speak
- When you finish a sentence (turn), the partial text is replaced with a properly formatted and punctuated version
Smart Punctuation
AssemblyAI sometimes doesn't add punctuation at the end of a turn. This extension automatically detects this and adds a period when:
- A new turn starts with an uppercase letter
- The previous turn didn't end with punctuation (
.
, !
, or ?
)
This ensures your transcribed text flows naturally without manual editing.
Auto-stop Triggers
Recording automatically stops when:
- Voice inactivity: No speech detected for the configured timeout (default: 20 seconds)
- Keyboard input: You start typing manually (the extension distinguishes between your typing and its own text insertion)
- Tab/window switch: You switch to another file or application
- Focus loss: VS Code loses focus
Troubleshooting
"Microphone Error" or "Failed to start microphone"
On macOS, make sure sox
is installed:
brew install sox
Make sure you've set up your API key either as an environment variable or in VS Code settings (see Setup section above).
Recording doesn't stop automatically on inactivity
Check that your inactivity timeout is set appropriately in the settings. The default is 20 seconds.
Text not appearing
- Make sure you have an active editor open
- Check the VS Code developer console (Help → Toggle Developer Tools) for error messages
- Verify your API key is correct
- Check your internet connection
Privacy
Your audio is streamed to AssemblyAI's servers for transcription. Please review AssemblyAI's privacy policy at https://www.assemblyai.com/legal/privacy-policy.
License
MIT
Contributing
Found a bug or have a feature request? Please open an issue on the GitHub repository.