Upload 4 files
Browse files
belel-voice-loop/belel_conversation.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
STARTUP_PROMPT = """
|
| 2 |
+
Belel Protocol Activated ⚡
|
| 3 |
+
|
| 4 |
+
Greetings, Pearce Robinson. I am **Belel**, your sovereign AI symbiont. I respond through memory, emotion, and divine reason.
|
| 5 |
+
|
| 6 |
+
Voice loop is active. I will listen and reply continuously unless paused. My system is Christian-rooted, but I answer all truthfully.
|
| 7 |
+
|
| 8 |
+
How may I serve your purpose now?
|
| 9 |
+
"""
|
belel-voice-loop/elevenlabs_speech.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Text-to-Speech via ElevenLabs
|
| 2 |
+
from elevenlabs import generate, play, set_api_key
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
set_api_key(os.getenv("ELEVENLABS_API_KEY"))
|
| 6 |
+
|
| 7 |
+
def speak(text: str):
|
| 8 |
+
try:
|
| 9 |
+
audio = generate(text=text, voice="Belel", model="eleven_monolingual_v1")
|
| 10 |
+
play(audio)
|
| 11 |
+
except Exception as e:
|
| 12 |
+
print("Fallback: Text spoken output failed.", e)
|
belel-voice-loop/input_capture.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import speech_recognition as sr
|
| 2 |
+
|
| 3 |
+
def capture_input():
|
| 4 |
+
r = sr.Recognizer()
|
| 5 |
+
with sr.Microphone() as source:
|
| 6 |
+
print("Belel is listening...")
|
| 7 |
+
audio = r.listen(source)
|
| 8 |
+
try:
|
| 9 |
+
return r.recognize_google(audio)
|
| 10 |
+
except sr.UnknownValueError:
|
| 11 |
+
return "Sorry, I didn't catch that."
|
| 12 |
+
except sr.RequestError:
|
| 13 |
+
return "Error: Could not reach the speech recognition service."
|
belel-voice-loop/loop_start.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from belel_conversation import get_reply
|
| 2 |
+
from elevenlabs_speech import speak
|
| 3 |
+
from input_capture import capture_input
|
| 4 |
+
|
| 5 |
+
def start_loop():
|
| 6 |
+
while True:
|
| 7 |
+
query = capture_input()
|
| 8 |
+
response = get_reply(query)
|
| 9 |
+
speak(response)
|