|
| 1 | +# realtime-dual-transcriber |
1 | 2 |
|
2 | | -# 🎧 Ecoute |
| 3 | +realtime-dual-transcriber is a Windows desktop application for live transcription from two audio sources at the same time: |
3 | 4 |
|
4 | | -Ecoute is a live transcription tool that provides real-time transcripts for both the user's microphone input (You) and the user's speakers output (Speaker) in a textbox. |
| 5 | +- microphone input, shown as `You` |
| 6 | +- system speaker output, shown as `Speaker` |
5 | 7 |
|
6 | | -## Sponsored By: Recall.ai - Meeting Transcription API |
| 8 | +The application displays a real-time transcript in a desktop UI and can optionally use an OpenAI-compatible API provider such as Groq for faster multilingual transcription and Indonesian translation. |
7 | 9 |
|
8 | | -If you’re working with speech detection or transcription for meetings, consider checking out [Recall.ai](https://www.recall.ai/product/meeting-transcription-api/?utm_source=github&utm_medium=sponsorship&utm_campaign=sevask-ecoute), an API that works with Zoom, Google Meet, Microsoft Teams, and more. Recall.ai diarizes by pulling the speaker data and separate audio streams from the meeting platforms, which means 100% accurate speaker diarization with actual speaker names and speaker emails. |
| 10 | +## Key Features |
9 | 11 |
|
10 | | -## 📖 Demo |
| 12 | +- Dual-source transcription for microphone and speaker audio |
| 13 | +- Desktop interface built with CustomTkinter |
| 14 | +- WASAPI loopback support for capturing default speaker output on Windows |
| 15 | +- Local transcription mode with Faster Whisper |
| 16 | +- API transcription mode with Groq or another OpenAI-compatible endpoint |
| 17 | +- Optional Indonesian translation for each finalized transcript block |
| 18 | +- Configurable silence delay, phrase timeout, audio filtering, and transcription model |
| 19 | +- Secret-safe local configuration through `.env` or `keys.py` |
| 20 | +- Built-in unit tests for transcript state and API authentication handling |
11 | 21 |
|
12 | | -https://github.com/user-attachments/assets/5616421f-838d-439f-8b15-0df7b8d33459 |
| 22 | +## Repository |
13 | 23 |
|
14 | | -Ecoute is designed to help users in their conversations by providing live transcriptions. |
| 24 | +```powershell |
| 25 | +git clone https://github.com/Diyoncrz18/realtime-dual-transcriber.git |
| 26 | +cd realtime-dual-transcriber |
| 27 | +``` |
15 | 28 |
|
16 | | -## 🚀 Getting Started |
| 29 | +## Requirements |
17 | 30 |
|
18 | | -Follow these steps to set up and run Ecoute on your local machine. |
| 31 | +- Windows 10 or Windows 11 |
| 32 | +- Python 3.8 or newer |
| 33 | +- FFmpeg available on `PATH` |
| 34 | +- Working microphone and default speaker device |
| 35 | +- Optional: Groq or OpenAI-compatible API key for API mode |
19 | 36 |
|
20 | | -### 📋 Prerequisites |
| 37 | +Install FFmpeg with Chocolatey: |
21 | 38 |
|
22 | | -- Python >=3.8.0 |
23 | | -- (Optional) An OpenAI API key that can access Whisper API (set up a paid account OpenAI account) |
24 | | -- Windows OS (Not tested on others) |
25 | | -- FFmpeg |
| 39 | +```powershell |
| 40 | +choco install ffmpeg |
| 41 | +``` |
26 | 42 |
|
27 | | -If FFmpeg is not installed in your system, you can follow the steps below to install it. |
| 43 | +Or install FFmpeg manually and make sure `ffmpeg.exe` is available from PowerShell: |
28 | 44 |
|
29 | | -First, you need to install Chocolatey, a package manager for Windows. Open your PowerShell as Administrator and run the following command: |
| 45 | +```powershell |
| 46 | +ffmpeg -version |
30 | 47 | ``` |
31 | | -Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) |
32 | | -``` |
33 | | -Once Chocolatey is installed, you can install FFmpeg by running the following command in your PowerShell: |
34 | | -``` |
35 | | -choco install ffmpeg |
| 48 | + |
| 49 | +## Installation |
| 50 | + |
| 51 | +Create and activate a virtual environment: |
| 52 | + |
| 53 | +```powershell |
| 54 | +python -m venv .venv |
| 55 | +.\.venv\Scripts\Activate.ps1 |
36 | 56 | ``` |
37 | | -Please ensure that you run these commands in a PowerShell window with administrator privileges. If you face any issues during the installation, you can visit the official Chocolatey and FFmpeg websites for troubleshooting. |
38 | 57 |
|
39 | | -### 🔧 Installation |
| 58 | +Install dependencies: |
40 | 59 |
|
41 | | -1. Clone the repository: |
| 60 | +```powershell |
| 61 | +python -m pip install --upgrade pip |
| 62 | +pip install -r requirements.txt |
| 63 | +``` |
42 | 64 |
|
43 | | - ``` |
44 | | - git clone https://github.com/SevaSk/ecoute |
45 | | - ``` |
| 65 | +## Configuration |
46 | 66 |
|
47 | | -2. Navigate to the `ecoute` folder: |
| 67 | +The recommended configuration method is `.env`. |
48 | 68 |
|
49 | | - ``` |
50 | | - cd ecoute |
51 | | - ``` |
| 69 | +```powershell |
| 70 | +Copy-Item .env.example .env |
| 71 | +``` |
52 | 72 |
|
53 | | -3. Install the required packages: |
| 73 | +Edit `.env` and replace placeholder values with your own credentials. |
54 | 74 |
|
55 | | - ``` |
56 | | - pip install -r requirements.txt |
57 | | - ``` |
58 | | - |
59 | | -4. (Optional) Configure API credentials locally. |
| 75 | +Groq example: |
60 | 76 |
|
61 | | - The safest option is to copy the example environment file and add your real API key to `.env`: |
| 77 | +```env |
| 78 | +GROQ_API_KEY=your-groq-api-key-here |
| 79 | +GROQ_TRANSCRIPTION_MODEL=whisper-large-v3-turbo |
| 80 | +GROQ_TRANSLATION_MODEL=llama-3.1-8b-instant |
| 81 | +``` |
62 | 82 |
|
63 | | - ``` |
64 | | - Copy-Item .env.example .env |
65 | | - ``` |
| 83 | +OpenAI-compatible endpoint example: |
66 | 84 |
|
67 | | - Example Groq setup: |
| 85 | +```env |
| 86 | +OPENAI_API_KEY=your-openai-compatible-api-key |
| 87 | +OPENAI_BASE_URL=https://your-provider.example/v1 |
| 88 | +OPENAI_TRANSCRIPTION_MODEL=whisper-1 |
| 89 | +``` |
68 | 90 |
|
69 | | - ``` |
70 | | - GROQ_API_KEY=your-groq-api-key-here |
71 | | - GROQ_TRANSCRIPTION_MODEL=whisper-large-v3-turbo |
72 | | - GROQ_TRANSLATION_MODEL=llama-3.1-8b-instant |
73 | | - ``` |
| 91 | +You can also configure credentials through `keys.py`: |
74 | 92 |
|
75 | | - Example OpenAI-compatible setup: |
| 93 | +```powershell |
| 94 | +Copy-Item keys.example.py keys.py |
| 95 | +``` |
76 | 96 |
|
77 | | - ``` |
78 | | - OPENAI_API_KEY=your-openai-api-key-here |
79 | | - OPENAI_BASE_URL=https://your-custom-api.example/v1 |
80 | | - OPENAI_TRANSCRIPTION_MODEL=whisper-1 |
81 | | - ``` |
| 97 | +Keep real credentials local. `.env` and `keys.py` are ignored by Git and should never be committed. |
82 | 98 |
|
83 | | - You can also use `CUSTOM_API_KEY`, `CUSTOM_API_URL`, and `CUSTOM_API_TRANSCRIPTION_MODEL` with the same values. |
| 99 | +## Runtime Tuning |
84 | 100 |
|
85 | | - If you prefer Python config, copy `keys.example.py` to `keys.py` and put your real values there. |
86 | | - Do not commit `.env` or `keys.py`; both files are ignored by `.gitignore`. |
| 101 | +These values are optional and can be added to `.env` when needed: |
87 | 102 |
|
88 | | - If you see `Invalid API Key` or `expired_api_key`, create a new provider key and replace the old value in `.env` or `keys.py`, then restart Ecoute. |
| 103 | +```env |
| 104 | +GROQ_TRANSCRIPTION_LANGUAGE=id |
| 105 | +GROQ_TRANSCRIPTION_TEMPERATURE=0 |
| 106 | +GROQ_TRANSCRIPTION_PROMPT=Conversation with technical terms and product names. |
89 | 107 |
|
90 | | - Optional tuning: |
| 108 | +RTDT_RECORD_TIMEOUT=1.4 |
| 109 | +RTDT_PHRASE_TIMEOUT=5.0 |
| 110 | +RTDT_PAUSE_THRESHOLD=0.65 |
| 111 | +RTDT_MIN_AUDIO_SECONDS=0.45 |
| 112 | +RTDT_MIN_AUDIO_RMS=120 |
| 113 | +RTDT_TRANSLATION_SILENCE_DELAY=5.0 |
| 114 | +``` |
91 | 115 |
|
92 | | - ``` |
93 | | - GROQ_TRANSCRIPTION_MODEL=whisper-large-v3 |
94 | | - GROQ_TRANSCRIPTION_LANGUAGE=id |
95 | | - GROQ_TRANSCRIPTION_TEMPERATURE=0 |
96 | | - GROQ_TRANSCRIPTION_PROMPT=Conversation with technical terms and product names. |
97 | | - ``` |
| 116 | +Model recommendation: |
98 | 117 |
|
99 | | - Use `whisper-large-v3-turbo` for lower latency, or `whisper-large-v3` when accuracy matters more. |
| 118 | +- `whisper-large-v3-turbo` for lower latency |
| 119 | +- `whisper-large-v3` for higher accuracy |
100 | 120 |
|
101 | | - A new transcript block is created only after a mic or speaker segment has been quiet for about 5 seconds. Tune that delay with: |
| 121 | +## Running the Application |
102 | 122 |
|
103 | | - ``` |
104 | | - ECOUTE_RECORD_TIMEOUT=1.4 |
105 | | - ECOUTE_PHRASE_TIMEOUT=5.0 |
106 | | - ECOUTE_TRANSLATION_SILENCE_DELAY=5.0 |
107 | | - ``` |
| 123 | +Run local transcription mode: |
108 | 124 |
|
109 | | -### 🎬 Running Ecoute |
| 125 | +```powershell |
| 126 | +.\.venv\Scripts\python.exe main.py |
| 127 | +``` |
110 | 128 |
|
111 | | -Run the main script: |
| 129 | +Run API transcription mode: |
112 | 130 |
|
| 131 | +```powershell |
| 132 | +.\.venv\Scripts\python.exe main.py --api |
113 | 133 | ``` |
114 | | -python main.py |
| 134 | + |
| 135 | +API mode is recommended when you need better multilingual support, faster transcription, and Indonesian translation. |
| 136 | + |
| 137 | +## How It Works |
| 138 | + |
| 139 | +1. `AudioRecorder.py` captures microphone audio and default speaker loopback audio. |
| 140 | +2. `AudioTranscriber.py` filters short or silent audio, merges phrase fragments, and manages transcript state. |
| 141 | +3. `TranscriberModels.py` routes transcription to either Faster Whisper or an OpenAI-compatible API provider. |
| 142 | +4. `main.py` renders the live transcript UI and refreshes it as transcript revisions change. |
| 143 | + |
| 144 | +## Project Structure |
| 145 | + |
| 146 | +```text |
| 147 | +. |
| 148 | +|-- AudioRecorder.py # Microphone and speaker recording |
| 149 | +|-- AudioTranscriber.py # Transcript state, merging, filtering, translation queue |
| 150 | +|-- TranscriberModels.py # Local and API transcription providers |
| 151 | +|-- main.py # Desktop UI entry point |
| 152 | +|-- custom_speech_recognition/ # Speech recognition compatibility layer |
| 153 | +|-- tests/ # Unit tests |
| 154 | +|-- .env.example # Environment variable template |
| 155 | +|-- keys.example.py # Python credential template |
| 156 | +|-- requirements.txt # Python dependencies |
| 157 | +`-- README.md # Project documentation |
115 | 158 | ``` |
116 | 159 |
|
117 | | -For a more better and faster version that also works with most languages, use: |
| 160 | +## Testing |
| 161 | + |
| 162 | +Run the unit test suite: |
118 | 163 |
|
| 164 | +```powershell |
| 165 | +.\.venv\Scripts\python.exe -m unittest discover -s tests |
119 | 166 | ``` |
120 | | -python main.py --api |
| 167 | + |
| 168 | +Compile-check the main Python files: |
| 169 | + |
| 170 | +```powershell |
| 171 | +.\.venv\Scripts\python.exe -m py_compile main.py AudioRecorder.py AudioTranscriber.py TranscriberModels.py |
121 | 172 | ``` |
122 | 173 |
|
123 | | -Upon initiation, Ecoute will begin transcribing your microphone input and speaker output in real-time. Please note that it might take a few seconds for the system to warm up before the transcription becomes real-time. |
| 174 | +## Troubleshooting |
124 | 175 |
|
125 | | -The --api flag will use the whisper api for transcriptions. This significantly enhances transcription speed and accuracy, and it works in most languages (rather than just English without the flag). It's expected to become the default option in future releases. However, keep in mind that using the Whisper API will consume more OpenAI credits than using the local model. This increased cost is attributed to the advanced features and capabilities that the Whisper API provides. Despite the additional expense, the substantial improvements in speed and transcription accuracy may make it a worthwhile investment for your use case. |
| 176 | +### Invalid or expired API key |
126 | 177 |
|
127 | | -### ✅ Testing |
| 178 | +If the terminal shows `Invalid API Key` or `expired_api_key`, create a new provider key, update `.env` or `keys.py`, and restart the application. |
128 | 179 |
|
129 | | -Run the unit tests with: |
| 180 | +### FFmpeg not found |
130 | 181 |
|
131 | | -``` |
132 | | -python -m unittest discover -s tests |
133 | | -``` |
| 182 | +Make sure FFmpeg is installed and available from PowerShell: |
134 | 183 |
|
135 | | -### ⚠️ Limitations |
| 184 | +```powershell |
| 185 | +ffmpeg -version |
| 186 | +``` |
136 | 187 |
|
137 | | -While Ecoute provides real-time transcription and response suggestions, there are several known limitations to its functionality that you should be aware of: |
| 188 | +### Speaker audio is not captured |
138 | 189 |
|
139 | | -**Default Mic and Speaker:** Ecoute is currently configured to listen only to the default microphone and speaker set in your system. It will not detect sound from other devices or systems. If you wish to use a different mic or speaker, you will need to set it as your default device in your system settings. |
| 190 | +The application captures the default Windows speaker output through WASAPI loopback. Set the target output device as the Windows default speaker before starting the app. |
140 | 191 |
|
141 | | -**Whisper Model**: If the --api flag is not used, we utilize the 'tiny' version of the Whisper ASR model, due to its low resource consumption and fast response times. However, this model may not be as accurate as the larger models in transcribing certain types of speech, including accents or uncommon words. |
| 192 | +### Transcription is delayed |
142 | 193 |
|
143 | | -**Language**: If you are not using the --api flag the Whisper model used in Ecoute is set to English. As a result, it may not accurately transcribe non-English languages or dialects. We are actively working to add multi-language support to future versions of the program. |
| 194 | +Transcript blocks are finalized after a silence delay. Lower `RTDT_TRANSLATION_SILENCE_DELAY` and `RTDT_PHRASE_TIMEOUT` for faster updates, or increase them for more stable sentence grouping. |
144 | 195 |
|
145 | | -## 📖 License |
| 196 | +## Security Notes |
146 | 197 |
|
147 | | -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 198 | +- Do not commit `.env`, `keys.py`, model files, recordings, or logs. |
| 199 | +- The repository includes a GitHub Actions secret scan for common API key patterns. |
| 200 | +- If a real API key was ever committed, revoke it immediately and create a new one. |
148 | 201 |
|
149 | | -## 🤝 Contributing |
| 202 | +## Maintainer |
150 | 203 |
|
151 | | -Contributions are welcome! Feel free to open issues or submit pull requests to improve Ecoute. |
| 204 | +Maintained by `Diyoncrz18`. |
0 commit comments