Browser automation script for whispering.bradenwong.com transcription service
Project description
WhisperingScript
A Python package that automates browser interactions with whispering.bradenwong.com for seamless audio recording and transcription. Sorry, lots of AI used to script this at speed.
So why write the script in the first place? The easy answer is that, unfortunately, the Whispering app, or Epicenter, is currently broken on Ubuntu Linux. Nothing I tried could induce the script to record audio and then transcribe it to text. However, it works just fine in the browser, so this script does those calls for you to automate the process.
This script has only been tested on Ubuntu 24.04, on Gnome.
Features
- 🎙️ Automated Recording: Start and stop audio recording with multiple control methods
- 🔄 Transcription Integration: Automatically retrieves transcribed text and copies to clipboard
- 🌐 Headless Operation: Runs in background without GUI interference
- ⚙️ Configurable Settings: Supports OpenAI Whisper API configuration
- 🔧 Multiple Stop Methods: File-based, signal-based, or timer-based recording control
- 📋 Clipboard Integration: Automatically pastes transcribed text where needed
Installation
From PyPI (when published)
pip install whisperingscript
From Source
git clone https://github.com/martin/whisperingscript.git
cd whisperingscript
pip install -e .
Key Binding
I then use Gnome custom shortcuts to bind the script to a key combination (CTRL+F11):
The run configuration (for me, please change your paths) is:
/home/martin/Documents/Programming/whisperingscript/.venv/bin/python3 /home/martin/Documents/Programming/whisperingscript/src/whisperingscript/automation.py
I then have a stop configuration (for me, please change your paths):
touch /tmp/whispering_stop
This will, also, depend on the stop mechanism that you use. This is file-based stoppage.
Prerequisites
- Chrome Browser: The script uses Chrome WebDriver
- ChromeDriver: Must be installed and available in PATH
- OpenAI API Key: Required for transcription (placed in ~/.openai)
Installing ChromeDriver
Ubuntu/Debian
sudo apt-get update
sudo apt-get install chromium-chromedriver
macOS
brew install chromedriver
Windows
Download from ChromeDriver Downloads and add to PATH.
OpenAI API Key Setup
Create a file at ~/.openai containing your OpenAI API key:
echo "your-openai-api-key-here" > ~/.openai
Usage
Command Line Interface
# Basic usage with file-based stopping
whisperingscript
# Or use the shorter alias
whispering
# Use signal-based stopping
whisperingscript --stop-method signal
# Use timer-based stopping (30 seconds)
whisperingscript --stop-method time --duration 30
# Run in non-headless mode (visible browser)
whisperingscript --headless=false
Stop Methods
1. File-based (default)
whisperingscript --stop-method file
To stop recording: touch /tmp/whispering_stop
2. Signal-based
whisperingscript --stop-method signal
To stop recording: kill -USR1 <process_id> (process ID is displayed when script starts)
3. Timer-based
whisperingscript --stop-method time --duration 60
Recording automatically stops after specified duration (60 seconds in this example)
Python API
from whisperingscript import WhisperingAutomation
# Create automation instance
automation = WhisperingAutomation(
headless=True,
stop_method="file",
recording_duration=30
)
# Run the complete workflow
transcription = automation.run()
print(f"Transcribed text: {transcription}")
Advanced Usage
from whisperingscript import WhisperingAutomation
# Custom configuration
automation = WhisperingAutomation(
headless=False, # Show browser window
stop_method="signal", # Use SIGUSR1 signal
recording_duration=60 # Fallback duration
)
try:
# Setup browser and configure settings
automation.setup_browser()
automation.setup_stop_listener()
# Navigate and configure
automation.navigate_to_site()
automation.click_settings()
automation.configure_transcription()
automation.return_to_home()
# Recording workflow
automation.start_recording()
automation.wait_for_stop_signal()
automation.stop_recording()
# Get results
transcription = automation.get_transcription()
print(f"Result: {transcription}")
finally:
automation.cleanup()
Configuration
API KEY
OPENAI_API_KEY: Put API key in~/.openaifile for API key storage
Browser Options
The script automatically configures Chrome with:
- Microphone access permissions
- Disabled notifications and popups
- Optimized settings for headless operation
Workflow
- Browser Setup: Initializes Chrome with required permissions
- Navigation: Opens whispering.bradenwong.com
- Configuration:
- Navigates to settings
- Configures transcription service (OpenAI Whisper)
- Enters API key
- Recording:
- Returns to home page
- Starts audio recording
- Waits for stop signal
- Stops recording
- Transcription:
- Waits for transcription to complete
- Copies result to clipboard
- Optionally pastes using xdotool
Troubleshooting
Common Issues
-
ChromeDriver not found
selenium.common.exceptions.WebDriverException: 'chromedriver' executable needs to be in PATHSolution: Install ChromeDriver and ensure it's in your PATH
-
Permission denied for microphone
The script may fail to access microphone in headless modeSolution: The script automatically handles microphone permissions
-
API key not found
⚠ OpenAI API key file not found: ~/.openaiSolution: Create
~/.openaifile with your API key -
Transcription timeout
⚠ Timeout waiting for transcription after 60 secondsSolution: Check your internet connection and API key validity
Debug Mode
Run with visible browser for debugging:
whisperingscript --headless=false
Development
Setup Development Environment
git clone https://github.com/martinpauleve/whisperingscript.git
cd whisperingscript
pip install -e ".[dev]"
Code Formatting
black src/
Dependencies
- selenium: Browser automation
- pyperclip: Clipboard operations
- plyer: Cross-platform notifications
License
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
- Issues: GitHub Issues
- Documentation: This README and inline code documentation
Changelog
v0.1.0
- Initial release
- Basic automation workflow
- Multiple stop methods
- OpenAI Whisper integration
- Clipboard and notification support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whisperingscript-0.1.0.tar.gz.
File metadata
- Download URL: whisperingscript-0.1.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ca2fc74f2c5413a7c851827cf70a61c1e680138c5d0fea967cc19dca0da21c8
|
|
| MD5 |
3f04ea18dfd29a519cee209681ea4ea5
|
|
| BLAKE2b-256 |
ee42a6216221b6e5f6661e48c1e4ee42e80e8ce70720bb6540147e776e960961
|
File details
Details for the file whisperingscript-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whisperingscript-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75469c05fce5ad7fc0c86963825795a2b7b7b3d6222ed5b0b8e746f72a0ca353
|
|
| MD5 |
d87cb24ffa37a24908fb908d95ed454f
|
|
| BLAKE2b-256 |
60e1d62157b494ff7a400378fe92126d8dfdc80ef1c5db9ec05456c491d73138
|