Error Audio Player
An VS Code extension that plays a custom sound whenever a terminal command fails or produces an error. Never miss an error again!
Features
- Automatic Error Detection: Monitors terminal output and detects errors, failures, exceptions, and build errors
- Custom Audio: Choose any audio file (MP3, WAV, OGG, M4A) to play on errors
- Flexible Configuration: Adjust volume, debounce delays, and toggle the extension on/off
- Hidden Operation: Runs silently in the background without cluttering your UI
- Default Fallback: Falls back to a beep sound if no custom audio is configured
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Error Audio Player"
- Click Install
From Source (Development)
git clone https://github.com/your-username/error-audio-player.git
cd error-audio-player
npm install
npm run compile
# Press F5 to open Extension Development Host
Usage
Commands
The extension provides three main commands (accessible via Command Palette Ctrl+Shift+P):
- Error Audio Player: Pick audio file... - Select a custom audio file to play on errors
- Error Audio Player: Test play sound - Preview the configured sound
- Error Audio Player: Toggle enable/disable - Quickly turn the extension on/off
Configuration
Access settings via Preferences > Settings (Ctrl+,) and search for "Error Audio Player":
errorAudioPlayer.enable (boolean, default: true)
Enable or disable the extension globally
errorAudioPlayer.audioPath (string, default: empty)
Full path or URL to your audio file. Supports:
- Local files:
C:\Users\YourName\Music\error.mp3 or /home/user/sounds/error.wav
- URLs:
https://example.com/sound.mp3
- Leave empty to use bundled beep sound
errorAudioPlayer.volume (number, default: 0.8, range: 0.0 - 1.0)
Playback volume level
errorAudioPlayer.playDebounce (number, default: 300 ms)
Minimum delay between consecutive sound plays to avoid repeated triggers
Example Configuration
Add to your VS Code settings.json:
{
"errorAudioPlayer.enable": true,
"errorAudioPlayer.audioPath": "C:\\Users\\YourName\\Music\\error-alert.mp3",
"errorAudioPlayer.volume": 0.6,
"errorAudioPlayer.playDebounce": 500
}
Bundled Audio
To include a default audio file with your extension:
- Create a
media folder in the extension root:
mkdir media
- Add your audio file as
media/error-sound.mp3 or media/error-sound.wav
- The extension will automatically use it if no custom audio is configured
Supported Error Patterns
The extension detects errors using these heuristics:
- Keywords: error, failed, failure, exception, traceback, fatal, not found, undefined, null
- Exit codes: Any non-zero exit code (exit 1, exit 127, etc.)
- Build errors: npm err, compilation failed, build failed, syntax error
- Test failures: test failed, failing tests, fail:
- Severity markers:
[ERROR], [FAIL], [FATAL], ERROR:, etc.
Extension Settings
This extension contributes the following settings:
errorAudioPlayer.enable: Enable/disable playing audio on terminal errors
errorAudioPlayer.audioPath: Path or URL to custom audio file
errorAudioPlayer.volume: Audio playback volume (0.0 - 1.0)
errorAudioPlayer.playDebounce: Minimum milliseconds between consecutive plays
Known Issues
- Audio playback on WSL terminals may require additional system configuration
- Some specialized shell output formats may not be detected; open an issue if you find patterns we miss
Publishing to VS Code Marketplace
Prerequisites
- Create a Microsoft account at https://aka.ms/SignupMicrosoftAccount
- Register as a publisher on https://marketplace.visualstudio.com/manage/publishers
- Create a Personal Access Token (PAT) in Azure DevOps
Steps to Publish
Install vsce (VS Code Extension CLI):
npm install -g @vsce/vsce
Update package.json with your publisher:
{
"publisher": "your-publisher-name",
"name": "error-audio-player",
...
}
Create CHANGELOG.md (already present)
Create LICENSE file (recommended):
echo "MIT License - 2024" > LICENSE
Package the extension:
npm run package
# or manually:
vsce package
This creates error-audio-player-0.0.1.vsix
Publish to Marketplace:
vsce publish
# You'll be prompted for your PAT
Or publish manually:
Updating After Publishing
To publish a new version:
- Update
version in package.json
- Add release notes to
CHANGELOG.md
- Run
vsce publish
Release Notes
0.0.1
Initial release with the following features:
- Terminal error detection
- Custom audio file selection
- Volume and debounce configuration
- Test play sound command
- Enable/disable toggle command
Contributing
Found a bug or have a feature request? Please open an issue on GitHub!
License
MIT License - See LICENSE file for details
Credits
Built with ❤️ using VS Code Extension API
Following extension guidelines
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
Working with Markdown
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
- Split the editor (
Cmd+\ on macOS or Ctrl+\ on Windows and Linux).
- Toggle preview (
Shift+Cmd+V on macOS or Shift+Ctrl+V on Windows and Linux).
- Press
Ctrl+Space (Windows, Linux, macOS) to see a list of Markdown snippets.
Enjoy!