Spaces:
Running
Running
Download ethereum/tools/frames.html from Ethscriptions/POLS: direct link, hf CLI and curl.
- Browser
- Download file 3.66 kB
-
https://huggingface.co/spaces/Ethscriptions/POLS/resolve/main/ethereum/tools/frames.html
- Command line
-
hf download hf://spaces/Ethscriptions/POLS/ethereum/tools/frames.html
-
curl -L -o frames.html https://huggingface.co/spaces/Ethscriptions/POLS/resolve/main/ethereum/tools/frames.html
3.66 kB
| <meta charset="utf-8"><body style="margin:0;background:#000"> | |
| <canvas id="c"></canvas> | |
| <script src="../data/eth-price.js"></script><script src="../js/data-script.js"></script> | |
| <script src="../js/core.js"></script><script src="../js/world.js"></script><script src="../js/chapters.js"></script><script src="../js/render.js"></script><script src="../js/fonts.js"></script><script src="../js/sound.js"></script> | |
| <script> | |
| window.ready = loadFonts('../'); | |
| window.snap = async (t, mode, guides) => { await ready; const L = WORLD.LAYOUTS[mode]; const c = document.getElementById('c'); c.width = L.W; c.height = L.H; RENDER.render(c.getContext('2d'), t, L, { guides }); return c.toDataURL('image/jpeg', 0.82); }; | |
| window.cover = async (mode) => { await ready; const L = WORLD.LAYOUTS[mode]; const c = document.getElementById('c'); c.width = L.W; c.height = L.H; RENDER.renderCover(c.getContext('2d'), L); return c.toDataURL('image/png'); }; | |
| window.bench = async (n, mode) => { await ready; const L = WORLD.LAYOUTS[mode]; const c = document.getElementById('c'); c.width = L.W; c.height = L.H; const x = c.getContext('2d'); const t0 = performance.now(); for (let i = 0; i < n; i++) RENDER.render(x, i * K.TL.total / n, L); return (performance.now() - t0) / n; }; | |
| window.info = () => ({ total: K.TL.total, lines: K.TL.lines.map(l => [+(l.start).toFixed(2), +(l.end).toFixed(2)]), chapters: K.TL.chapters.map(c => [c.id, +c.start.toFixed(2), +c.dur.toFixed(2)]), marks: K.TL.chapters.map(c => [c.id, Object.fromEntries(Object.entries(c.marks).map(([k, v]) => [k, +v.toFixed(2)]))]) }); | |
| </script> | |
| <script> | |
| window.audio = async () => { const t0 = performance.now(); const b = await SOUND.build(() => {}, '../'); window.SND = b; const d = b.getChannelData(0); const seg = (a, e) => { let s = 0, n = 0, pk = 0; for (let i = Math.floor(a * 48000); i < Math.min(d.length, e * 48000); i += 5) { s += d[i] * d[i]; n++; pk = Math.max(pk, Math.abs(d[i])); } return (20 * Math.log10(Math.sqrt(s / n) + 1e-9)).toFixed(1) + '/' + (20 * Math.log10(pk + 1e-9)).toFixed(1); }; return { ms: Math.round(performance.now() - t0), dur: b.duration, all: seg(0, b.duration), chapters: K.TL.chapters.map(c => c.id + ' ' + seg(c.start, c.end)) }; }; | |
| </script> | |
| <script> | |
| window.stems = () => new Promise((res) => { const w = new Worker('../js/sound-worker.js'); const marks = {}; K.TL.chapters.forEach(c => marks[c.id] = c.marks); const t0 = performance.now(); | |
| w.onmessage = (e) => { if (!e.data.done) return; const st = (a) => { let s = 0, pk = 0; for (let i = 0; i < a.length; i += 7) { s += a[i] * a[i]; pk = Math.max(pk, Math.abs(a[i])); } return (20 * Math.log10(Math.sqrt(s / (a.length / 7)))).toFixed(1) + '/' + (20 * Math.log10(pk)).toFixed(1); }; | |
| res({ ms: Math.round(performance.now() - t0), workerMs: e.data.ms, music: st(e.data.music[0]), sfx: st(e.data.sfx[0]) }); }; | |
| w.postMessage({ sr: 48000, total: K.TL.total, chapters: K.TL.chapters.map(c => ({ id: c.id, start: c.start, end: c.end, first: c.lines[0].start })), marks }); }); | |
| </script> | |
| <script>window.audioNoVerb = async () => { window.__VR = 0; return audio(); };</script> | |
| <script>window.audioDC = async () => { await audio(); const d = SND.getChannelData(0); let m = 0; for (let i = 0; i < d.length; i += 3) m += d[i]; m /= d.length / 3; return { mean: m, s: Array.from(d.slice(48000 * 3, 48000 * 3 + 12)).map(v => +v.toFixed(3)) }; };</script> | |
| <script> | |
| window.onlyVO = async () => { __MUS = 0; __SFX = 0; __VO = 1; return audio(); }; | |
| window.onlyMUS = async () => { __MUS = 1; __SFX = 0; __VO = 0; return audio(); }; | |
| window.onlySFX = async () => { __MUS = 0; __SFX = 1; __VO = 0; return audio(); }; | |
| </script> | |