Cursor AI Sound Extension
A VS Code/Cursor extension that plays a sound notification when AI code generation is detected to be complete.
Features
🔊 Smart AI Detection: Automatically detects when AI is generating code and plays a sound when it finishes
🤖 Intelligent Pattern Recognition: Uses heuristics to distinguish AI-generated content from manual typing:
- Rapid text insertions
- Multi-line code blocks
- Structured content (brackets, parentheses, etc.)
- Large text insertions
🎵 Cross-Platform Sound Support:
- macOS: Uses system Glass sound with fallback to system beep
- Windows: Uses system notification sound with PowerShell
- Linux: Uses ALSA sound system with fallbacks
⚙️ Configurable Settings:
- Enable/disable sound notifications
- Adjust detection delay timing
- Volume control (future feature)
Installation
- Clone or download this repository
- Open the folder in VS Code
- Press
F5
to run the extension in a new Extension Development Host window
- Or package and install using
vsce package
Commands
Access these commands via the Command Palette (Cmd+Shift+P
on macOS, Ctrl+Shift+P
on Windows/Linux):
Cursor AI Sound: Test AI Sound
- Test the sound notification manually
Cursor AI Sound: Toggle AI Sound
- Enable/disable sound notifications
Configuration
Configure the extension via VS Code settings:
{
"cursorAiSound.enabled": true,
"cursorAiSound.detectionDelay": 2000,
"cursorAiSound.volume": 0.5
}
Settings Details
cursorAiSound.enabled
: Enable or disable sound notifications (default: true
)
cursorAiSound.detectionDelay
: Time in milliseconds to wait after the last change before considering AI generation complete (default: 2000
)
cursorAiSound.volume
: Volume level from 0.0 to 1.0 (default: 0.5
) - Note: Currently affects system volume commands where supported
How It Works
The extension monitors text document changes and uses several heuristics to detect AI-generated content:
- Change Pattern Analysis: Detects rapid, large text insertions typical of AI generation
- Content Structure Recognition: Identifies multi-line blocks and structured code patterns
- Timing Analysis: Uses debouncing to determine when generation has stopped
- Smart Filtering: Ignores manual typing patterns and certain file types
Supported File Types
The extension monitors all code files but ignores:
.log
files
.md
files (Markdown)
.txt
files
macOS
- Primary: Glass system sound (
/System/Library/Sounds/Glass.aiff
)
- Fallback: AppleScript beep command
Windows
- Primary: System notification sound via PowerShell
- Fallback: ASCII bell character
Linux
- Primary: ALSA front left speaker test
- Fallback: ASCII bell character
Development
Building
npm run compile
Testing
npm test
Linting
npm run lint
Contributing
Feel free to submit issues and enhancement requests!
License
MIT License - Feel free to use and modify as needed.