Skip to content Skip to footer
0 items - $0.00 0

The Holy gospel in mp3

import pyttsx3

def pick_voice(engine, prefer_lang_prefixes):
try:
voices = engine.getProperty(‘voices’)
for v in voices:
# languages may be a list of bytes; normalize to string
langs = []
if hasattr(v, ‘languages’) and v.languages:
for l in v.languages:
try:
langs.append(l.decode(‘utf-8’) if isinstance(l, (bytes, bytearray)) else str(l))
except Exception:
pass
name = (getattr(v, ‘name’, ”) or ”).lower()
lang_blob = ” “.join(langs).lower()
for pref in prefer_lang_prefixes:
if pref in lang_blob or pref in name:
return v.id
# fallback
return voices[0].id if voices else None
except Exception:
return None

# Initialize engine and choose voices
engine_en = pyttsx3.init()
engine_en.setProperty(“rate”, 148)
engine_en.setProperty(“volume”, 1.0)
en_voice_id = pick_voice(engine_en, [‘en’, ‘english’, ‘samantha’, ‘zira’, ‘david’, ‘aria’, ‘daniel’, ‘moira’])
if en_voice_id:
engine_en.setProperty(‘voice’, en_voice_id)

engine_es = pyttsx3.init()
engine_es.setProperty(“rate”, 148)
engine_es.setProperty(“volume”, 1.0)
es_voice_id = pick_voice(engine_es, [‘es’, ‘spanish’, ‘es_’, ‘camila’, ‘lucia’, ‘paulina’])
if es_voice_id:
engine_es.setProperty(‘voice’, es_voice_id)

# Texts
en_text = “””
Gospel according to Luke, Chapter 14, verses 25 to 33.

Great crowds were traveling with Jesus, and he turned and addressed them:
If anyone comes to me without hating his father and mother, wife and children, brothers and sisters,
and even his own life, he cannot be my disciple.
Whoever does not carry his own cross and come after me cannot be my disciple.

Which of you wishing to construct a tower does not first sit down and calculate the cost
to see if there is enough for its completion? Otherwise, after laying the foundation
and finding himself unable to finish the work, onlookers would laugh and say,
This one began to build but did not have the resources to finish.

Or what king marching into battle would not first sit down and decide whether out of ten thousand troops
he could successfully oppose another king advancing with twenty thousand troops?
If not, while he is still far away, he will send a delegation to ask for terms of peace.

In the same way, anyone of you who does not renounce all his possessions cannot be my disciple.
The Gospel of the Lord.
“””

es_text = “””
Evangelio según San Lucas, capítulo 14, versículos 25 al 33.

Mucha gente acompañaba a Jesús; él se volvió y les dijo:
Si alguno viene a mí y no me ama más que a su padre y a su madre, a su esposa y a sus hijos,
a sus hermanos y a sus hermanas, y aun más que a su propia vida, no puede ser mi discípulo.
Quien no carga con su cruz y me sigue, no puede ser mi discípulo.

¿Quién de ustedes, queriendo construir una torre, no se sienta primero a calcular los gastos
para ver si tiene con qué terminarla? No sea que, después de echar los cimientos,
no pueda acabarla y todos los que lo vean comiencen a burlarse, diciendo:
Este hombre empezó a construir y no pudo terminar.

¿O qué rey, cuando va a enfrentarse a otro rey en guerra, no se sienta primero a considerar
si con diez mil puede hacer frente al que viene contra él con veinte mil?
Y si no puede, cuando el otro está todavía lejos, envía una embajada para pedir condiciones de paz.

Así pues, cualquiera de ustedes que no renuncie a todos sus bienes, no puede ser mi discípulo.
Palabra del Señor.
“””

# Paths
en_path = “/mnt/data/Holygospeltoday_EN.mp3”
es_path = “/mnt/data/Holygospeltoday_ES.mp3”

# Save
engine_en.save_to_file(en_text, en_path)
engine_en.runAndWait()

engine_es.save_to_file(es_text, es_path)
engine_es.runAndWait()

(en_path, es_path)