Redesign phone calls with a responsive word cloud and user siren
This commit is contained in:
@@ -6,7 +6,7 @@ import argparse
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--windows-dir", default="Windows")
|
||||
parser.add_argument("--version", default="0.2.3")
|
||||
parser.add_argument("--version", default="0.2.4")
|
||||
args = parser.parse_args()
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
@@ -23,13 +23,14 @@ with zipfile.ZipFile(windows_zip, "w", zipfile.ZIP_DEFLATED, compresslevel=6) as
|
||||
with zipfile.ZipFile(source_zip, "w", zipfile.ZIP_DEFLATED, compresslevel=6) as archive:
|
||||
for name in ("README_RU.md", "SCENARIO_RU.md", "AUDIO_CREDITS.md", "GODOT_LICENSE.txt", "build.ps1", ".gitignore"):
|
||||
archive.write(root / name, "DoOtboy/" + name)
|
||||
for name in ("make_audio.py", "make_phone_effects.py", "prepare_soundscape.py", "install_conversation_fill.py", "install_stairwell_voices.py", "write_phone_story.py", "write_voice_direction.py", "make_draft_voices.ps1", "split_voice_batch.py", "install_jessica_voice.py", "install_directed_voices.py", "package.py"):
|
||||
for name in ("make_audio.py", "make_phone_effects.py", "prepare_soundscape.py", "prepare_user_alarm.py", "install_conversation_fill.py", "install_stairwell_voices.py", "write_phone_story.py", "write_voice_direction.py", "make_draft_voices.ps1", "split_voice_batch.py", "install_jessica_voice.py", "install_directed_voices.py", "package.py"):
|
||||
archive.write(root / "tools" / name, "DoOtboy/tools/" + name)
|
||||
for path in (root / "voiceover").rglob("*"):
|
||||
if path.is_file() and path.suffix in (".md", ".json"):
|
||||
archive.write(path, "DoOtboy/" + path.relative_to(root).as_posix())
|
||||
for path in (root / "do-otboy").rglob("*"):
|
||||
if not path.is_file() or ".godot" in path.parts or path.suffix == ".import":
|
||||
if (not path.is_file() or any(part in {".godot", ".userdata", "profile", "builds"} for part in path.parts)
|
||||
or path.suffix in {".import", ".log", ".tmp"}):
|
||||
continue
|
||||
archive_name = "DoOtboy/" + path.relative_to(root).as_posix()
|
||||
if path.name == "export_presets.cfg":
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
"""Import the user's siren excerpt; the game applies the one-time fade-in."""
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "builds/python_audio"))
|
||||
import imageio_ffmpeg
|
||||
import numpy as np
|
||||
import soundfile as sf
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("source", type=Path)
|
||||
parser.add_argument("--from-seconds", type=float, default=8.0)
|
||||
args = parser.parse_args()
|
||||
assert args.from_seconds >= 0
|
||||
work = ROOT / "builds/user_alarm"
|
||||
work.mkdir(parents=True, exist_ok=True)
|
||||
decoded = work / "excerpt.wav"
|
||||
subprocess.run([
|
||||
imageio_ffmpeg.get_ffmpeg_exe(), "-v", "error", "-y", "-i", str(args.source),
|
||||
"-ss", str(args.from_seconds), "-map", "0:a:0", "-ac", "1", "-ar", "22050",
|
||||
"-c:a", "pcm_s16le", str(decoded),
|
||||
], check=True)
|
||||
samples, rate = sf.read(decoded)
|
||||
assert len(samples) > rate * 2 and np.isfinite(samples).all()
|
||||
source_duration = len(samples) / rate
|
||||
samples -= samples.mean()
|
||||
samples *= min(10 ** (-19 / 20) / np.sqrt(np.mean(samples**2)), .65 / np.abs(samples).max())
|
||||
width = int(.35 * rate)
|
||||
blend = np.linspace(0, 1, width)
|
||||
samples[:width] = samples[-width:] * (1-blend) + samples[:width] * blend
|
||||
samples = samples[:-width]
|
||||
target = ROOT / "do-otboy/assets/audio/siren_user.wav"
|
||||
sf.write(target, samples, rate, subtype="PCM_16")
|
||||
manifest = {
|
||||
"source": "videoplayback.m4a", "provider": "User-provided recording",
|
||||
"source_sha256": hashlib.sha256(args.source.read_bytes()).hexdigest(),
|
||||
"source_start_seconds": args.from_seconds,
|
||||
"source_end_seconds": round(args.from_seconds+source_duration, 4),
|
||||
"file": "assets/audio/siren_user.wav", "duration": round(len(samples)/rate, 4),
|
||||
"sample_rate": rate, "channels": 1, "encoding": "PCM16",
|
||||
"loop_crossfade_seconds": .35, "playback_fade_seconds": 6.0,
|
||||
"call_start_seconds": 24.0,
|
||||
"rms_db": round(float(20*np.log10(np.sqrt(np.mean(samples**2)))), 3),
|
||||
"peak_db": round(float(20*np.log10(np.abs(samples).max())), 3),
|
||||
"sha256": hashlib.sha256(target.read_bytes()).hexdigest(),
|
||||
}
|
||||
(ROOT / "do-otboy/data/alarm_manifest.json").write_text(
|
||||
json.dumps(manifest, ensure_ascii=False, indent=2)+"\n", encoding="utf-8")
|
||||
print(json.dumps(manifest, ensure_ascii=False, indent=2))
|
||||
@@ -243,7 +243,7 @@ target = ROOT / "do-otboy" / "data" / "phone_story.json"
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
target.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
|
||||
doc = ["# До отбоя — Не клади трубку", "", "Сценарий тестового билда 0.2.3. Десять звонков по 90 секунд, включая первый разговор. Катя — взрослая дочь, Нина — её мама. Мама не помнит повторов; Катя помнит только услышанное. Предметы и положение мамы сбрасываются. Сценарий не является инструкцией по поведению при обстреле.", "", "Первый звонок скрывает таймер. С 2-го звонка показана длительность соединения, а не отсчёт до смерти. На 45-й секунде пропадает электричество, на 85-й слышен гул, на 90-й удар и обрыв. Во всех звонках сирена начинается на 24-й секунде; все четыре внешних события совпадают при каждом повторе. Субтитры всех произнесённых фраз остаются в журнале текущего звонка.", "", "## Первый разговор — точная партитура", "", "0:00 — Мама: «Катюш, привет. Ты поела?»"]
|
||||
doc = ["# До отбоя — Не клади трубку", "", "Сценарий тестового билда 0.2.4. Десять звонков по 90 секунд, включая первый разговор. Катя — взрослая дочь, Нина — её мама. Мама не помнит повторов; Катя помнит только услышанное. Предметы и положение мамы сбрасываются. Сценарий не является инструкцией по поведению при обстреле.", "", "Первый звонок скрывает таймер. С 2-го звонка показана длительность соединения, а не отсчёт до смерти. На 45-й секунде пропадает электричество, на 85-й слышен гул, на 90-й удар и обрыв. Во всех звонках сирена начинается на 24-й секунде; все четыре внешних события совпадают при каждом повторе. Субтитры всех произнесённых фраз остаются в журнале текущего звонка.", "", "## Первый разговор — точная партитура", "", "0:00 — Мама: «Катюш, привет. Ты поела?»"]
|
||||
for beat in sorted(intro + [{'at': 45.0, 'line': 'power'}], key=lambda beat: beat['at']):
|
||||
entry = lines[beat["line"]]
|
||||
doc.append(f"{int(beat['at']) // 60}:{int(beat['at']) % 60:02} — {entry['speaker']}: «{entry['text']}»")
|
||||
|
||||
Reference in New Issue
Block a user