diff --git a/app.js b/app.js
index 35054bc..64a396d 100644
--- a/app.js
+++ b/app.js
@@ -2784,21 +2784,35 @@ document.getElementById('podcast-toggle').addEventListener('click', () => {
return response.text();
})
.then(text => {
- const utterance = new SpeechSynthesisUtterance(text);
- utterance.lang = 'en-US';
- utterance.rate = 0.9;
- utterance.pitch = 0.9;
+ const paragraphs = text.split('\n\n').filter(p => p.trim());
+
+ if (!paragraphs.length) {
+ throw new Error('No content found in SOUL.md');
+ }
+
+ let index = 0;
+ const speakNext = () => {
+ if (index >= paragraphs.length) return;
+
+ const utterance = new SpeechSynthesisUtterance(paragraphs[index++]);
+ utterance.lang = 'en-US';
+ utterance.rate = 0.9;
+ utterance.pitch = 1.1;
+
+ utterance.onend = () => {
+ setTimeout(speakNext, 800); // 800ms pause between paragraphs
+ };
+
+ speechSynthesis.speak(utterance);
+ };
+
btn.textContent = '⏹';
btn.classList.add('active');
- speechSynthesis.speak(utterance);
- utterance.onend = () => {
- btn.textContent = '🎧';
- btn.classList.remove('active');
- };
+ speakNext();
})
.catch(err => {
console.error('Podcast error:', err);
- alert('Could not load SOUL.md for audio playback.');
+ alert('Could not load SOUL.md. Check console for details.');
btn.textContent = '🎧';
});
} else {
diff --git a/index.html b/index.html
index 4b31701..cf07c36 100644
--- a/index.html
+++ b/index.html
@@ -36,7 +36,7 @@
-