Add the "A Day with Lumi" trailer sources and link the public trailer
The 65-second Inner Breeze trailer is public on YouTube and set as the preview video of every Google Play listing language. design/promo-film keeps its plan, Lumi's chosen voice takes, the score, storyboard keyframes and the scripts that mix the soundtrack and compose the cut with the real app screens.
No files matched your search
@@ -141,8 +141,13 @@ approved public or unlisted YouTube upload with embedding enabled before it can
|
||||
be added to the listing. Pass `--video-url https://www.youtube.com/watch?v=VIDEO_ID`
|
||||
to the listing uploader, or configure `PLAY_VIDEO_URL`. To update only the
|
||||
video, use `PLAY_COMMIT=1 python3 scripts/upload-play-screenshots.py --video-only --video-url URL`.
|
||||
The approved [Lumi preview](https://www.youtube.com/watch?v=XESpbMRaz4o) is
|
||||
available on YouTube and configured in the English Google Play listing.
|
||||
The [Inner Breeze trailer](https://www.youtube.com/watch?v=GTly6Fu5zPk),
|
||||
"A Day with Lumi", is public on YouTube and configured in every Google Play
|
||||
listing language.
|
||||
`design/promo-film/` holds the trailer's sources: `film.json` (clips, voice
|
||||
times, app-screen inserts), `narrate.py` (Lumi's voice), `score.py` (music),
|
||||
`mix.py`, `keyframes.py` and `compose.py`, which renders the cut with the real
|
||||
app screens into `build/promo-video/`.
|
||||
Screenshot publishing still requires the complete current
|
||||
capture, visual review, export and locked build preflight.
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Instrumental score for a premium 65-second promo film of a mindful-living app. No vocals, no choir words. Warm, hopeful and cinematic, 76 BPM, D major. 0-6 s: a hush at dawn, airy pads and one soft felt-piano motif, a single small chime like a firefly lighting up. 6-30 s: gentle bamboo flute melody over the piano, light guzheng plucks, soft breath-like swells. 30-42 s: a graceful East Asian section for a Tai Chi sequence: guzheng and erhu phrase, slow taiko heartbeat, warm low strings. 42-56 s: uplifting build with warm strings, light hand percussion and piano arpeggios, optimistic and bright. 56-65 s: resolve to a tender final chord with a sparkling chime and a clean natural ending, no fade-in loop. Mixed spaciously so a narrator's voice sits clearly on top: no busy midrange, no loud drums.
|
||||
@@ -0,0 +1,326 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Final cut of the promo film: picture, real app screens, end card, soundtrack.
|
||||
|
||||
compose.py --animatic storyboard keyframes with slow camera moves
|
||||
compose.py --base FILM.mp4 the generated film (16:9, cut to the soundtrack)
|
||||
|
||||
Options: --from S --to S render a range, --still S writes one frame as PNG.
|
||||
Output goes to build/promo-video/.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import math
|
||||
import subprocess
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw, ImageFilter, ImageFont
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parents[1]
|
||||
BUILD = ROOT / "build/promo-video"
|
||||
SCREENS = ROOT / "fastlane/metadata/android/en-US/images/phoneScreenshots"
|
||||
SUN_FRAMES = ROOT / "assets/practices/sunsalutation/characters/01-sunrise-ponytail"
|
||||
WIDTH, HEIGHT, FPS = 1920, 1080, 24
|
||||
APP_BACKGROUND = (245, 248, 246)
|
||||
APP_TEXT = (31, 42, 40)
|
||||
NOTO = "/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf"
|
||||
NOTO_MEDIUM = "/usr/share/fonts/truetype/noto/NotoSans-Medium.ttf"
|
||||
QUICKSAND_BOLD = "/usr/share/fonts/truetype/quicksand/Quicksand-Bold.ttf"
|
||||
QUICKSAND_MEDIUM = "/usr/share/fonts/truetype/quicksand/Quicksand-Medium.ttf"
|
||||
|
||||
# Phone mockup: screen 486x864 (a 1080x1920 capture at 0.45).
|
||||
SCREEN_W, SCREEN_H, BEZEL = 486, 864, 16
|
||||
PHONE_W, PHONE_H = SCREEN_W + 2 * BEZEL, SCREEN_H + 2 * BEZEL
|
||||
SHADOW_PAD = 60
|
||||
|
||||
|
||||
def font(path, size):
|
||||
return ImageFont.truetype(path, size)
|
||||
|
||||
|
||||
def ease_out(value):
|
||||
value = min(1.0, max(0.0, value))
|
||||
return 1 - (1 - value) ** 3
|
||||
|
||||
|
||||
def ease_in_out(value):
|
||||
value = min(1.0, max(0.0, value))
|
||||
return value * value * (3 - 2 * value)
|
||||
|
||||
|
||||
@lru_cache(None)
|
||||
def capture(name):
|
||||
return Image.open(SCREENS / f"{name}.png").convert("RGB")
|
||||
|
||||
|
||||
def blank(image, box):
|
||||
ImageDraw.Draw(image).rectangle(box, fill=APP_BACKGROUND)
|
||||
|
||||
|
||||
def centered_text(image, text, center_x, top, typeface, fill=APP_TEXT):
|
||||
draw = ImageDraw.Draw(image)
|
||||
left, upper, right, lower = draw.textbbox((0, 0), text, font=typeface)
|
||||
draw.text((center_x - (right - left) / 2 - left, top - upper), text, font=typeface, fill=fill)
|
||||
|
||||
|
||||
@lru_cache(None)
|
||||
def sun_frame(index):
|
||||
return Image.open(SUN_FRAMES / f"02-{index:03d}.png").convert("RGBA")
|
||||
|
||||
|
||||
def sun_salutation_screen(local):
|
||||
"""The Sun Salutation practice, Step 2 playing with the heroine's frames."""
|
||||
screen = capture("04-sun-salutation").copy()
|
||||
blank(screen, (300, 500, 800, 1490))
|
||||
blank(screen, (420, 222, 680, 268))
|
||||
seconds = min(8, 3 + int(local))
|
||||
centered_text(screen, f"{seconds}s / 8s", 546, 231, font(NOTO, 36))
|
||||
index = 1 + min(89, int(local * 30))
|
||||
frame = sun_frame(index)
|
||||
scale = 1.93
|
||||
frame = frame.resize((round(frame.width * scale), round(frame.height * scale)), Image.LANCZOS)
|
||||
screen.paste(frame, (540 - frame.width // 2, 1468 - frame.height), frame)
|
||||
return screen
|
||||
|
||||
|
||||
class Clip:
|
||||
"""Reads a rendered lesson video frame by frame at the film's rate."""
|
||||
|
||||
def __init__(self, path, size, crop=""):
|
||||
self.size = size
|
||||
self.process = subprocess.Popen(
|
||||
["ffmpeg", "-loglevel", "error", "-i", str(path), "-vf",
|
||||
f"{crop}fps={FPS},scale={size[0]}:{size[1]}:flags=lanczos", "-f", "rawvideo", "-pix_fmt", "rgb24", "-"],
|
||||
stdout=subprocess.PIPE)
|
||||
self.last = None
|
||||
|
||||
def next(self):
|
||||
raw = self.process.stdout.read(self.size[0] * self.size[1] * 3)
|
||||
if len(raw) == self.size[0] * self.size[1] * 3:
|
||||
self.last = Image.frombytes("RGB", self.size, raw)
|
||||
return self.last
|
||||
|
||||
|
||||
LESSONS = {}
|
||||
|
||||
|
||||
def tai_chi_screen(local, key, title, subtitle, video):
|
||||
"""Tai Chi lesson in the practice player's layout, playing the painted lesson."""
|
||||
if key not in LESSONS:
|
||||
LESSONS[key] = Clip(BUILD / "tai-chi" / video, (1080, 1320), "crop=600:733:150:150,")
|
||||
screen = capture("04-sun-salutation").copy()
|
||||
blank(screen, (290, 40, 800, 160))
|
||||
blank(screen, (0, 190, 1080, 1780))
|
||||
centered_text(screen, title, 556, 74, font(NOTO, 50))
|
||||
centered_text(screen, subtitle, 540, 231, font(NOTO, 36))
|
||||
frame = LESSONS[key].next()
|
||||
if frame is not None:
|
||||
screen.paste(frame, (0, 300))
|
||||
return screen
|
||||
|
||||
|
||||
def lists_then_diary(local):
|
||||
lists, diary = capture("06-lists"), capture("07-diary")
|
||||
mix = ease_in_out((local - 2.3) / 0.5)
|
||||
return Image.blend(lists, diary, mix) if 0 < mix < 1 else (diary if mix >= 1 else lists)
|
||||
|
||||
|
||||
INSERTS = {
|
||||
"01-apps": lambda local: capture("01-apps"),
|
||||
"03-practice-home": lambda local: capture("03-practice-home"),
|
||||
"04-sun-salutation": sun_salutation_screen,
|
||||
"tai-chi-monk": lambda local: tai_chi_screen(local, "monk", "Wave Hands Like Clouds", "Lesson 4 · Move 10 of 24",
|
||||
"monk-cloud-hands.mp4"),
|
||||
"tai-chi-woman": lambda local: tai_chi_screen(local, "dolma", "Brush Knee and Push", "Lesson 2 · Move 4 of 24",
|
||||
"dolma-brush-knee.mp4"),
|
||||
"05-habits": lambda local: capture("05-habits"),
|
||||
"07-diary": lists_then_diary,
|
||||
"02-lumi-customize": lambda local: capture("02-lumi-customize"),
|
||||
}
|
||||
|
||||
|
||||
@lru_cache(None)
|
||||
def phone_parts():
|
||||
def rounded(size, radius, fill):
|
||||
image = Image.new("RGBA", size, (0, 0, 0, 0))
|
||||
ImageDraw.Draw(image).rounded_rectangle((0, 0, size[0] - 1, size[1] - 1), radius, fill=fill)
|
||||
return image
|
||||
|
||||
body = rounded((PHONE_W, PHONE_H), 68, (22, 24, 27, 255))
|
||||
rim = Image.new("RGBA", (PHONE_W, PHONE_H), (0, 0, 0, 0))
|
||||
ImageDraw.Draw(rim).rounded_rectangle((1, 1, PHONE_W - 2, PHONE_H - 2), 67, outline=(92, 98, 104, 255), width=2)
|
||||
body.alpha_composite(rim)
|
||||
mask = rounded((SCREEN_W, SCREEN_H), 52, (255, 255, 255, 255)).getchannel("A")
|
||||
shadow = Image.new("RGBA", (PHONE_W + 2 * SHADOW_PAD, PHONE_H + 2 * SHADOW_PAD), (0, 0, 0, 0))
|
||||
ImageDraw.Draw(shadow).rounded_rectangle(
|
||||
(SHADOW_PAD, SHADOW_PAD + 22, SHADOW_PAD + PHONE_W, SHADOW_PAD + PHONE_H + 22), 68, fill=(0, 0, 0, 120))
|
||||
shadow = shadow.filter(ImageFilter.GaussianBlur(26))
|
||||
return body, mask, shadow
|
||||
|
||||
|
||||
def phone(screen):
|
||||
body, mask, shadow = phone_parts()
|
||||
out = shadow.copy()
|
||||
device = body.copy()
|
||||
content = screen.resize((SCREEN_W, SCREEN_H), Image.LANCZOS).convert("RGBA")
|
||||
content.putalpha(mask)
|
||||
device.alpha_composite(content, (BEZEL, BEZEL))
|
||||
out.alpha_composite(device, (SHADOW_PAD, SHADOW_PAD))
|
||||
return out
|
||||
|
||||
|
||||
def place_phone(frame, device, side, local, length):
|
||||
enter = ease_out(local / 0.6)
|
||||
leave = ease_in_out((local - (length - 0.45)) / 0.45)
|
||||
alpha = enter * (1 - leave)
|
||||
if alpha <= 0:
|
||||
return
|
||||
float_y = 6 * math.sin(2 * math.pi * local / 4.5)
|
||||
if side == "center":
|
||||
# An app reveal: the scene softens behind a phone rising into the middle.
|
||||
soft = frame.filter(ImageFilter.GaussianBlur(16 * alpha))
|
||||
dark = Image.new("RGBA", frame.size, (8, 12, 24, round(110 * alpha)))
|
||||
soft.alpha_composite(dark)
|
||||
frame.paste(soft)
|
||||
x = round(WIDTH / 2 - device.width / 2)
|
||||
y = round(HEIGHT / 2 - device.height / 2 + 8 + float_y + 160 * (1 - enter) + 60 * leave)
|
||||
else:
|
||||
direction = 1 if side == "right" else -1
|
||||
shift = direction * (220 * (1 - enter) + 90 * leave)
|
||||
center_x = 1480 if side == "right" else 440
|
||||
x = round(center_x - device.width / 2 + shift)
|
||||
y = round(HEIGHT / 2 - device.height / 2 + 8 + float_y)
|
||||
if alpha < 1:
|
||||
device = device.copy()
|
||||
device.putalpha(device.getchannel("A").point(lambda value: round(value * alpha)))
|
||||
frame.alpha_composite(device, (x, y))
|
||||
|
||||
|
||||
@lru_cache(None)
|
||||
def end_card():
|
||||
card = Image.new("RGBA", (WIDTH, HEIGHT), (0, 0, 0, 0))
|
||||
shade = np.zeros((HEIGHT, WIDTH, 4), np.uint8)
|
||||
rows = np.linspace(0, 1, HEIGHT)
|
||||
title = np.clip(1 - np.abs(rows - 0.42) / 0.5, 0, 1) ** 1.4 * 150
|
||||
footer = np.clip((rows - 0.7) / 0.3, 0, 1) ** 1.2 * 200
|
||||
shade[..., 3] = np.maximum(title, footer)[:, None]
|
||||
shade[..., :3] = (6, 12, 30)
|
||||
card.alpha_composite(Image.fromarray(shade, "RGBA"))
|
||||
logo = Image.open(ROOT / "assets/app/source-icon.png").convert("RGBA").resize((300, 300), Image.LANCZOS)
|
||||
glow = Image.new("RGBA", (WIDTH, HEIGHT), (0, 0, 0, 0))
|
||||
ImageDraw.Draw(glow).ellipse((WIDTH / 2 - 190, 120, WIDTH / 2 + 190, 460), fill=(255, 214, 140, 70))
|
||||
card.alpha_composite(glow.filter(ImageFilter.GaussianBlur(60)))
|
||||
card.alpha_composite(logo, (WIDTH // 2 - 150, 135))
|
||||
centered_text(card, "Inner Breeze", WIDTH / 2, 460, font(QUICKSAND_BOLD, 118), (255, 250, 238, 255))
|
||||
centered_text(card, "Breathe · Move · Grow", WIDTH / 2, 610, font(QUICKSAND_MEDIUM, 46), (247, 220, 160, 255))
|
||||
badges = [Image.open(ROOT / f"assets/app/badge-{name}.png").convert("RGBA") for name in ("google-play", "f-droid")]
|
||||
badges = [badge.resize((round(badge.width * 92 / badge.height), 92), Image.LANCZOS) for badge in badges]
|
||||
gap = 28
|
||||
total = sum(badge.width for badge in badges) + gap
|
||||
x = WIDTH // 2 - total // 2
|
||||
for badge in badges:
|
||||
card.alpha_composite(badge, (x, 860))
|
||||
x += badge.width + gap
|
||||
centered_text(card, "Free, private and open source · also on the web at inbe.waozi.xyz", WIDTH / 2, 985,
|
||||
font(QUICKSAND_MEDIUM, 30), (232, 236, 246, 255))
|
||||
return card
|
||||
|
||||
|
||||
def keyframe(shot):
|
||||
image = Image.open(HERE / "keyframes" / f"shot-{shot:02d}.jpg").convert("RGB")
|
||||
band = round(image.width * 9 / 16)
|
||||
top = (image.height - band) // 2
|
||||
return image.crop((0, top, image.width, top + band))
|
||||
|
||||
|
||||
@lru_cache(None)
|
||||
def keyframe_big(shot):
|
||||
return keyframe(shot).resize((round(WIDTH * 1.12), round(HEIGHT * 1.12)), Image.LANCZOS)
|
||||
|
||||
|
||||
def animatic_frame(film, time):
|
||||
clip = next(clip for clip in film["clips"] if clip["start"] <= time < clip["end"] + 1e-6)
|
||||
local = (time - clip["start"]) / (clip["end"] - clip["start"])
|
||||
name = [name for name, at in clip["keyframes"] if at <= time - clip["start"]][-1]
|
||||
big = keyframe_big(int(name[5:]))
|
||||
zoom = 1.12 - 0.08 * (1 - local) if clip["clip"] % 2 else 1.04 + 0.08 * (1 - local)
|
||||
w, h = round(WIDTH * zoom), round(HEIGHT * zoom)
|
||||
drift = (big.width - w) * (0.35 + 0.3 * local)
|
||||
crop = big.crop((round(drift), round((big.height - h) / 2), round(drift) + w, round((big.height - h) / 2) + h))
|
||||
return crop.resize((WIDTH, HEIGHT), Image.BILINEAR)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--animatic", action="store_true")
|
||||
parser.add_argument("--base")
|
||||
parser.add_argument("--start", type=float, default=0.0)
|
||||
parser.add_argument("--end", type=float)
|
||||
parser.add_argument("--still", type=float)
|
||||
parser.add_argument("--out")
|
||||
args = parser.parse_args()
|
||||
film = json.loads((HERE / "film.json").read_text())
|
||||
length = film["format"]["length"]
|
||||
end = args.end if args.end is not None else length
|
||||
name = "inner-breeze-a-day-with-lumi" + ("-animatic" if args.animatic else "")
|
||||
out = Path(args.out) if args.out else BUILD / f"{name}.mp4"
|
||||
base = None
|
||||
if args.base:
|
||||
base = subprocess.Popen(["ffmpeg", "-loglevel", "error", "-ss", str(args.start), "-i", args.base, "-vf",
|
||||
f"fps={FPS},scale={WIDTH}:{HEIGHT}:flags=lanczos,setsar=1", "-f", "rawvideo",
|
||||
"-pix_fmt", "rgb24", "-"], stdout=subprocess.PIPE)
|
||||
writer = None
|
||||
if args.still is None:
|
||||
writer = subprocess.Popen(
|
||||
["ffmpeg", "-loglevel", "error", "-y", "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", f"{WIDTH}x{HEIGHT}",
|
||||
"-r", str(FPS), "-i", "-", "-ss", str(args.start), "-to", str(end),
|
||||
"-i", str(BUILD / "audio/soundtrack.wav"), "-map", "0:v", "-map", "1:a", "-c:v", "libx264", "-preset",
|
||||
"slow", "-crf", "17", "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "256k", "-movflags", "+faststart",
|
||||
"-shortest", str(out)], stdin=subprocess.PIPE)
|
||||
first = round(args.start * FPS)
|
||||
last = round(end * FPS) if args.still is None else first
|
||||
if args.still is not None:
|
||||
first = last = round(args.still * FPS)
|
||||
for index in range(first, last + (1 if args.still is not None else 0)):
|
||||
time = index / FPS
|
||||
if base:
|
||||
raw = base.stdout.read(WIDTH * HEIGHT * 3)
|
||||
if len(raw) < WIDTH * HEIGHT * 3:
|
||||
break
|
||||
frame = Image.frombytes("RGB", (WIDTH, HEIGHT), raw).convert("RGBA")
|
||||
else:
|
||||
frame = animatic_frame(film, time).convert("RGBA")
|
||||
for insert in film["inserts"]:
|
||||
start, stop = insert["from"], insert["to"]
|
||||
if start <= time < stop:
|
||||
device = phone(INSERTS[insert["screen"]](time - start))
|
||||
place_phone(frame, device, insert["side"], time - start, stop - start)
|
||||
if time >= 59.0:
|
||||
card = end_card()
|
||||
fade = ease_in_out((time - 59.0) / 0.9)
|
||||
if fade < 1:
|
||||
card = card.copy()
|
||||
card.putalpha(card.getchannel("A").point(lambda value: round(value * fade)))
|
||||
frame.alpha_composite(card)
|
||||
fade_in = ease_in_out(time / 0.9)
|
||||
fade_out = ease_in_out((length - time) / 0.8)
|
||||
level = min(fade_in, fade_out)
|
||||
rgb = frame.convert("RGB")
|
||||
if level < 1:
|
||||
rgb = Image.blend(Image.new("RGB", rgb.size, (0, 0, 0)), rgb, level)
|
||||
if writer:
|
||||
writer.stdin.write(rgb.tobytes())
|
||||
else:
|
||||
path = BUILD / f"still-{args.still:05.2f}.png"
|
||||
rgb.save(path)
|
||||
print(path)
|
||||
if writer:
|
||||
writer.stdin.close()
|
||||
writer.wait()
|
||||
print(out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"title": "Inner Breeze: a day with Lumi",
|
||||
"format": {
|
||||
"aspect": "16:9",
|
||||
"length": 65.0,
|
||||
"fps": 24
|
||||
},
|
||||
"score": {
|
||||
"file": "score-1.mp3",
|
||||
"duck_db": -7.0,
|
||||
"fade_out": [
|
||||
61.6,
|
||||
65.0
|
||||
]
|
||||
},
|
||||
"style": "Premium hand-painted storybook 3D animated film, soft watercolor and gouache texture, warm golden light, gentle volumetric haze, shallow depth of field, calm graceful camera moves. Same look as Lumi and the painted Sun Salutation and Tai Chi characters. No text, no logos, no UI on screen.",
|
||||
"cast": {
|
||||
"lumi": "Lumi, a small round olive-green firefly with a cream golden glowing tummy, two curved antennae ending in golden lights, huge warm brown eyes, tiny translucent wings. The guide and narrator.",
|
||||
"mia": "The Inner Breeze heroine from the Sun Salutation practice: a young woman with a light-brown ponytail, sage-teal fitted top and olive leggings, calm and kind.",
|
||||
"monk": "Tibetan monk Tai Chi teacher: shaved head, saffron-yellow sleeveless wrap vest, maroon sash, deep red loose trousers, black cloth shoes.",
|
||||
"teacher": "Tibetan woman Tai Chi teacher: dark braids wound round her head, white long-sleeved shirt, teal wrap vest, rainbow pangden-striped sash, navy loose trousers, red shoes."
|
||||
},
|
||||
"voices": [
|
||||
{
|
||||
"take": "hello-2",
|
||||
"at": 2.0
|
||||
},
|
||||
{
|
||||
"take": "welcome-2",
|
||||
"at": 6.8
|
||||
},
|
||||
{
|
||||
"take": "breathe-2",
|
||||
"at": 12.8
|
||||
},
|
||||
{
|
||||
"take": "meditate-2",
|
||||
"at": 19.6
|
||||
},
|
||||
{
|
||||
"take": "yoga-2",
|
||||
"at": 25.2
|
||||
},
|
||||
{
|
||||
"take": "taichi-2",
|
||||
"at": 30.6
|
||||
},
|
||||
{
|
||||
"take": "habits-2",
|
||||
"at": 42.6
|
||||
},
|
||||
{
|
||||
"take": "diary-2",
|
||||
"at": 48.0
|
||||
},
|
||||
{
|
||||
"take": "ask-2",
|
||||
"at": 53.5
|
||||
},
|
||||
{
|
||||
"take": "end-3",
|
||||
"at": 58.8
|
||||
}
|
||||
],
|
||||
"clips": [
|
||||
{
|
||||
"clip": 1,
|
||||
"start": 0.0,
|
||||
"end": 7.0,
|
||||
"name": "Firefly at dawn",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"SHOT 1"
|
||||
],
|
||||
"mouth": "lip-sync",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-01",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "Blue hour at a misty forest lake. A tiny golden light blinks on among the reeds. Lumi rises into frame, brightens, turns to camera, smiles, waves and says hello."
|
||||
},
|
||||
{
|
||||
"clip": 2,
|
||||
"start": 7.0,
|
||||
"end": 13.0,
|
||||
"name": "Sunrise welcome",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"MIA",
|
||||
"SHOT 2"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-02",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "First sunrise light in a cozy wooden cabin bedroom. Lumi flutters in through the open window; Mia wakes, stretches and smiles at Lumi. Right third of the frame calm and soft."
|
||||
},
|
||||
{
|
||||
"clip": 3,
|
||||
"start": 13.0,
|
||||
"end": 20.0,
|
||||
"name": "Breath on the dock",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"MIA",
|
||||
"SHOT 3"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-03",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "Mia sits cross-legged on a wooden dock over the misty lake at sunrise, eyes closed, taking one slow deep breath; her breath shows in the cool air. Lumi hovers beside her, its glow swelling and softening with her breath. Right third calm."
|
||||
},
|
||||
{
|
||||
"clip": 4,
|
||||
"start": 20.0,
|
||||
"end": 29.3,
|
||||
"name": "Stillness, then the Sun Salutation",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"MIA",
|
||||
"SHOT 4",
|
||||
"SHOT 5"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-04",
|
||||
0.0
|
||||
],
|
||||
[
|
||||
"shot-05",
|
||||
5.0
|
||||
]
|
||||
],
|
||||
"action": "One continuous take on a sunlit mountain ledge above a sea of golden clouds. Mia meditates, hands in her lap; a small brass bell beside her rings and sends one soft ripple of light while Lumi floats still. Then she rises gracefully and flows into the Sun Salutation: arms sweep up into upward salute as Lumi traces a golden arc along her hands. Keep the right third calm in the second half."
|
||||
},
|
||||
{
|
||||
"clip": 5,
|
||||
"start": 29.3,
|
||||
"end": 36.8,
|
||||
"name": "Tai Chi in the monastery",
|
||||
"refs": [
|
||||
"MONK",
|
||||
"MIA",
|
||||
"SHOT 6"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-06",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "Misty Himalayan monastery courtyard at sunrise, prayer flags, stone steps, white stupas. The monk performs Tai Chi Wave Hands Like Clouds with slow flowing arms; Mia beside him follows the same movement in mirror."
|
||||
},
|
||||
{
|
||||
"clip": 6,
|
||||
"start": 36.8,
|
||||
"end": 42.8,
|
||||
"name": "Brush knee and push",
|
||||
"refs": [
|
||||
"DOLMA",
|
||||
"MONK",
|
||||
"LUMI",
|
||||
"SHOT 7"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-07",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "Same courtyard, wider, sun rays through the mist. Dolma and the monk perform Brush Knee and Push in perfect unison, stepping forward and slowly pushing one palm. Lumi draws a thin glowing golden ribbon along the path of their hands."
|
||||
},
|
||||
{
|
||||
"clip": 7,
|
||||
"start": 42.8,
|
||||
"end": 51.8,
|
||||
"name": "Habits and the evening diary",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"MIA",
|
||||
"SHOT 9"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-09",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "One continuous take at Mia's cozy wooden desk by a rain-streaked window in warm lamp light. A glass of water and a bowl of fruit on the desk; above the desk a row of seven small floating circles of light fills with gold one after another as Lumi touches them. Then Mia opens her paper journal and writes with a soft smile while Lumi settles on the lamp shade. Right third calm."
|
||||
},
|
||||
{
|
||||
"clip": 8,
|
||||
"start": 51.8,
|
||||
"end": 58.8,
|
||||
"name": "Just ask",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"MIA",
|
||||
"SHOT 10"
|
||||
],
|
||||
"mouth": "lip-sync",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-10",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "Night. Mia curled up on a sofa under a knitted blanket, holding her phone (screen angled away). Lumi flies up out of the phone's soft glow, says 'just ask', and they share a warm smile. Right third calm."
|
||||
},
|
||||
{
|
||||
"clip": 9,
|
||||
"start": 58.8,
|
||||
"end": 65.0,
|
||||
"name": "A breeze of light",
|
||||
"refs": [
|
||||
"LUMI",
|
||||
"SHOT 11"
|
||||
],
|
||||
"mouth": "resting",
|
||||
"keyframes": [
|
||||
[
|
||||
"shot-11",
|
||||
0.0
|
||||
]
|
||||
],
|
||||
"action": "Starry night above the calm lake. Lumi flies upward, leaving a long golden trail that curls like a gentle breeze across the sky; the camera rises slowly. Upper center of the frame open and dark for the title."
|
||||
}
|
||||
],
|
||||
"inserts": [
|
||||
{
|
||||
"screen": "01-apps",
|
||||
"from": 7.45,
|
||||
"to": 12.8,
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"screen": "03-practice-home",
|
||||
"from": 13.45,
|
||||
"to": 19.8,
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"screen": "04-sun-salutation",
|
||||
"from": 25.0,
|
||||
"to": 29.1,
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"screen": "tai-chi-woman",
|
||||
"from": 37.6,
|
||||
"to": 42.6,
|
||||
"side": "center"
|
||||
},
|
||||
{
|
||||
"screen": "05-habits",
|
||||
"from": 43.25,
|
||||
"to": 47.4,
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"screen": "07-diary",
|
||||
"from": 47.6,
|
||||
"to": 51.6,
|
||||
"side": "right"
|
||||
},
|
||||
{
|
||||
"screen": "02-lumi-customize",
|
||||
"from": 52.25,
|
||||
"to": 58.6,
|
||||
"side": "right"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
[
|
||||
{
|
||||
"shot": 1,
|
||||
"refs": [
|
||||
"lumi"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 1 'Firefly at dawn'. Blue hour at a misty forest lake. A tiny golden light blinks on among the reeds. Lumi rises into frame, brightens, turns to camera, smiles and gives a little wave. Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 2,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 2 'Sunrise welcome'. First sunrise light. Lumi flies through the open window of a cozy wooden cabin bedroom; Mia wakes, stretches and smiles at Lumi. Keep the right third of the frame calm and soft. Compose the main action in the left two thirds; keep the right third calm, soft and uncluttered (soft-focus background only). Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 3,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 3 'Breath on the dock'. Mia sits cross-legged on a wooden dock over the misty lake at sunrise, eyes closed, taking one slow deep breath; her breath shows in the cool air. Lumi hovers beside her and its glow swells and softens with each breath like a breathing circle. Compose the main action in the left two thirds; keep the right third calm, soft and uncluttered (soft-focus background only). Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 4,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 4 'Stillness above the clouds'. Golden morning on a quiet mountain ledge above a sea of clouds. Mia meditates, hands resting in her lap. A small brass bell beside her rings, sending one soft ripple of light through the air. Lumi floats, perfectly still. Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 5,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 5 'Sun Salutation'. Sunlit alpine meadow with distant blue mountains. Mia on a mat flows through the Sun Salutation: arms sweep up into upward salute, then a smooth forward fold. Lumi traces a soft golden arc following her arms. Compose the main action in the left two thirds; keep the right third calm, soft and uncluttered (soft-focus background only). Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 6,
|
||||
"refs": [
|
||||
"monk",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 6 'Tai Chi in the monastery'. Misty Himalayan monastery courtyard at sunrise, prayer flags, stone steps. The Tibetan monk performs Tai Chi Wave Hands Like Clouds with slow flowing arms; Mia stands beside him and follows the same movement in mirror. Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 7,
|
||||
"refs": [
|
||||
"teacher",
|
||||
"monk",
|
||||
"lumi",
|
||||
"keyframe-06"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 7 'Brush knee and push'. Same misty Himalayan monastery courtyard as the last input image (prayer flags, stone steps, white stupas, snowy peaks), now a wider shot with sun rays through the mist. The Tibetan woman teacher and the monk perform Brush Knee and Push in perfect unison, stepping forward and pushing one palm slowly. Lumi draws a thin glowing golden ribbon along the path of their hands. Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 8,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 8 'Little habits'. Bright afternoon park path lined with autumn trees. Mia walks with a water bottle and an apple. Above the path, seven small floating circles of light fill with gold one after another as Lumi touches them. Compose the main action in the left two thirds; keep the right third calm, soft and uncluttered (soft-focus background only). Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 9,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 9 'Evening diary'. Cozy evening at a wooden desk by a rain-streaked window, warm lamp light. Mia writes in a paper journal with a soft smile; a small to-do list on a card beside it. Lumi rests on the lamp shade, glowing. Compose the main action in the left two thirds; keep the right third calm, soft and uncluttered (soft-focus background only). Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 10,
|
||||
"refs": [
|
||||
"lumi",
|
||||
"mia"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 10 'Just ask'. Night, Mia curled up on a sofa with a blanket, holding her phone. Lumi flies up out of the phone's soft glow, and they share a warm look and a smile. Compose the main action in the left two thirds; keep the right third calm, soft and uncluttered (soft-focus background only). Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
},
|
||||
{
|
||||
"shot": 11,
|
||||
"refs": [
|
||||
"lumi"
|
||||
],
|
||||
"prompt": "Keyframe for an animated promo film, shot 11 'A breeze of light'. Starry night above the calm lake. Lumi flies upward, leaving a long golden trail that curls like a gentle breeze across the sky; the camera rises slowly. Keep the upper center of the frame open and dark for a title. Style: premium hand-painted storybook 3D animated film still, soft watercolor and gouache texture, warm cinematic light, gentle volumetric haze, shallow depth of field, rich but calm colors. The input images are the character references; keep every character's face, proportions, hair and outfit exactly as in them (Lumi is a small hand-sized glowing firefly). Wide cinematic 16:9 framing inside a 3:2 canvas: keep all important content inside the central horizontal band so the top and bottom 7 percent can be cropped. No text, letters, logos, watermarks, UI or readable screens."
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Paint one storyboard keyframe per shot with Codex image generation.
|
||||
|
||||
Usage: keyframes.py [SHOT...]. Writes build/promo-video/keyframes/shot-NN.png
|
||||
(1536x1024 from Codex; the film uses its central 16:9 band). Runs up to
|
||||
four Codex sessions at once and keeps existing keyframes unless named.
|
||||
Approved keyframes are stored as 1536x864 JPEGs in keyframes/ beside this
|
||||
script, which compose.py --animatic reads.
|
||||
"""
|
||||
import json
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parents[1]
|
||||
OUT = ROOT / "build/promo-video/keyframes"
|
||||
REFERENCES = {
|
||||
"lumi": ROOT / "assets/lumi/mascot.png",
|
||||
"mia": HERE / "references/mia-turnaround.png",
|
||||
"monk": ROOT / "design/tai-chi/characters/monk/source/turnaround.png",
|
||||
"teacher": ROOT / "design/tai-chi/characters/tibetan-woman/source/turnaround.png",
|
||||
}
|
||||
IMAGES = Path.home() / ".codex/generated_images"
|
||||
|
||||
|
||||
def paint(frame):
|
||||
target = OUT / f"shot-{frame['shot']:02d}.png"
|
||||
log = OUT / f"shot-{frame['shot']:02d}.log"
|
||||
# "keyframe-NN" names an earlier shot's painted keyframe, for continuity.
|
||||
images = [str(OUT / f"shot-{name[9:]}.png") if name.startswith("keyframe-") else str(REFERENCES[name])
|
||||
for name in frame["refs"]]
|
||||
with open(log, "w") as output:
|
||||
subprocess.run(["codex", "exec", "--skip-git-repo-check", "--sandbox", "read-only", "-C", str(OUT),
|
||||
frame["prompt"], "-i", *images], stdin=subprocess.DEVNULL, stdout=output,
|
||||
stderr=subprocess.STDOUT, timeout=1800)
|
||||
session = re.search(r"session id: (\S+)", log.read_text())
|
||||
made = sorted((IMAGES / session.group(1)).glob("*.png"), key=lambda path: path.stat().st_mtime) if session else []
|
||||
if not made:
|
||||
return f"shot {frame['shot']}: no image (see {log.name})"
|
||||
shutil.copyfile(made[-1], target)
|
||||
return f"shot {frame['shot']}: {target.name}"
|
||||
|
||||
|
||||
def main():
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
frames = json.loads((HERE / "keyframes.json").read_text())
|
||||
wanted = {int(arg) for arg in sys.argv[1:]}
|
||||
todo = [frame for frame in frames
|
||||
if (frame["shot"] in wanted) or (not wanted and not (OUT / f"shot-{frame['shot']:02d}.png").exists())]
|
||||
with ThreadPoolExecutor(4) as pool:
|
||||
for line in pool.map(paint, todo):
|
||||
print(line, flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
After Width: | Height: | Size: 356 KiB |
|
After Width: | Height: | Size: 266 KiB |
|
After Width: | Height: | Size: 255 KiB |
|
After Width: | Height: | Size: 380 KiB |
|
After Width: | Height: | Size: 319 KiB |
|
After Width: | Height: | Size: 428 KiB |
|
After Width: | Height: | Size: 507 KiB |
|
After Width: | Height: | Size: 288 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 267 KiB |
|
After Width: | Height: | Size: 419 KiB |
@@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Mix Lumi's chosen takes over the score at film.json's times.
|
||||
|
||||
Reads the chosen takes and score from audio/ beside this script and writes
|
||||
build/promo-video/audio/soundtrack.wav (48 kHz stereo, -14 LUFS) and
|
||||
soundtrack.mp3, the audio the film is cut to.
|
||||
"""
|
||||
import json
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
SOURCES = HERE / "audio"
|
||||
AUDIO = HERE.parents[1] / "build/promo-video/audio"
|
||||
RATE = 48000
|
||||
|
||||
|
||||
def load(path, channels):
|
||||
raw = subprocess.run(["ffmpeg", "-loglevel", "error", "-i", str(path), "-ac", str(channels), "-ar", str(RATE),
|
||||
"-f", "f32le", "-"], capture_output=True, check=True).stdout
|
||||
return np.frombuffer(raw, np.float32).reshape(-1, channels).copy()
|
||||
|
||||
|
||||
def voice(path):
|
||||
# Clean, close and present: rumble cut, gentle compression, a little air.
|
||||
raw = subprocess.run(["ffmpeg", "-loglevel", "error", "-i", str(path), "-af",
|
||||
"highpass=f=90,acompressor=threshold=-20dB:ratio=3:attack=8:release=120:makeup=2,"
|
||||
"equalizer=f=3500:t=q:w=1.2:g=2,equalizer=f=250:t=q:w=1:g=-2",
|
||||
"-ac", "1", "-ar", str(RATE), "-f", "f32le", "-"], capture_output=True, check=True).stdout
|
||||
return np.frombuffer(raw, np.float32).copy()
|
||||
|
||||
|
||||
def smooth(gate, attack, release):
|
||||
out = np.empty_like(gate)
|
||||
level = 0.0
|
||||
up, down = 1 / (attack * RATE), 1 / (release * RATE)
|
||||
for i, target in enumerate(gate):
|
||||
level = min(target, level + up) if target > level else max(target, level - down)
|
||||
out[i] = level
|
||||
return out
|
||||
|
||||
|
||||
def main():
|
||||
film = json.loads((HERE / "film.json").read_text())
|
||||
length = int(film["format"]["length"] * RATE)
|
||||
music = load(SOURCES / film["score"]["file"], 2)[:length]
|
||||
music = np.pad(music, ((0, length - len(music)), (0, 0)))
|
||||
# The score's own last chord decays fast; ease it out under the title.
|
||||
fade_from, fade_to = (int(second * RATE) for second in film["score"]["fade_out"])
|
||||
music[fade_from:fade_to] *= np.cos(np.linspace(0, np.pi / 2, fade_to - fade_from))[:, None] ** 2
|
||||
music[fade_to:] = 0
|
||||
speech = np.zeros(length, np.float32)
|
||||
for line in film["voices"]:
|
||||
clip = voice(SOURCES / f"{line['take']}.flac")
|
||||
start = int(line["at"] * RATE)
|
||||
speech[start:start + len(clip)] += clip[:length - start]
|
||||
# Duck the score under speech with a smooth gain envelope.
|
||||
frame = RATE // 100
|
||||
active = np.repeat(np.abs(speech[:len(speech) // frame * frame]).reshape(-1, frame).max(axis=1) > 0.01, frame)
|
||||
active = np.pad(active.astype(np.float32), (0, length - len(active)))
|
||||
duck = 10 ** (film["score"]["duck_db"] / 20)
|
||||
envelope = 1 - (1 - duck) * smooth(active, 0.25, 0.7)
|
||||
mix = music * envelope[:, None] + speech[:, None] * 1.0
|
||||
AUDIO.mkdir(parents=True, exist_ok=True)
|
||||
raw = AUDIO / "premix.f32"
|
||||
raw.write_bytes(mix.astype(np.float32).tobytes())
|
||||
wav = AUDIO / "soundtrack.wav"
|
||||
subprocess.run(["ffmpeg", "-loglevel", "error", "-y", "-f", "f32le", "-ar", str(RATE), "-ac", "2", "-i", str(raw),
|
||||
"-af", "loudnorm=I=-14:TP=-1.5:LRA=11", "-ar", str(RATE), "-c:a", "pcm_s16le", str(wav)], check=True)
|
||||
subprocess.run(["ffmpeg", "-loglevel", "error", "-y", "-i", str(wav), "-c:a", "libmp3lame", "-b:a", "320k",
|
||||
str(AUDIO / "soundtrack.mp3")], check=True)
|
||||
raw.unlink()
|
||||
print(wav)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Speak the promo film's lines in Lumi's voice and check every take.
|
||||
|
||||
Writes build/promo-video/audio/<key>-<take>.wav (24 kHz mono) and
|
||||
takes.json with each take's transcript, match and length. Existing takes
|
||||
are kept; pass --again to replace them. Store the chosen take as FLAC in
|
||||
audio/ beside this script and name it in film.json's voices.
|
||||
"""
|
||||
import base64
|
||||
import difflib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parents[1]
|
||||
OUT = ROOT / "build/promo-video/audio"
|
||||
API = "https://openrouter.ai/api/v1"
|
||||
|
||||
|
||||
def key():
|
||||
if os.environ.get("OPENROUTER_API_KEY"):
|
||||
return os.environ["OPENROUTER_API_KEY"]
|
||||
for line in (ROOT.parent / "harmony/.env").read_text().splitlines():
|
||||
name, equal, value = line.partition("=")
|
||||
if equal and name.strip() == "OPENROUTER_API_KEY":
|
||||
return value.strip().strip("'\"")
|
||||
sys.exit("OPENROUTER_API_KEY is missing")
|
||||
|
||||
|
||||
def post(path, body, timeout=180):
|
||||
request = urllib.request.Request(API + path, data=json.dumps(body).encode(), headers={
|
||||
"Authorization": "Bearer " + key(), "Content-Type": "application/json"})
|
||||
for attempt in range(3):
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=timeout) as response:
|
||||
return response.read()
|
||||
except urllib.error.HTTPError as error:
|
||||
detail = error.read()[:300].decode("utf8", "replace")
|
||||
if error.code < 500 and error.code != 429:
|
||||
sys.exit(f"{path} failed: {error.code} {detail}")
|
||||
except (urllib.error.URLError, TimeoutError):
|
||||
pass
|
||||
sys.exit(f"{path} failed three times")
|
||||
|
||||
|
||||
def transcribe(config, wav):
|
||||
audio = base64.b64encode(wav.read_bytes()).decode()
|
||||
reply = json.loads(post("/chat/completions", {
|
||||
"model": config["transcriber"], "temperature": 0,
|
||||
"messages": [{"role": "user", "content": [
|
||||
{"type": "text", "text": "Transcribe this speech exactly. Reply with the words only."},
|
||||
{"type": "input_audio", "input_audio": {"data": audio, "format": "wav"}}]}]}))
|
||||
return reply["choices"][0]["message"]["content"].strip()
|
||||
|
||||
|
||||
def words(text):
|
||||
return re.sub(r"[^a-z0-9 ]", "", text.lower().replace("-", " ")).split()
|
||||
|
||||
|
||||
def main():
|
||||
config = json.loads((HERE / "narration.json").read_text())
|
||||
again = "--again" in sys.argv
|
||||
only = [arg for arg in sys.argv[1:] if not arg.startswith("--")]
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
receipt_path = OUT / "takes.json"
|
||||
receipt = json.loads(receipt_path.read_text()) if receipt_path.exists() else {}
|
||||
for line in config["lines"]:
|
||||
if only and line["key"] not in only:
|
||||
continue
|
||||
for take in range(1, config["takes"] + 1):
|
||||
name = f"{line['key']}-{take}"
|
||||
wav = OUT / f"{name}.wav"
|
||||
if wav.exists() and not again and receipt.get(name, {}).get("text") == line["text"]:
|
||||
continue
|
||||
pcm = post("/audio/speech", {"model": config["model"], "voice": config["voice"],
|
||||
"input": line["text"], "response_format": config["response_format"]})
|
||||
subprocess.run(["ffmpeg", "-loglevel", "error", "-y", "-f", "s16le", "-ar", str(config["pcm_sample_rate"]),
|
||||
"-ac", "1", "-i", "-", str(wav)], input=pcm, check=True)
|
||||
heard = transcribe(config, wav)
|
||||
match = difflib.SequenceMatcher(None, words(line["text"]), words(heard)).ratio()
|
||||
seconds = len(pcm) / 2 / config["pcm_sample_rate"]
|
||||
receipt[name] = {"text": line["text"], "heard": heard, "match": round(match, 3), "seconds": round(seconds, 2)}
|
||||
receipt_path.write_text(json.dumps(receipt, indent=1) + "\n")
|
||||
print(f"{name}: {seconds:.2f}s match {match:.2f} :: {heard}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"model": "google/gemini-3.8-flash-tts",
|
||||
"voice": "Leda",
|
||||
"response_format": "pcm",
|
||||
"pcm_sample_rate": 24000,
|
||||
"transcriber": "google/gemini-2.5-flash",
|
||||
"minimum_match": 0.9,
|
||||
"takes": 3,
|
||||
"lines": [
|
||||
{"key": "hello", "text": "Hi! I'm Lumi, your little firefly."},
|
||||
{"key": "welcome", "text": "Welcome to Inner Breeze, your guide to a calmer, stronger life."},
|
||||
{"key": "breathe", "text": "Start the day with your breath. Guided rounds, box breathing, or your own rhythm."},
|
||||
{"key": "meditate", "text": "Sit in stillness, with a gentle bell to keep you company."},
|
||||
{"key": "yoga", "text": "Flow through the Sun Salutation, pose by pose."},
|
||||
{"key": "taichi", "text": "Learn Tai Chi, the gentle martial art. All twenty-four moves, one step at a time."},
|
||||
{"key": "habits", "text": "Build good habits, and watch every streak grow."},
|
||||
{"key": "diary", "text": "Keep your plans in Lists, and your thoughts in your Diary."},
|
||||
{"key": "ask", "text": "And whenever you need me, just ask."},
|
||||
{"key": "end", "text": "Inner Breeze. Free, private, and made for you."}
|
||||
],
|
||||
"documentation": "https://openrouter.ai/docs/guides/overview/multimodal/tts"
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Ask Lyria for the promo film's music bed: build/promo-video/audio/score-N.mp3."""
|
||||
import base64
|
||||
import json
|
||||
import sys
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parents[1]
|
||||
OUT = ROOT / "build/promo-video/audio"
|
||||
sys.path.insert(0, str(HERE))
|
||||
from narrate import key # noqa: E402
|
||||
|
||||
PROMPT = (
|
||||
"Instrumental score for a premium 65-second promo film of a mindful-living app. No vocals, no choir words. "
|
||||
"Warm, hopeful and cinematic, 76 BPM, D major. "
|
||||
"0-6 s: a hush at dawn, airy pads and one soft felt-piano motif, a single small chime like a firefly lighting up. "
|
||||
"6-30 s: gentle bamboo flute melody over the piano, light guzheng plucks, soft breath-like swells. "
|
||||
"30-42 s: a graceful East Asian section for a Tai Chi sequence: guzheng and erhu phrase, slow taiko heartbeat, warm low strings. "
|
||||
"42-56 s: uplifting build with warm strings, light hand percussion and piano arpeggios, optimistic and bright. "
|
||||
"56-65 s: resolve to a tender final chord with a sparkling chime and a clean natural ending, no fade-in loop. "
|
||||
"Mixed spaciously so a narrator's voice sits clearly on top: no busy midrange, no loud drums."
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
takes = int(sys.argv[1]) if len(sys.argv) > 1 else 2
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
for take in range(1, takes + 1):
|
||||
body = {"model": "google/lyria-3-pro-preview", "modalities": ["text", "audio"],
|
||||
"audio": {"format": "mp3"}, "stream": True,
|
||||
"messages": [{"role": "user", "content": PROMPT}]}
|
||||
request = urllib.request.Request("https://openrouter.ai/api/v1/chat/completions", data=json.dumps(body).encode(),
|
||||
headers={"Authorization": "Bearer " + key(), "Content-Type": "application/json"})
|
||||
chunks = []
|
||||
with urllib.request.urlopen(request, timeout=600) as response:
|
||||
for raw in response:
|
||||
line = raw.decode("utf8", "replace").strip()
|
||||
if not line.startswith("data:") or line == "data: [DONE]":
|
||||
continue
|
||||
event = json.loads(line[5:])
|
||||
for choice in event.get("choices", []):
|
||||
audio = choice.get("delta", {}).get("audio") or {}
|
||||
if audio.get("data"):
|
||||
chunks.append(audio["data"])
|
||||
if not chunks:
|
||||
sys.exit("Lyria returned no audio")
|
||||
path = OUT / f"score-{take}.mp3"
|
||||
path.write_bytes(b"".join(base64.b64decode(chunk) for chunk in chunks))
|
||||
print(path)
|
||||
(OUT / "score-prompt.txt").write_text(PROMPT + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||