Initial Upload

This commit is contained in:
2026-02-04 17:09:36 +05:30
commit c2b953529e
9 changed files with 2194 additions and 0 deletions

24
narrate.py Normal file
View File

@@ -0,0 +1,24 @@
import sounddevice as sd
from kokoro import KPipeline
import torch
# Check if we are actually using your RTX 3050
device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Using device: {device}")
# Initialize pipeline with the specific Python 3.12 environment
pipeline = KPipeline(lang_code="a", device=device)
text = """
The RTX 3050 is now narrating this documentation.
Using uv and Python 3.12 ensures that we avoid the build errors
commonly found on Arch Linux's bleeding-edge Python 3.14.
"""
# Generating audio
generator = pipeline(text, voice="af_heart", speed=1.1)
for i, (gs, ps, audio) in enumerate(generator):
print(f"Playing chunk {i}...")
sd.play(audio, samplerate=24000)
sd.wait()