Skip to content

Commit 3809f26

Browse files
author
My Name
committed
initial fixes
1 parent 3a4bc46 commit 3809f26

30 files changed

+2614
-129
lines changed

Diff for: docs/activeContext.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ The current focus of the Syllablaze project is to optimize the application for U
1717
- System dependency checks
1818
- Improved error handling for ALSA
1919
- Installation verification
20+
- Updated to use official Whisper package from PyPI instead of GitHub
21+
- Fixed pkg_resources deprecation warning
22+
- Changed to use pipx for installation to avoid externally-managed-environment errors
2023
3. **Documentation**: Created comprehensive memory bank files in the docs/ directory
2124
4. **Ubuntu Compatibility**: Added specific handling for Ubuntu KDE environments
2225

Diff for: docs/techContext.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
### Required Tools
2424

2525
1. **Python 3.8+**: Core runtime environment
26-
2. **pip**: Python package manager
26+
2. **pipx**: Python application installer
2727
3. **Git**: Version control
2828
4. **ffmpeg**: Audio processing dependency
2929
5. **PortAudio**: Audio recording library
@@ -34,13 +34,13 @@
3434

3535
```bash
3636
sudo apt update
37-
sudo apt install -y python3-pip python3-dev portaudio19-dev ffmpeg
37+
sudo apt install -y python3-pipx python3-dev portaudio19-dev ffmpeg
3838
```
3939

4040
#### Fedora
4141

4242
```bash
43-
sudo dnf install -y python3-libs python3-devel python3 portaudio-devel ffmpeg
43+
sudo dnf install -y python3-pipx python3-devel python3 portaudio-devel ffmpeg
4444
```
4545

4646
### Python Dependencies
@@ -50,7 +50,7 @@ PyQt6
5050
numpy
5151
pyaudio
5252
scipy
53-
whisper (from GitHub)
53+
openai-whisper (from PyPI)
5454
```
5555

5656
## Technical Constraints
@@ -93,10 +93,10 @@ whisper (from GitHub)
9393
- System requirements: PortAudio development files
9494

9595
3. **Whisper**: Transcription
96-
- Purpose: Converts speech to text
97-
- Criticality: High (core functionality)
98-
- Installation: Directly from GitHub for latest version
99-
- System requirements: ffmpeg
96+
- Purpose: Converts speech to text
97+
- Criticality: High (core functionality)
98+
- Installation: From official PyPI repository as 'openai-whisper'
99+
- System requirements: ffmpeg
100100

101101
4. **NumPy/SciPy**: Audio processing
102102
- Purpose: Process audio data for optimal transcription

Diff for: install.py

+431-79
Large diffs are not rendered by default.

Diff for: loading_window.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class LoadingWindow(QDialog):
66
def __init__(self, parent=None):
77
super().__init__(parent)
8-
self.setWindowTitle("Loading Telly Spelly")
8+
self.setWindowTitle("Loading Syllablaze")
99
self.setFixedSize(400, 150)
1010
self.setWindowFlags(Qt.WindowType.Dialog | Qt.WindowType.CustomizeWindowHint)
1111

@@ -16,7 +16,7 @@ def __init__(self, parent=None):
1616
icon_label = QLabel()
1717
icon_label.setPixmap(QIcon.fromTheme('audio-input-microphone').pixmap(64, 64))
1818
icon_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
19-
title_label = QLabel("Loading Telly Spelly")
19+
title_label = QLabel("Loading Syllablaze")
2020
title_label.setStyleSheet("font-size: 16pt; font-weight: bold; color: #1d99f3;")
2121
title_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
2222

@@ -32,8 +32,18 @@ def __init__(self, parent=None):
3232

3333
# Progress bar
3434
self.progress = QProgressBar()
35-
self.progress.setRange(0, 0) # Infinite progress
35+
self.progress.setRange(0, 100) # Set range from 0 to 100 for percentage
3636
layout.addWidget(self.progress)
3737

3838
def set_status(self, message):
39-
self.status_label.setText(message)
39+
self.status_label.setText(message)
40+
41+
def set_progress(self, value):
42+
"""Update progress bar with a percentage value (0-100)"""
43+
if value < 0:
44+
value = 0
45+
elif value > 100:
46+
value = 100
47+
self.progress.setValue(value)
48+
self.progress.setFormat(f"{value}%")
49+
self.progress.setTextVisible(True)

Diff for: main.py

+29-22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Set environment variables to suppress Jack errors before any imports
2+
import os
3+
# Tell Jack not to start if not available
4+
os.environ['JACK_NO_AUDIO_RESERVATION'] = '1'
5+
os.environ['JACK_NO_START_SERVER'] = '1'
6+
# Explicitly ignore Jack - we'll use ALSA or PulseAudio instead
7+
os.environ['AUDIODEV'] = 'null'
8+
19
import sys
210
from PyQt6.QtWidgets import (QApplication, QMessageBox, QSystemTrayIcon, QMenu)
311
from PyQt6.QtCore import Qt, QTimer, QCoreApplication
@@ -12,7 +20,6 @@
1220
from PyQt6.QtCore import pyqtSignal
1321
import warnings
1422
import ctypes
15-
import os
1623
from shortcuts import GlobalShortcuts
1724
from settings import Settings
1825
# from mic_debug import MicDebugWindow
@@ -21,23 +28,11 @@
2128
logging.basicConfig(level=logging.INFO)
2229
logger = logging.getLogger(__name__)
2330

24-
# Suppress ALSA error messages
25-
try:
26-
# Load ALSA error handler
27-
ERROR_HANDLER_FUNC = ctypes.CFUNCTYPE(None, ctypes.c_char_p, ctypes.c_int,
28-
ctypes.c_char_p, ctypes.c_int,
29-
ctypes.c_char_p)
30-
31-
def py_error_handler(filename, line, function, err, fmt):
32-
pass
31+
# Log that Jack errors can be safely ignored
32+
logger.info("Note: Jack server errors can be safely ignored - using ALSA/PulseAudio instead")
3333

34-
c_error_handler = ERROR_HANDLER_FUNC(py_error_handler)
35-
36-
# Set error handler
37-
asound = ctypes.cdll.LoadLibrary('libasound.so.2')
38-
asound.snd_lib_error_set_handler(c_error_handler)
39-
except:
40-
warnings.warn("Failed to suppress ALSA warnings", RuntimeWarning)
34+
# Audio error handling is now done in recorder.py
35+
# This comment is kept for documentation purposes
4136

4237
def check_dependencies():
4338
required_packages = ['whisper', 'pyaudio', 'keyboard']
@@ -80,7 +75,7 @@ def __init__(self):
8075
# self.debug_window = MicDebugWindow()
8176

8277
# Set tooltip
83-
self.setToolTip("Telly Spelly")
78+
self.setToolTip("Syllablaze")
8479

8580
# Enable activation by left click
8681
self.activated.connect(self.on_activate)
@@ -93,11 +88,11 @@ def __init__(self):
9388
def initialize(self):
9489
"""Initialize the tray recorder after showing loading window"""
9590
# Set application icon
96-
self.app_icon = QIcon.fromTheme("telly-spelly")
91+
self.app_icon = QIcon.fromTheme("syllablaze")
9792
if self.app_icon.isNull():
9893
# Fallback to theme icons if custom icon not found
9994
self.app_icon = QIcon.fromTheme("media-record")
100-
logger.warning("Could not load telly-spelly icon, using system theme icon")
95+
logger.warning("Could not load syllablaze icon, using system theme icon")
10196

10297
# Set the icon for both app and tray
10398
QApplication.instance().setWindowIcon(self.app_icon)
@@ -271,6 +266,10 @@ def handle_recording_error(self, error):
271266
def update_processing_status(self, status):
272267
if self.progress_window:
273268
self.progress_window.set_status(status)
269+
270+
def update_processing_progress(self, percent):
271+
if self.progress_window:
272+
self.progress_window.update_progress(percent)
274273

275274
def handle_transcription_finished(self, text):
276275
if text:
@@ -311,7 +310,7 @@ def toggle_debug_window(self):
311310
self.debug_action.setText("Hide Debug Window")
312311

313312
def setup_application_metadata():
314-
QCoreApplication.setApplicationName("Telly Spelly")
313+
QCoreApplication.setApplicationName("Syllablaze")
315314
QCoreApplication.setApplicationVersion("1.0")
316315
QCoreApplication.setOrganizationName("KDE")
317316
QCoreApplication.setOrganizationDomain("kde.org")
@@ -364,32 +363,40 @@ def initialize_tray(tray, loading_window, app):
364363
try:
365364
# Initialize basic tray setup
366365
loading_window.set_status("Initializing application...")
366+
loading_window.set_progress(10)
367367
app.processEvents()
368368
tray.initialize()
369369

370370
# Initialize recorder
371371
loading_window.set_status("Initializing audio system...")
372+
loading_window.set_progress(25)
372373
app.processEvents()
373374
tray.recorder = AudioRecorder()
374375

375376
# Initialize transcriber
376-
loading_window.set_status("Loading Whisper model...")
377+
loading_window.set_status("Loading Whisper model: turbo")
378+
loading_window.set_progress(40)
377379
app.processEvents()
378380
tray.transcriber = WhisperTranscriber()
381+
loading_window.set_progress(80)
382+
app.processEvents()
379383

380384
# Connect signals
381385
loading_window.set_status("Setting up signal handlers...")
386+
loading_window.set_progress(90)
382387
app.processEvents()
383388
tray.recorder.volume_updated.connect(tray.update_volume_meter)
384389
tray.recorder.recording_finished.connect(tray.handle_recording_finished)
385390
tray.recorder.recording_error.connect(tray.handle_recording_error)
386391

387392
tray.transcriber.transcription_progress.connect(tray.update_processing_status)
393+
tray.transcriber.transcription_progress_percent.connect(tray.update_processing_progress)
388394
tray.transcriber.transcription_finished.connect(tray.handle_transcription_finished)
389395
tray.transcriber.transcription_error.connect(tray.handle_transcription_error)
390396

391397
# Make tray visible
392398
loading_window.set_status("Starting application...")
399+
loading_window.set_progress(100)
393400
app.processEvents()
394401
tray.setVisible(True)
395402

Diff for: org.kde.syllablaze.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Name=Syllablaze
33
Comment=Record and transcribe audio using Whisper
44
Version=1.0
5-
Exec=syllablaze
5+
Exec=pipx run syllablaze
66
Icon=syllablaze
77
Type=Application
88
Categories=Qt;KDE;Audio;AudioVideo;
99
Terminal=false
10-
X-KDE-StartupNotify=true
10+
X-KDE-StartupNotify=true

Diff for: progress_window.py

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from PyQt6.QtWidgets import (QWidget, QVBoxLayout, QLabel, QProgressBar,
2-
QApplication, QPushButton, QHBoxLayout)
1+
from PyQt6.QtWidgets import (QWidget, QVBoxLayout, QLabel, QProgressBar,
2+
QApplication, QPushButton, QHBoxLayout)
33
from PyQt6.QtCore import Qt, pyqtSignal
44
from volume_meter import VolumeMeter
55

@@ -9,9 +9,9 @@ class ProgressWindow(QWidget):
99
def __init__(self, title="Recording"):
1010
super().__init__()
1111
self.setWindowTitle(title)
12-
self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint |
13-
Qt.WindowType.CustomizeWindowHint |
14-
Qt.WindowType.WindowTitleHint)
12+
self.setWindowFlags(Qt.WindowType.WindowStaysOnTopHint |
13+
Qt.WindowType.CustomizeWindowHint |
14+
Qt.WindowType.WindowTitleHint)
1515

1616
# Prevent closing while processing
1717
self.processing = False
@@ -29,13 +29,21 @@ def __init__(self, title="Recording"):
2929
self.volume_meter = VolumeMeter()
3030
layout.addWidget(self.volume_meter)
3131

32+
# Add progress bar (hidden initially)
33+
self.progress_bar = QProgressBar()
34+
self.progress_bar.setRange(0, 100)
35+
self.progress_bar.setTextVisible(True)
36+
self.progress_bar.setFormat("%p%")
37+
self.progress_bar.hide()
38+
layout.addWidget(self.progress_bar)
39+
3240
# Add stop button
3341
self.stop_button = QPushButton("Stop Recording")
3442
self.stop_button.clicked.connect(self.stop_clicked.emit)
3543
layout.addWidget(self.stop_button)
3644

3745
# Set window size
38-
self.setFixedSize(350, 150)
46+
self.setFixedSize(350, 180)
3947

4048
# Center the window
4149
screen = QApplication.primaryScreen().geometry()
@@ -61,13 +69,21 @@ def set_processing_mode(self):
6169
self.processing = True
6270
self.volume_meter.hide()
6371
self.stop_button.hide()
72+
self.progress_bar.show()
73+
self.progress_bar.setValue(0)
6474
self.status_label.setText("Processing audio with Whisper...")
65-
self.setFixedHeight(80)
75+
self.setFixedHeight(120)
6676

6777
def set_recording_mode(self):
6878
"""Switch back to recording mode"""
6979
self.processing = False
7080
self.volume_meter.show()
81+
self.progress_bar.hide()
7182
self.stop_button.show()
7283
self.status_label.setText("Recording...")
73-
self.setFixedHeight(150)
84+
self.setFixedHeight(180)
85+
86+
def update_progress(self, percent):
87+
"""Update the progress bar with a percentage value"""
88+
if self.processing and self.progress_bar.isVisible():
89+
self.progress_bar.setValue(percent)

0 commit comments

Comments
 (0)