Narrative examples, voice 92 recommendation, and context-preserving browser generation
57494e6 verified Download web/index.html from TuringLogic/little-tts: direct link, hf CLI and curl.
- Browser
- Download file 13 kB
-
https://huggingface.co/TuringLogic/little-tts/resolve/main/web/index.html
- Command line
-
hf download hf://TuringLogic/little-tts/web/index.html
-
curl -L -o index.html https://huggingface.co/TuringLogic/little-tts/resolve/main/web/index.html
13 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Little TTS · English TTS</title> | |
| <meta name="description" content="Little TTS is a 4.65M-parameter English text-to-speech model. This page runs it in your browser."> | |
| <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%23171512'/%3E%3Cpath d='M8 13v6M12 9v14M16 12v8M20 7v18M24 13v6' stroke='%23f4efe6' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| <style> | |
| :root { | |
| --paper: #f6f2ea; --ink: #1b1915; --muted: #6d665b; --line: #d9d2c4; --panel: #fffdf8; | |
| --accent: #b4421f; --accent-ink: #fff; --ok: #2f6b3c; | |
| --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; | |
| --sans: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; | |
| --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; | |
| } | |
| @media (prefers-color-scheme: dark) { | |
| :root { --paper: #151412; --ink: #ece6da; --muted: #9a9284; --line: #35312a; --panel: #1d1b18; --accent: #e0703f; --accent-ink: #151412; --ok: #7fbf8c; } | |
| } | |
| * { box-sizing: border-box; } | |
| body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--ui); } | |
| main { max-width: 760px; margin: 0 auto; padding: 56px 20px 72px; } | |
| header h1 { font: 600 44px/1.05 var(--sans); letter-spacing: -0.01em; margin: 0 0 14px; } | |
| header p { margin: 0; color: var(--muted); max-width: 56ch; } | |
| header p strong { color: var(--ink); font-weight: 600; } | |
| .panel { margin-top: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; } | |
| textarea { width: 100%; min-height: 150px; resize: vertical; border: 0; outline: 0; background: transparent; color: inherit; | |
| font: 20px/1.5 var(--sans); padding: 4px; } | |
| .examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; } | |
| .examples button { font: 13px var(--ui); color: var(--muted); background: transparent; border: 1px solid var(--line); | |
| border-radius: 999px; padding: 5px 11px; cursor: pointer; } | |
| .examples button:hover { color: var(--ink); border-color: var(--muted); } | |
| .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; } | |
| .voice-picker { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); } | |
| .voice-picker select { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px; } | |
| .speed { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); } | |
| .speed input { width: 130px; accent-color: var(--accent); } | |
| .speed output { font: 13px var(--mono); color: var(--ink); min-width: 4ch; } | |
| #speak { margin-left: auto; font: 600 16px var(--ui); color: var(--accent-ink); background: var(--accent); border: 0; | |
| border-radius: 10px; padding: 11px 22px; cursor: pointer; } | |
| #speak:disabled { opacity: 0.45; cursor: default; } | |
| #speak:focus-visible, textarea:focus-visible, .examples button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } | |
| .status { margin-top: 16px; font-size: 14px; color: var(--muted); min-height: 22px; } | |
| .bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 8px; overflow: hidden; } | |
| .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s; } | |
| .bar[hidden] { display: none; } | |
| .result[hidden] { display: none; } | |
| .result { margin-top: 22px; } | |
| audio { width: 100%; } | |
| dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 0; } | |
| dl div { border-top: 1px solid var(--line); padding-top: 8px; } | |
| dt { font-size: 12px; color: var(--muted); } | |
| dd { margin: 2px 0 0; font: 15px var(--mono); } | |
| details { margin-top: 16px; font-size: 14px; color: var(--muted); } | |
| details pre { white-space: pre-wrap; word-break: break-word; font: 13px/1.6 var(--mono); color: var(--ink); margin: 8px 0 0; } | |
| .facts { margin-top: 44px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); } | |
| .facts div { padding: 16px 12px 16px 0; border-bottom: 1px solid var(--line); } | |
| .facts b { display: block; font: 600 22px var(--sans); } | |
| .facts span { font-size: 13px; color: var(--muted); } | |
| footer { margin-top: 36px; font-size: 14px; color: var(--muted); } | |
| footer a { color: var(--ink); text-underline-offset: 3px; margin-right: 16px; } | |
| footer p { margin: 14px 0 0; max-width: 62ch; } | |
| @media (max-width: 560px) { | |
| header h1 { font-size: 34px; } main { padding-top: 36px; } | |
| dl { grid-template-columns: repeat(2, 1fr); } .facts { grid-template-columns: repeat(2, 1fr); } | |
| #speak { margin-left: 0; width: 100%; } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <main> | |
| <header> | |
| <h1>Little TTS</h1> | |
| <p>A <strong>4.65M-parameter</strong> English text-to-speech model with two voices, trained from scratch. | |
| Speech runs locally in your browser, without PyTorch, quantization, or a GPU. Your text stays on your device. <strong>Noncommercial use only.</strong></p> | |
| </header> | |
| <section class="panel"> | |
| <textarea maxlength="350" id="text" spellcheck="false" aria-label="Text to speak">She had never seen the sea before, and for a long while she stood at the edge of the water without saying a word.</textarea> | |
| <div class="examples" id="examples"></div> | |
| <p style="font-size:13px;color:var(--muted)">Voice 92 is recommended. These examples favour narrative reading; pronunciation and naturalness can still vary.</p> | |
| <div class="controls"> | |
| <label class="voice-picker">Voice <select id="voice" aria-label="Voice"> | |
| <option value="0">Voice 92 · recommended</option><option value="1">Voice 6097 · alternate</option> | |
| </select></label> | |
| <label class="speed">Speed <input id="speed" type="range" min="0.8" max="1.2" step="0.05" value="1"><output id="speed-value">1.00</output></label> | |
| <button id="speak" disabled>Speak</button> | |
| </div> | |
| </section> | |
| <div class="status" id="status" role="status">Loading…</div> | |
| <div class="bar" id="bar"><i></i></div> | |
| <section class="result" id="result" hidden> | |
| <audio id="audio" controls></audio> | |
| <dl> | |
| <div><dt>Audio</dt><dd id="m-audio">–</dd></div> | |
| <div><dt>Time to generate</dt><dd id="m-time">–</dd></div> | |
| <div><dt>Speed</dt><dd id="m-speed">–</dd></div> | |
| <div><dt>Real-time factor</dt><dd id="m-phonemes">–</dd></div> | |
| </dl> | |
| <details><summary>Phonemes</summary><pre id="phonemes"></pre></details> | |
| </section> | |
| <section class="facts"> | |
| <div><b>4,648,907</b><span>parameters, waveform generator included</span></div> | |
| <div><b>19.5 MB</b><span>model file (ONNX, float32)</span></div> | |
| <div><b>24 kHz</b><span>mono output</span></div> | |
| <div><b>2 voices</b><span>92 and 6097, English</span></div> | |
| <div><b>29.6 hours</b><span>of real-human training speech</span></div> | |
| <div><b>CC BY-NC 4.0</b><span>weights · noncommercial use only</span></div> | |
| </section> | |
| <section class="panel"> | |
| <h2>CPU speed and memory</h2> | |
| <p>Native ONNX Runtime benchmark: Apple M4 Pro, two threads, 18 utterances. <strong>RTF 0.0091 (110× real time), peak RAM 502 MiB.</strong> These are native Python measurements, not browser speed or RAM. Your browser's measured generation speed appears above after synthesis.</p> | |
| <p>Model: 19.5 MB, plus about 5.4 MB pronunciation files and browser runtimes. No GPU or PyTorch is required. English only, up to 350 characters per request. Longer inputs and mobile browsers may need more time and memory.</p> | |
| </section> | |
| <footer> | |
| <a href="https://github.com/ub1979/little-tts">Code</a> | |
| <a href="https://huggingface.co/TuringLogic/little-tts">Weights</a> | |
| <a href="https://huggingface.co/datasets/MikhailT/hifi-tts">Dataset</a> | |
| <p>The first visit downloads tens of megabytes: the model, the pronunciation dictionary and a Python runtime for the | |
| phonemizer. English only. Foreign names and unusual spellings are often mispronounced.</p> | |
| <p>Source: Apache-2.0. Weights: CC BY-NC 4.0. See the model card for training code, benchmark scripts, data attribution and limitations.</p> | |
| </footer> | |
| </main> | |
| <script> | |
| const EXAMPLES = [ | |
| [ | |
| "Story", | |
| "She had never seen the sea before, and for a long while she stood at the edge of the water without saying a word." | |
| ], | |
| [ | |
| "Morning", | |
| "The morning sunlight streamed through the window, warming the quiet room." | |
| ], | |
| [ | |
| "Garden", | |
| "The garden was quiet, and the air was filled with the scent of roses." | |
| ], | |
| [ | |
| "Journey", | |
| "The road curved gently through the hills, leading us toward the distant village." | |
| ], | |
| [ | |
| "Evening", | |
| "As evening fell, the last light of the day faded slowly from the sky." | |
| ] | |
| ]; | |
| const $ = (id) => document.getElementById(id); | |
| const worker = new Worker("worker.js?v=6"); | |
| let ready = false, busy = false, request = 0, url = null, loadFailed = false; | |
| for (const [label, text] of EXAMPLES) { | |
| const button = document.createElement("button"); | |
| button.textContent = label; | |
| button.onclick = () => { $("text").value = text; $("text").focus(); update(); }; | |
| $("examples").append(button); | |
| } | |
| $("speed").oninput = () => { $("speed-value").textContent = Number($("speed").value).toFixed(2); }; | |
| function setStatus(text, progress) { | |
| $("status").textContent = text; | |
| $("bar").hidden = progress == null; | |
| if (progress != null) $("bar").firstElementChild.style.width = Math.round(progress * 100) + "%"; | |
| } | |
| function update() { $("speak").disabled = !ready || busy || !$("text").value.trim(); } | |
| $("text").oninput = update; | |
| $("voice").onchange = () => { | |
| if (ready && !busy) setStatus($("voice").selectedOptions[0].text + " selected. Press Speak to generate new audio."); | |
| }; | |
| function wav(samples, rate) { | |
| const buffer = new ArrayBuffer(44 + samples.length * 2); | |
| const view = new DataView(buffer); | |
| const text = (offset, value) => { for (let i = 0; i < value.length; i++) view.setUint8(offset + i, value.charCodeAt(i)); }; | |
| text(0, "RIFF"); view.setUint32(4, 36 + samples.length * 2, true); text(8, "WAVEfmt "); | |
| view.setUint32(16, 16, true); view.setUint16(20, 1, true); view.setUint16(22, 1, true); | |
| view.setUint32(24, rate, true); view.setUint32(28, rate * 2, true); view.setUint16(32, 2, true); view.setUint16(34, 16, true); | |
| text(36, "data"); view.setUint32(40, samples.length * 2, true); | |
| for (let i = 0; i < samples.length; i++) view.setInt16(44 + i * 2, Math.max(-1, Math.min(1, samples[i])) * 32767, true); | |
| return new Blob([buffer], { type: "audio/wav" }); | |
| } | |
| let phonemes = []; | |
| worker.onmessage = ({ data }) => { | |
| if (data.type === "status" && !loadFailed) setStatus(data.text, data.progress); | |
| else if (data.type === "ready") { | |
| $("voice").replaceChildren(...data.voices.map((name, i) => new Option("Voice " + name + (name === "92" ? " · recommended" : " · alternate"), String(i)))); | |
| ready = true; setStatus("Ready. Choose a voice, then press Speak."); update(); | |
| } | |
| else if (data.type === "sentence" && data.id === request) { | |
| phonemes.push(data.phonemes); | |
| setStatus(`Generating passage ${data.index + 1} of ${data.total}`, (data.index + 1) / data.total); | |
| } else if (data.type === "done" && data.id === request) { | |
| busy = false; update(); | |
| const seconds = data.audio.length / data.sampleRate; | |
| if (url) URL.revokeObjectURL(url); | |
| url = URL.createObjectURL(wav(data.audio, data.sampleRate)); | |
| $("audio").src = url; | |
| $("audio").play().catch(() => {}); | |
| $("m-audio").textContent = seconds.toFixed(1) + " s"; | |
| $("m-time").textContent = (data.totalTime / 1000).toFixed(2) + " s"; | |
| $("m-speed").textContent = (seconds / (data.totalTime / 1000)).toFixed(1) + "× real time"; | |
| $("m-phonemes").textContent = ((data.totalTime / 1000) / seconds).toFixed(3); | |
| $("phonemes").textContent = phonemes.join("\n"); | |
| $("result").hidden = false; | |
| setStatus("Done · voice " + data.voice + "."); | |
| } else if (data.type === "error") { | |
| if (!ready) loadFailed = true; | |
| busy = false; update(); | |
| setStatus("Something went wrong: " + data.message); | |
| } | |
| }; | |
| worker.onerror = (event) => setStatus("Could not start: " + event.message); | |
| $("speak").onclick = () => { | |
| busy = true; update(); phonemes = []; | |
| request += 1; | |
| setStatus("Generating " + $("voice").selectedOptions[0].text + "…", 0); | |
| worker.postMessage({ type: "speak", id: request, text: $("text").value, | |
| voice: Number($("voice").value), speed: Number($("speed").value) }); | |
| }; | |
| $("text").addEventListener("keydown", (event) => { | |
| if ((event.metaKey || event.ctrlKey) && event.key === "Enter" && !$("speak").disabled) $("speak").click(); | |
| }); | |
| setStatus("Loading the model and the phonemizer…"); | |
| worker.postMessage({ type: "load" }); | |
| </script> | |
| </body> | |
| </html> | |