This Python script offers a convenient way to record audio through the microphone and transcribe it using OpenAI's powerful API. The transcription is automatically copied to the clipboard and pasted into the currently active window, making it ideal for quickly capturing and transcribing spoken words.
- Audio recording with a simple keyboard shortcut.
- Transcription of recorded audio using OpenAI's API.
- Automatic pasting of the transcribed text into any text input field.
- Easy to use with minimal setup required.
Before running the script, ensure you have the following:
- Python 3.x installed on your system.
- An OpenAI API key (sign up at OpenAI to obtain one).
- Clone the repository to your local machine:
git clone https://github.com/smian1/Whisper-Voice-Transcription.git
- Navigate to the cloned directory:
cd Whisper-Voice-Transcription
- Install the required dependencies:
pip install -r requirements.txt
- Run the script:
python voice_transcription.py
- Start recording by pressing Ctrl+R. Speak into your microphone.
- Stop recording by pressing Ctrl+R again. The script will transcribe the audio and paste the transcription into the current active window.
Place your OpenAI API key in a file named openai_api_key.txt in the same directory as the script.
Using a virtual environment is recommended as it keeps dependencies required by different projects separate. Here's how you can set up and use a virtual environment for this script:
-
Install Virtualenv (if not already installed):
pip install virtualenv
-
Create a Virtual Environment: Navigate to the project directory and run:
virtualenv venv
This command creates a new directory named venv in your project directory, which contains the virtual environment.
- Activate the Virtual Environment:
- On macOS and Linux:
source venv/bin/activate
- On Windows:
.\venv\Scripts\activate
-
Install Dependencies: With the virtual environment activated, install the project dependencies:
pip install -r requirements.txt
-
Run the Script: Still in the virtual environment, you can now run the script:
python voice_transcription.py
-
Deactivate the Virtual Environment: Once you're done, you can deactivate the virtual environment by running:
deactivate
Using a virtual environment ensures that your project's dependencies are isolated and do not interfere with other Python projects.
Contributions to this project are welcome! Please feel free to fork the repository, make improvements, and submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
This project leverages the OpenAI API for transcription capabilities. The development of this script was greatly aided by the comprehensive documentation provided by OpenAI. If you're looking to understand more about how the OpenAI API works or want to explore its extensive capabilities, their documentation is an excellent place to start.
The OpenAI API documentation is a valuable resource for anyone interested in integrating advanced AI features into their applications. It offers detailed guidance on how to use the API, including authentication, making requests, handling responses, and understanding rate limits.
You can find the OpenAI API documentation here: OpenAI API Documentation
Whether you're a beginner or an experienced developer, the OpenAI documentation provides insights and instructions that can help you effectively utilize their API in your projects.