Terminal Error Sound
A VSCode extension that plays a custom sound when errors occur in the terminal. Never miss an error again, even when you're not actively watching the terminal!
Features
Configurable Error Detection: Choose how errors are detected:
- Text Patterns: Matches common error keywords like "error", "ERROR", "failed", "exception", etc.
- Exit Codes: Triggers on non-zero exit codes from commands
- Both: Combines both detection methods
Custom Sound Files: Use your own sound file (.wav, .mp3, .ogg)
Configurable Error Patterns: Customize which text patterns should trigger the sound
Volume Control: Adjust the sound volume to your preference (0.0 to 1.0)
Debouncing: Prevents sound spam by limiting how often the sound can play
Status Bar Integration: Quick toggle to enable/disable the extension
Test Command: Test your sound configuration with a single command
Requirements
This extension uses the play-sound npm package which relies on system audio players:
- Windows: Built-in audio support (no additional installation needed)
- macOS: Uses
afplay (pre-installed)
- Linux: Requires one of the following audio players:
mplayer
mpg123 (for MP3)
aplay (for WAV)
sox
Extension Settings
This extension contributes the following settings:
terminalErrorSound.enabled: Enable or disable the extension (default: true)
terminalErrorSound.soundFilePath: Path to your custom sound file (supports .wav, .mp3, .ogg)
terminalErrorSound.detectionMode: How to detect errors - "patterns", "exitCode", or "both" (default: "patterns")
terminalErrorSound.errorPatterns: Array of text patterns to detect as errors
terminalErrorSound.volume: Volume level for the error sound, 0.0 to 1.0 (default: 0.5)
terminalErrorSound.debounceInterval: Minimum time in milliseconds between playing sounds (default: 2000)
Getting Started
- Install the extension (once published) or run it from source
- Configure your sound file:
- Open VSCode Settings (Ctrl+, or Cmd+,)
- Search for "Terminal Error Sound"
- Set
terminalErrorSound.soundFilePath to the path of your sound file
- Example:
C:/sounds/error.wav (Windows)
- Example:
/home/user/sounds/error.wav (Linux)
- Example:
/Users/username/sounds/error.wav (macOS)
- Test your setup:
- Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
- Run:
Terminal Error Sound: Test Sound
- Trigger an error in your terminal to verify:
- Run a command that fails (e.g.,
node nonexistent.js)
- The sound should play!
Usage Examples
Example 1: Pattern-based Detection (Default)
{
"terminalErrorSound.enabled": true,
"terminalErrorSound.soundFilePath": "C:/sounds/error.wav",
"terminalErrorSound.detectionMode": "patterns",
"terminalErrorSound.errorPatterns": [
"error:",
"Error:",
"ERROR",
"failed",
"npm ERR!"
]
}
This will trigger the sound whenever any of these patterns appear in terminal output.
Example 2: Exit Code Detection
{
"terminalErrorSound.enabled": true,
"terminalErrorSound.soundFilePath": "/home/user/sounds/beep.mp3",
"terminalErrorSound.detectionMode": "exitCode"
}
This will trigger the sound only when a command exits with a non-zero exit code.
{
"terminalErrorSound.enabled": true,
"terminalErrorSound.soundFilePath": "~/sounds/error.ogg",
"terminalErrorSound.detectionMode": "patterns",
"terminalErrorSound.errorPatterns": [
"FAIL",
"AssertionError",
"Test failed",
"[ERROR]",
"Build failed"
]
}
Customize patterns to match your specific development tools and frameworks.
Commands
Terminal Error Sound: Test Sound - Test your sound configuration
Terminal Error Sound: Toggle Enable/Disable - Quickly enable or disable the extension
Tips
Finding Sound Files: You can download free sound effects from:
Volume Not Working?: The play-sound library uses system audio players, which may not all support volume control. If volume adjustment doesn't work, adjust the volume of your sound file itself or use your system volume controls.
Too Many Alerts?: Increase the debounceInterval setting to reduce notification frequency.
Status Bar: Click the status bar item (speaker icon) to quickly toggle the extension on/off.
Known Issues
- Volume control may not work with all audio formats/system players
- Terminal output monitoring has limitations in VSCode's API and may not capture all output in some scenarios
- Exit code detection only works for tasks, not direct terminal commands in all cases
Development
To run this extension in development mode:
- Clone the repository
- Run
npm install
- Run
npm run compile
- Press F5 to open a new VSCode window with the extension loaded
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
MIT
Release Notes
0.0.1
Initial release:
- Pattern-based error detection
- Exit code error detection
- Custom sound file support
- Configurable error patterns
- Volume control
- Debouncing
- Status bar integration
- Test command