Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Gallery: embed a public-domain audio chime in the Picnic deck

nyblnet8657c1e311b8
diff --git a/scripts/build-example-decks.mjs b/scripts/build-example-decks.mjs
index 9bd72af2..84acbbc2 100644
--- a/scripts/build-example-decks.mjs
+++ b/scripts/build-example-decks.mjs
@@ -85,6 +85,20 @@ const img = (o) => ({
src: `asset:${o.asset}`, fit: o.fit ?? 'cover', radius: o.radius ?? 0,
...(o.fx ? { fx: o.fx } : {}), ...(o.shadow ? { shadow: o.shadow } : {}),
})
+// embedded media (audio/video) as a data URI — same self-contained technique
+// as photo(). Small clips embed; big ones should pass a URL in `src` instead.
+const mediaFile = (name, mime) =>
+ `data:${mime};base64,` + readFileSync(join(root, 'scripts/gallery-media', name)).toString('base64')
+const media = (o) => ({
+ id: o.id ?? id('m'), type: 'media', kind: o.kind, x: o.x, y: o.y, w: o.w, h: o.h,
+ rotation: o.rotation ?? 0, opacity: o.opacity ?? 1, src: o.src,
+ ...(o.poster ? { poster: o.poster } : {}),
+ ...(o.fit ? { fit: o.fit } : {}), ...(o.radius != null ? { radius: o.radius } : {}),
+ ...(o.controls != null ? { controls: o.controls } : {}),
+ ...(o.autoplay ? { autoplay: o.autoplay } : {}), ...(o.loop ? { loop: o.loop } : {}),
+ ...(o.muted ? { muted: o.muted } : {}),
+ ...(o.fx ? { fx: o.fx } : {}), ...(o.shadow ? { shadow: o.shadow } : {}),
+})
const slide = (o) => ({
id: o.id ?? id('sl'), background: o.background, transition: o.transition ?? 'fade',
notes: o.notes ?? '', elements: o.elements,
@@ -577,6 +591,11 @@ function deckPicnic() {
shape('rect', { x: 645, y: 405, w: 230, h: 272, radius: 12, fill: '#FFFFFF', stroke: INK, strokeWidth: 4, rotation: -5, shadow: sticker, fx: { enter: 'fade-up', order: 1 } }),
img({ asset: 'ph-fair', x: 661, y: 421, w: 198, h: 204, radius: 6, rotation: -5, fx: { enter: 'fade-up', order: 1, ambient: 'kenburns', ken: { dir: 'drift', scale: 1.04, duration: 16 } } }),
text({ x: 661, y: 633, w: 198, h: 30, html: 'last picnic!!', fontSize: 16, fontWeight: 800, color: INK, align: 'center', rotation: -5, fx: { enter: 'fade-up', order: 1 } }),
+ // Embedded audio (self-contained) — a short chime synthesised in
+ // build-example-decks.mjs, so it's unambiguously public domain. Demos the
+ // media element's embed path: the sound travels inside the .bento.html.
+ text({ x: 130, y: 556, w: 360, h: 26, html: '▶ press play — the picnic jingle', fontSize: 15, fontWeight: 800, color: INK, rotation: -1 }),
+ media({ id: 'pic-jingle', kind: 'audio', src: mediaFile('chime.wav', 'audio/wav'), x: 130, y: 590, w: 320, h: 44, radius: 12, controls: true }),
text({ x: 130, y: 682, w: 700, h: 20, html: 'PHOTOS: JACK DELANO, 1941 · LIBRARY OF CONGRESS — PUBLIC DOMAIN', fontSize: 9, fontWeight: 700, letterSpacing: 2, color: 'rgba(32,26,49,0.55)' }),
],
})
diff --git a/scripts/gallery-media/chime.wav b/scripts/gallery-media/chime.wav
new file mode 100644
index 00000000..978a553f
Binary files /dev/null and b/scripts/gallery-media/chime.wav differ
diff --git a/scripts/gallery-photos/SOURCES.md b/scripts/gallery-photos/SOURCES.md
index 50ee2762..b01ae6f1 100644
--- a/scripts/gallery-photos/SOURCES.md
+++ b/scripts/gallery-photos/SOURCES.md
@@ -85,3 +85,10 @@ display shows. The three STATE backdrops (nebula, aurora, dragon) render dimmed
under 55–72% scrims, where fine detail is invisible: nebula 1600 px q60, aurora
& dragon 1800 px q64. Orbital photos 5.7 MB → 2.0 MB; deck ~7.9 MB → ~4.1 MB.
Spot-checked at full brightness — no visible artefacts. Same frames/crops.
+
+## Media (v0.9.18)
+
+- `gallery-media/chime.wav` — a short major-pentatonic chime **synthesised in
+ `scripts/build-example-decks.mjs`** (native WAV, no external source), so it is
+ original work released into the **public domain**. Embedded in the Picnic
+ deck cover to demonstrate the audio media element.