synchro du labo (0bf0da65) : app.blade.php, README.md

This commit is contained in:
cloudion 2026-11-03 22:42:39 +00:00
commit 13f84142cf
2 changed files with 114 additions and 0 deletions

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# 🗣 Voix
Synthèse vocale : lit n'importe quel texte à voix haute (choix de la voix, débit, hauteur). 100% local. Composé de bions.
| | |
| --- | --- |
| id | `voix` |
| fournit | `tts` `speech` `read` |
| bions qu'il nomme | `jOSApps` |
| fichiers | `app.blade.php` |
| dans le labo | `resources/views/ploxions/voix/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=voix — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre voix` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
© 2026 chill-tekk · ne pas nuire

93
app.blade.php Normal file
View File

@ -0,0 +1,93 @@
{{-- PL0XION voix — synthèse vocale (von Neumann, forge PAR BIONS). Lit n'importe
quel texte à voix haute (Web Speech API, 100% local, aucune donnée n'est
envoyée). Choix de la voix, débit/hauteur, play/pause/stop. Réglages persistés
(bion store). Composé sur window.jOSb. mount(c,ctx)->{unmount}. --}}
@include('ploxions._bions')
<style>
.vx { display:flex; flex-direction:column; height:100%; background:#0a0c11; color:#e8edf5; font-family:ui-sans-serif,system-ui,sans-serif; font-size:.84rem; }
.vx__bar { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:8px 11px; border-bottom:1px solid rgba(120,200,255,.18); }
.vx__t { font-weight:800; color:#67e8f9; }
.vx textarea { flex:1; min-height:80px; box-sizing:border-box; resize:none; margin:11px; background:rgba(0,0,0,.32); border:1px solid rgba(120,200,255,.22);
border-radius:10px; color:#dbeefb; padding:11px; font:0.92rem ui-sans-serif,system-ui; outline:none; line-height:1.5; }
.vx textarea:focus { border-color:rgba(103,232,249,.55); }
.vx__cfg { flex:0 0 auto; display:flex; flex-direction:column; gap:9px; padding:0 11px 8px; }
.vx__r { display:flex; align-items:center; gap:9px; font-size:.74rem; color:rgba(200,220,240,.8); }
.vx__r select, .vx__r input[type=range] { flex:1; min-width:0; }
.vx__r select { background:rgba(16,26,42,.7); color:#dbeefb; border:1px solid rgba(120,200,255,.3); border-radius:7px; padding:5px 7px; font:inherit; }
.vx__r input[type=range] { accent-color:#67e8f9; }
.vx__r b { width:34px; text-align:right; color:rgba(180,220,245,.7); font-variant-numeric:tabular-nums; }
.vx__row { flex:0 0 auto; display:flex; gap:8px; justify-content:center; padding:10px 11px; border-top:1px solid rgba(120,200,255,.14); }
.vx__b { cursor:pointer; border-radius:10px; border:1px solid rgba(103,232,249,.4); background:rgba(14,44,60,.5); color:#bdf0fb; font-size:.86rem; padding:10px 18px; font-weight:600; }
.vx__b:hover { background:rgba(20,64,86,.6); }
.vx__b.main { background:#67e8f9; color:#04222a; border:0; font-weight:800; }
.vx__warn { padding:18px; text-align:center; color:rgba(200,220,240,.6); }
</style>
<script>
(function () {
'use strict';
function describe(){
var store = window.jOSb ? jOSb.store('xb:voix') : { get: function (d) { return d; } };
var cfg = store.get({ rate: 1, pitch: 1, voice: '' }) || { rate: 1, pitch: 1, voice: '' };
return { v:1, id:'voix', title:'Voix', icon:'🗣', items:[
{ p:1, kind:'stat', label:'voix choisie', value: cfg.voice || 'défaut' },
{ p:3, kind:'stat', label:'débit', value: cfg.rate }
]};
}
function mount(container, ctx) {
var synth = window.speechSynthesis;
if (!synth || !window.SpeechSynthesisUtterance) {
container.innerHTML = '<div class="vx"><div class="vx__warn">🔇 La synthèse vocale n\'est pas dispo dans ce navigateur.</div></div>';
return { unmount: function () { container.innerHTML = ''; } };
}
var store = window.jOSb ? jOSb.store('xb:voix') : { get: function (d) { return d; }, set: function () {} };
var cfg = store.get({ rate: 1, pitch: 1, voice: '' }) || { rate: 1, pitch: 1, voice: '' };
var voices = [], utt = null, paused = false;
container.innerHTML =
'<div class="vx">'
+ ' <div class="vx__bar"><span class="vx__t">🗣 Voix</span><span style="font-size:.66rem;color:rgba(180,210,235,.55)">lecture à voix haute · 100% local</span></div>'
+ ' <textarea data-text placeholder="colle ou écris le texte à lire…">Bienvenue dans le xerboxion. Tout est un ploxion.</textarea>'
+ ' <div class="vx__cfg">'
+ ' <div class="vx__r">voix <select data-voice></select></div>'
+ ' <div class="vx__r">débit <input type="range" min="0.5" max="2" step="0.1" data-rate><b data-rv>1.0</b></div>'
+ ' <div class="vx__r">hauteur <input type="range" min="0" max="2" step="0.1" data-pitch><b data-pv>1.0</b></div>'
+ ' </div>'
+ ' <div class="vx__row"><button class="vx__b main" data-play>▶ lire</button><button class="vx__b" data-pause>⏸</button><button class="vx__b" data-stop>■</button></div>'
+ '</div>';
var elText = container.querySelector('[data-text]'), elVoice = container.querySelector('[data-voice]'),
elRate = container.querySelector('[data-rate]'), elPitch = container.querySelector('[data-pitch]'),
elRv = container.querySelector('[data-rv]'), elPv = container.querySelector('[data-pv]'), elPlay = container.querySelector('[data-play]');
elRate.value = cfg.rate; elPitch.value = cfg.pitch; elRv.textContent = (+cfg.rate).toFixed(1); elPv.textContent = (+cfg.pitch).toFixed(1);
function loadVoices() {
voices = synth.getVoices() || [];
// priorité aux voix françaises
voices.sort(function (a, b) { return (b.lang.indexOf('fr') === 0) - (a.lang.indexOf('fr') === 0); });
elVoice.innerHTML = voices.map(function (v, i) { return '<option value="' + i + '"' + (v.name === cfg.voice ? ' selected' : '') + '>' + jOSb.esc(v.name + ' (' + v.lang + ')') + '</option>'; }).join('');
}
loadVoices();
if (synth.onvoiceschanged !== undefined) synth.onvoiceschanged = loadVoices;
function speak() {
synth.cancel(); paused = false;
utt = new SpeechSynthesisUtterance(elText.value);
var v = voices[+elVoice.value]; if (v) { utt.voice = v; utt.lang = v.lang; }
utt.rate = +elRate.value; utt.pitch = +elPitch.value;
utt.onend = function () { elPlay.textContent = '▶ lire'; };
synth.speak(utt); elPlay.textContent = '▶ relire';
}
function save() { cfg.rate = +elRate.value; cfg.pitch = +elPitch.value; var v = voices[+elVoice.value]; cfg.voice = v ? v.name : ''; store.set(cfg); }
elPlay.addEventListener('click', speak);
container.querySelector('[data-pause]').addEventListener('click', function () { if (synth.speaking) { if (paused) { synth.resume(); paused = false; } else { synth.pause(); paused = true; } } });
container.querySelector('[data-stop]').addEventListener('click', function () { synth.cancel(); elPlay.textContent = '▶ lire'; });
elRate.addEventListener('input', function () { elRv.textContent = (+elRate.value).toFixed(1); save(); });
elPitch.addEventListener('input', function () { elPv.textContent = (+elPitch.value).toFixed(1); save(); });
elVoice.addEventListener('change', save);
return { unmount: function () { try { synth.cancel(); } catch (e) {} if (synth.onvoiceschanged !== undefined) synth.onvoiceschanged = null; container.innerHTML = ''; } };
}
window.jOSApps = window.jOSApps || {};
window.jOSApps['voix'] = { manifest: { id: 'voix', name: 'Voix', icon: '🗣' }, mount: mount, describe: describe };
})();
</script>