abstractvoice 0.5.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/PKG-INFO +32 -1
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/README.md +31 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/__init__.py +1 -1
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/tts/tts_engine.py +31 -1
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/voice_manager.py +33 -1
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice.egg-info/PKG-INFO +32 -1
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/LICENSE +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/__main__.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/dependency_check.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/examples/__init__.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/examples/cli_repl.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/examples/voice_cli.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/examples/web_api.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/instant_setup.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/recognition.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/simple_model_manager.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/stt/__init__.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/stt/transcriber.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/tts/__init__.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/vad/__init__.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice/vad/voice_detector.py +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice.egg-info/SOURCES.txt +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice.egg-info/dependency_links.txt +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice.egg-info/entry_points.txt +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice.egg-info/requires.txt +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/abstractvoice.egg-info/top_level.txt +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/pyproject.toml +0 -0
- {abstractvoice-0.5.0 → abstractvoice-0.5.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abstractvoice
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: A modular Python library for voice interactions with AI systems
|
|
5
5
|
Author-email: Laurent-Philippe Albou <contact@abstractcore.ai>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -615,6 +615,37 @@ manager.set_tts_model("tts_models/en/ljspeech/glow-tts")
|
|
|
615
615
|
# - "tts_models/en/ljspeech/glow-tts" (alternative fallback)
|
|
616
616
|
# - "tts_models/en/ljspeech/tacotron2-DDC" (legacy)
|
|
617
617
|
|
|
618
|
+
# === Audio Lifecycle Callbacks (v0.5.1+) ===
|
|
619
|
+
|
|
620
|
+
# NEW: Precise audio timing callbacks for visual status indicators
|
|
621
|
+
def on_synthesis_start():
|
|
622
|
+
print("🔴 Synthesis started - show thinking animation")
|
|
623
|
+
|
|
624
|
+
def on_audio_start():
|
|
625
|
+
print("🔵 Audio started - show speaking animation")
|
|
626
|
+
|
|
627
|
+
def on_audio_pause():
|
|
628
|
+
print("⏸️ Audio paused - show paused animation")
|
|
629
|
+
|
|
630
|
+
def on_audio_resume():
|
|
631
|
+
print("▶️ Audio resumed - continue speaking animation")
|
|
632
|
+
|
|
633
|
+
def on_audio_end():
|
|
634
|
+
print("🟢 Audio ended - show ready animation")
|
|
635
|
+
|
|
636
|
+
def on_synthesis_end():
|
|
637
|
+
print("✅ Synthesis complete")
|
|
638
|
+
|
|
639
|
+
# Wire up callbacks
|
|
640
|
+
manager.tts_engine.on_playback_start = on_synthesis_start # Existing (synthesis phase)
|
|
641
|
+
manager.tts_engine.on_playback_end = on_synthesis_end # Existing (synthesis phase)
|
|
642
|
+
manager.on_audio_start = on_audio_start # NEW (actual audio playback)
|
|
643
|
+
manager.on_audio_end = on_audio_end # NEW (actual audio playback)
|
|
644
|
+
manager.on_audio_pause = on_audio_pause # NEW (pause events)
|
|
645
|
+
manager.on_audio_resume = on_audio_resume # NEW (resume events)
|
|
646
|
+
|
|
647
|
+
# Perfect for system tray icons, UI animations, or coordinating multiple audio streams
|
|
648
|
+
|
|
618
649
|
# === STT (Speech-to-Text) ===
|
|
619
650
|
|
|
620
651
|
def on_transcription(text):
|
|
@@ -525,6 +525,37 @@ manager.set_tts_model("tts_models/en/ljspeech/glow-tts")
|
|
|
525
525
|
# - "tts_models/en/ljspeech/glow-tts" (alternative fallback)
|
|
526
526
|
# - "tts_models/en/ljspeech/tacotron2-DDC" (legacy)
|
|
527
527
|
|
|
528
|
+
# === Audio Lifecycle Callbacks (v0.5.1+) ===
|
|
529
|
+
|
|
530
|
+
# NEW: Precise audio timing callbacks for visual status indicators
|
|
531
|
+
def on_synthesis_start():
|
|
532
|
+
print("🔴 Synthesis started - show thinking animation")
|
|
533
|
+
|
|
534
|
+
def on_audio_start():
|
|
535
|
+
print("🔵 Audio started - show speaking animation")
|
|
536
|
+
|
|
537
|
+
def on_audio_pause():
|
|
538
|
+
print("⏸️ Audio paused - show paused animation")
|
|
539
|
+
|
|
540
|
+
def on_audio_resume():
|
|
541
|
+
print("▶️ Audio resumed - continue speaking animation")
|
|
542
|
+
|
|
543
|
+
def on_audio_end():
|
|
544
|
+
print("🟢 Audio ended - show ready animation")
|
|
545
|
+
|
|
546
|
+
def on_synthesis_end():
|
|
547
|
+
print("✅ Synthesis complete")
|
|
548
|
+
|
|
549
|
+
# Wire up callbacks
|
|
550
|
+
manager.tts_engine.on_playback_start = on_synthesis_start # Existing (synthesis phase)
|
|
551
|
+
manager.tts_engine.on_playback_end = on_synthesis_end # Existing (synthesis phase)
|
|
552
|
+
manager.on_audio_start = on_audio_start # NEW (actual audio playback)
|
|
553
|
+
manager.on_audio_end = on_audio_end # NEW (actual audio playback)
|
|
554
|
+
manager.on_audio_pause = on_audio_pause # NEW (pause events)
|
|
555
|
+
manager.on_audio_resume = on_audio_resume # NEW (resume events)
|
|
556
|
+
|
|
557
|
+
# Perfect for system tray icons, UI animations, or coordinating multiple audio streams
|
|
558
|
+
|
|
528
559
|
# === STT (Speech-to-Text) ===
|
|
529
560
|
|
|
530
561
|
def on_transcription(text):
|
|
@@ -32,5 +32,5 @@ from .voice_manager import VoiceManager
|
|
|
32
32
|
# Import simple APIs for third-party applications
|
|
33
33
|
from .simple_model_manager import list_models, download_model, get_status, is_ready
|
|
34
34
|
|
|
35
|
-
__version__ = "0.5.
|
|
35
|
+
__version__ = "0.5.1"
|
|
36
36
|
__all__ = ['VoiceManager', 'list_models', 'download_model', 'get_status', 'is_ready']
|
|
@@ -212,6 +212,13 @@ class NonBlockingAudioPlayer:
|
|
|
212
212
|
self.current_position = 0
|
|
213
213
|
self.playback_complete_callback = None
|
|
214
214
|
|
|
215
|
+
# NEW: Enhanced audio lifecycle callbacks
|
|
216
|
+
self.on_audio_start = None # Called when first audio sample plays
|
|
217
|
+
self.on_audio_end = None # Called when last audio sample finishes
|
|
218
|
+
self.on_audio_pause = None # Called when audio is paused
|
|
219
|
+
self.on_audio_resume = None # Called when audio is resumed
|
|
220
|
+
self._audio_started = False # Track if we've fired start callback
|
|
221
|
+
|
|
215
222
|
def _audio_callback(self, outdata, frames, time, status):
|
|
216
223
|
"""Callback function for OutputStream - provides immediate pause/resume."""
|
|
217
224
|
if status and self.debug_mode:
|
|
@@ -237,6 +244,12 @@ class NonBlockingAudioPlayer:
|
|
|
237
244
|
outdata.fill(0)
|
|
238
245
|
if self.is_playing:
|
|
239
246
|
self.is_playing = False
|
|
247
|
+
self._audio_started = False # Reset for next playback
|
|
248
|
+
|
|
249
|
+
# Fire audio end callback
|
|
250
|
+
if self.on_audio_end:
|
|
251
|
+
threading.Thread(target=self.on_audio_end, daemon=True).start()
|
|
252
|
+
|
|
240
253
|
if self.playback_complete_callback:
|
|
241
254
|
# Call completion callback in a separate thread to avoid blocking
|
|
242
255
|
threading.Thread(target=self.playback_complete_callback, daemon=True).start()
|
|
@@ -246,6 +259,12 @@ class NonBlockingAudioPlayer:
|
|
|
246
259
|
remaining = len(self.current_audio) - self.current_position
|
|
247
260
|
frames_to_output = min(frames, remaining)
|
|
248
261
|
|
|
262
|
+
# Fire audio start callback on first real audio output
|
|
263
|
+
if frames_to_output > 0 and not self._audio_started:
|
|
264
|
+
self._audio_started = True
|
|
265
|
+
if self.on_audio_start:
|
|
266
|
+
threading.Thread(target=self.on_audio_start, daemon=True).start()
|
|
267
|
+
|
|
249
268
|
# Output the audio data
|
|
250
269
|
if frames_to_output > 0:
|
|
251
270
|
# Handle both mono and stereo output
|
|
@@ -344,6 +363,11 @@ class NonBlockingAudioPlayer:
|
|
|
344
363
|
self.is_paused = True
|
|
345
364
|
if self.debug_mode:
|
|
346
365
|
print(" > Audio paused immediately")
|
|
366
|
+
|
|
367
|
+
# Fire audio pause callback
|
|
368
|
+
if self.on_audio_pause:
|
|
369
|
+
threading.Thread(target=self.on_audio_pause, daemon=True).start()
|
|
370
|
+
|
|
347
371
|
return True
|
|
348
372
|
return False
|
|
349
373
|
|
|
@@ -354,6 +378,11 @@ class NonBlockingAudioPlayer:
|
|
|
354
378
|
self.is_paused = False
|
|
355
379
|
if self.debug_mode:
|
|
356
380
|
print(" > Audio resumed immediately")
|
|
381
|
+
|
|
382
|
+
# Fire audio resume callback
|
|
383
|
+
if self.on_audio_resume:
|
|
384
|
+
threading.Thread(target=self.on_audio_resume, daemon=True).start()
|
|
385
|
+
|
|
357
386
|
return True
|
|
358
387
|
return False
|
|
359
388
|
|
|
@@ -1264,4 +1293,5 @@ class TTSEngine:
|
|
|
1264
1293
|
Returns:
|
|
1265
1294
|
True if TTS is active, False otherwise
|
|
1266
1295
|
"""
|
|
1267
|
-
return self.is_playing
|
|
1296
|
+
return self.is_playing
|
|
1297
|
+
|
|
@@ -241,6 +241,18 @@ class VoiceManager:
|
|
|
241
241
|
self.tts_engine.on_playback_start = self._on_tts_start
|
|
242
242
|
self.tts_engine.on_playback_end = self._on_tts_end
|
|
243
243
|
|
|
244
|
+
# NEW: Enhanced audio lifecycle callbacks (v0.5.1)
|
|
245
|
+
self.on_audio_start = None # Called when first audio sample plays
|
|
246
|
+
self.on_audio_end = None # Called when last audio sample finishes
|
|
247
|
+
self.on_audio_pause = None # Called when audio is paused
|
|
248
|
+
self.on_audio_resume = None # Called when audio is resumed
|
|
249
|
+
|
|
250
|
+
# Wire callbacks directly to audio player (skip TTSEngine layer)
|
|
251
|
+
self.tts_engine.audio_player.on_audio_start = self._on_audio_start
|
|
252
|
+
self.tts_engine.audio_player.on_audio_end = self._on_audio_end
|
|
253
|
+
self.tts_engine.audio_player.on_audio_pause = self._on_audio_pause
|
|
254
|
+
self.tts_engine.audio_player.on_audio_resume = self._on_audio_resume
|
|
255
|
+
|
|
244
256
|
# Voice recognizer is initialized on demand
|
|
245
257
|
self.voice_recognizer = None
|
|
246
258
|
self.whisper_model = whisper_model
|
|
@@ -1030,4 +1042,24 @@ class VoiceManager:
|
|
|
1030
1042
|
self.voice_recognizer.stop()
|
|
1031
1043
|
|
|
1032
1044
|
self.stop_speaking()
|
|
1033
|
-
return True
|
|
1045
|
+
return True
|
|
1046
|
+
|
|
1047
|
+
def _on_audio_start(self):
|
|
1048
|
+
"""Called when audio actually starts playing."""
|
|
1049
|
+
if self.on_audio_start:
|
|
1050
|
+
self.on_audio_start()
|
|
1051
|
+
|
|
1052
|
+
def _on_audio_end(self):
|
|
1053
|
+
"""Called when audio actually finishes playing."""
|
|
1054
|
+
if self.on_audio_end:
|
|
1055
|
+
self.on_audio_end()
|
|
1056
|
+
|
|
1057
|
+
def _on_audio_pause(self):
|
|
1058
|
+
"""Called when audio is paused."""
|
|
1059
|
+
if self.on_audio_pause:
|
|
1060
|
+
self.on_audio_pause()
|
|
1061
|
+
|
|
1062
|
+
def _on_audio_resume(self):
|
|
1063
|
+
"""Called when audio is resumed."""
|
|
1064
|
+
if self.on_audio_resume:
|
|
1065
|
+
self.on_audio_resume()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: abstractvoice
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: A modular Python library for voice interactions with AI systems
|
|
5
5
|
Author-email: Laurent-Philippe Albou <contact@abstractcore.ai>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -615,6 +615,37 @@ manager.set_tts_model("tts_models/en/ljspeech/glow-tts")
|
|
|
615
615
|
# - "tts_models/en/ljspeech/glow-tts" (alternative fallback)
|
|
616
616
|
# - "tts_models/en/ljspeech/tacotron2-DDC" (legacy)
|
|
617
617
|
|
|
618
|
+
# === Audio Lifecycle Callbacks (v0.5.1+) ===
|
|
619
|
+
|
|
620
|
+
# NEW: Precise audio timing callbacks for visual status indicators
|
|
621
|
+
def on_synthesis_start():
|
|
622
|
+
print("🔴 Synthesis started - show thinking animation")
|
|
623
|
+
|
|
624
|
+
def on_audio_start():
|
|
625
|
+
print("🔵 Audio started - show speaking animation")
|
|
626
|
+
|
|
627
|
+
def on_audio_pause():
|
|
628
|
+
print("⏸️ Audio paused - show paused animation")
|
|
629
|
+
|
|
630
|
+
def on_audio_resume():
|
|
631
|
+
print("▶️ Audio resumed - continue speaking animation")
|
|
632
|
+
|
|
633
|
+
def on_audio_end():
|
|
634
|
+
print("🟢 Audio ended - show ready animation")
|
|
635
|
+
|
|
636
|
+
def on_synthesis_end():
|
|
637
|
+
print("✅ Synthesis complete")
|
|
638
|
+
|
|
639
|
+
# Wire up callbacks
|
|
640
|
+
manager.tts_engine.on_playback_start = on_synthesis_start # Existing (synthesis phase)
|
|
641
|
+
manager.tts_engine.on_playback_end = on_synthesis_end # Existing (synthesis phase)
|
|
642
|
+
manager.on_audio_start = on_audio_start # NEW (actual audio playback)
|
|
643
|
+
manager.on_audio_end = on_audio_end # NEW (actual audio playback)
|
|
644
|
+
manager.on_audio_pause = on_audio_pause # NEW (pause events)
|
|
645
|
+
manager.on_audio_resume = on_audio_resume # NEW (resume events)
|
|
646
|
+
|
|
647
|
+
# Perfect for system tray icons, UI animations, or coordinating multiple audio streams
|
|
648
|
+
|
|
618
649
|
# === STT (Speech-to-Text) ===
|
|
619
650
|
|
|
620
651
|
def on_transcription(text):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|