From 11c4ff4586b0f0d87dc09d3ebc8bccd96f9bad53 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 16 Oct 2026 10:21:05 +0000 Subject: [PATCH] The tutorial film in English: the script, the voice, the page's words tutorial_script_en.py: the chapters in English (the same ids, graphics and cues), with how the voice says the names (JIANT as "giant"). tutorial_voice.py takes the language (en: an American male voice); the timeline carries it and the page draws its words in that language. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh --- tools/video/tutorial_body.js | 6 +- tools/video/tutorial_script_en.py | 144 ++++++++++++++++++++++++++++++ tools/video/tutorial_voice.py | 12 +-- 3 files changed, 156 insertions(+), 6 deletions(-) create mode 100644 tools/video/tutorial_script_en.py diff --git a/tools/video/tutorial_body.js b/tools/video/tutorial_body.js index d8aefda8..9a2695d4 100644 --- a/tools/video/tutorial_body.js +++ b/tools/video/tutorial_body.js @@ -11,7 +11,11 @@ let D, TL, VER = 'v0.8.0'; const FONT = '"Chakra Petch", sans-serif'; const ease = (u) => { u = clamp(u, 0, 1); return u < .5 ? 4 * u * u * u : 1 - Math.pow(-2 * u + 2, 3) / 2; }; const fade = (t, a, b) => clamp((t - a) / (b - a), 0, 1); +const EN = {"27 TECLAS: TOCAN LA PISTA ELEGIDA": "27 KEYS: THEY PLAY THE SELECTED TRACK", "6 PISTAS · 8 MOTORES · SECUENCIADOR · EFECTOS": "6 TRACKS · 8 ENGINES · SEQUENCER · EFFECTS", "6 tipos · AMP": "6 types · AMP", "8 SONIDOS": "8 SOUNDS", "ACTIVO": "ACTIVE", "AFINACIÓN": "PITCH", "AMPLITUD": "AMPLITUDE", "ARPEGIO": "ARPEGGIO", "ARRANGE: SECCIONES EN FILAS": "ARRANGE: SECTIONS IN ROWS", "BAJO": "BASS", "BATERÍA": "DRUMS", "CADA PISTA, SU LARGO: GIRAN UNAS CONTRA OTRAS": "EACH TRACK ITS LENGTH: THEY TURN AGAINST EACH OTHER", "CLOCK: EN TEMPO CON OTROS EQUIPOS": "CLOCK: IN TIME WITH OTHER GEAR", "COMPONENTES POR PASO": "COMPONENTS PER STEP", "Chrome o Edge, por USB": "Chrome or Edge, over USB", "DESHACER": "UNDO", "DESPACIO: AJUSTE FINO": "SLOW: FINE TUNING", "EFECTOS": "EFFECTS", "EL CARRIL DE PUNCH-IN": "THE PUNCH-IN LANE", "EL CELULAR · 10 CANALES": "THE PHONE · 10 CHANNELS", "EMULADOR": "EMULATOR", "ENCABEZADO": "HEADER", "ENV Y LFO EN CADA PISTA": "ENV AND LFO ON EVERY TRACK", "ENVÍOS · COMPARTIDOS": "SENDS · SHARED", "ESCALA": "SCALE", "ESQUEMA DEL PANEL": "PANEL SCHEMATIC", "FILTRO": "FILTER", "FX MANTENIDO: LAS TECLAS SON EFECTOS": "FX HELD: THE KEYS ARE EFFECTS", "GLO mantenido + G4 · otra vez: rehacer": "GLO held + G4 · again: redo", "GRACIAS A QUIENES APOYAN EL PROYECTO": "THANK YOU TO EVERYONE WHO SUPPORTS THE PROJECT", "GRACIAS": "THANK YOU", "GRÁFICO": "GRAPHIC", "INSTALADOR": "INSTALLER", "JIANT en el navegador": "JIANT in your browser", "LFO MANTENIDO: LAS PERILLAS SON M1–M4": "LFO HELD: THE KNOBS ARE M1–M4", "LISTO": "DONE", "LOS DADOS, PARTE POR PARTE": "THE DICE, PART BY PART", "MANTENER": "HOLD", "MATRIZ MOD: 4 RUTAS MÁS POR PISTA": "MOD MATRIX: 4 MORE ROUTES PER TRACK", "MOTORES": "ENGINES", "MUCHO": "A LOT", "MUTATE: CADA TANTOS COMPASES": "MUTATE: EVERY FEW BARS", "MUTEADA": "MUTED", "NIVEL": "LEVEL", "PARTES": "PARTS", "PIANO ROLL · HASTA 4 NOTAS POR PASO": "PIANO ROLL · UP TO 4 NOTES PER STEP", "PIE": "FOOTER", "PLAYHEADS: CABEZALES EXTRA": "PLAYHEADS: EXTRA HEADS", "POCO": "LITTLE", "PROYECTO": "PROJECT", "REC + PLAY: GRABÁS EN VIVO": "REC + PLAY: RECORD LIVE", "RUIDO": "NOISE", "RÁPIDO: TODO EL RANGO": "FAST: THE WHOLE RANGE", "SAVE MANTENIDO: LAS SECCIONES EN VIVO": "SAVE HELD: SECTIONS LIVE", "SELECCIONADO": "SELECTED", "SONIDOS": "SOUNDS", "STEMS+IN · NUEVO EN 0.8.0": "STEMS+IN · NEW IN 0.8.0", "TARJETAS": "CARDS", "TOCAR": "TAP", "TU DAW · 8 CANALES": "YOUR DAW · 8 CHANNELS", "TUTORIAL · EL SISTEMA COMPLETO": "TUTORIAL · THE WHOLE SYSTEM", "USB › STEMS · las 6 pistas por separado + los efectos": "USB › STEMS · the 6 tracks apart + the effects", "VELOCIDAD": "VELOCITY", "analógico o digital · pitch · ping pong": "analog or digital · pitch · ping pong", "bombo": "kick", "cada tecla, un efecto momentáneo": "each key, a momentary effect", "chip · bytebeat · floatbeat": "chip · bytebeat · floatbeat", "con OK para quedártelo o CANCEL para volver": "OK to keep it, CANCEL to go back", "distorsión de fase": "phase distortion", "dos osciladores, filtro por voz": "two oscillators, filter per voice", "efectos": "effects", "el sonido, a los dados": "the sound, rolled", "entran en el compás siguiente": "they come in on the next bar", "hat abierto": "open hat", "hat cerrado": "closed hat", "la criatura, la envolvente, los pasos…": "the creature, the envelope, the steps…", "la música: tocada por JIANT en el FM-1 · la voz: sintetizada": "music: played by JIANT on the FM-1 · voice: synthesized", "la pista": "the track", "la página y dónde estás": "the page and where you are", "la voz": "the voice", "las páginas": "the pages", "limitador · CLIP · PUNCH · DUCK": "limiter · CLIP · PUNCH · DUCK", "lo que tocaste se repite con el tema": "what you played repeats with the song", "los sonidos": "the sounds", "primero: Return to official V15 first (también guarda un backup)": "first: Return to official V15 first (it also saves a backup)", "redoblante": "snare", "reproducción · tempo · carga · batería": "transport · tempo · load · battery", "ruido coloreado y metálico": "coloured and metallic noise", "seis operadores, 32 algoritmos": "six operators, 32 algorithms", "sin samples": "no samples", "soltás: volvés a donde estabas": "let go: back where you were", "sonidos, bancos y backups": "sounds, banks and backups", "su variación": "its variation", "teclas negras: mutes · blancas: solos": "black keys: mutes · white: solos", "todo el kit, de un lado al otro": "the whole kit, side to side", "tu voz por los efectos de la última pista, en su propio canal": "your voice through the last track’s effects, in its own channel", "una idea": "an idea", "una lista con todos los motores": "one list with every engine", "una por perilla: KNOB 1–4": "one per knob: KNOB 1–4", "voz por formantes": "formant voice", "órgano con rotativo": "organ with rotary", "¿VENÍS DE OTRO FIRMWARE CUSTOM?": "COMING FROM ANOTHER CUSTOM FIRMWARE?", "y PANEO": "and PAN", "MOTOR": "ENGINE", "INSTALADOR WEB": "WEB INSTALLER", "CABLE USB DE DATOS": "USB DATA CABLE", "directo a la computadora, sin hub": "straight to the computer, no hub", "no desenchufes mientras escribe": "don’t unplug while it writes", "juanjiant-bit.github.io/JIANT · Chrome o Edge": "juanjiant-bit.github.io/JIANT · Chrome or Edge", "todo el kit": "the whole kit"}; +let LANG = "es"; +const tr = (s) => LANG !== "en" ? s : (EN[s] !== undefined ? EN[s] : s.replace(/ compases$/, " bars").replace(/^vuelta /, "loop ").replace(" · LA PANTALLA REAL, EN TIEMPO REAL", " · THE REAL SCREEN, IN REAL TIME")); function T(s, x, y, size, w = 500, col = C.text, al = 'left', ls = 0) { + s = tr(s); X.font = `${w} ${size}px ${FONT}`; X.fillStyle = col; X.textAlign = al; X.textBaseline = 'alphabetic'; if (ls && X.letterSpacing !== undefined) X.letterSpacing = ls + 'px'; X.fillText(s, x, y); @@ -564,7 +568,7 @@ async function rgbFrame(f) { sx.putImageData(simg, 0, 0); } async function boot(film) { - D = await (await fetch('data.json')).json(); TL = await (await fetch('timeline.json')).json(); + D = await (await fetch('data.json')).json(); TL = await (await fetch('timeline.json')).json(); LANG = TL.lang || 'es'; VER = (await (await fetch('version')).text()).trim(); await document.fonts.load(`600 40px ${FONT}`); await document.fonts.load(`500 40px ${FONT}`); return Math.min(D.n, Math.round(TL.end * FPS)); diff --git a/tools/video/tutorial_script_en.py b/tools/video/tutorial_script_en.py new file mode 100644 index 00000000..a363fb14 --- /dev/null +++ b/tools/video/tutorial_script_en.py @@ -0,0 +1,144 @@ +# SPDX-License-Identifier: GPL-3.0-only +# (JIANT 0.8.0) the tutorial film's script in English (tools/video/tutorial_script.py's chapters, ids, graphics and cues; +# tutorial_voice.py ... en). SAY: how the voice says what the screen spells. +CHAPTERS = [ + dict(id='intro', k='', title='JIANT', g='intro', lines=[ + ("Hi. This is JIANT.", 0), + ("A free, open firmware that turns the FM-1 into a complete instrument: six tracks, eight synthesis engines, " + "a deep sequencer and effects, all inside this little keyboard.", 1), + ("JIANT is made by Juan Jiant, a muralist and visual artist who, after many years in art, fell in love with music.", 1), + ("Before we start, a heartfelt thank you to everyone supporting the project on Ko-fi. " + "You are the reason JIANT keeps growing.", 2), + ("In this tutorial we'll walk through the whole system, step by step.", 3), + ]), + dict(id='install', k='01', title='INSTALL', g='install', lines=[ + ("First, installing. Open the web installer in Chrome or Edge, " + "and connect the FM-1 straight to your computer with a USB data cable.", 0), + ("Press Install and wait until it finishes, without unplugging.", 1), + ("If you're coming from another custom firmware, go back to the official one first, with the installer's button.", 2), + ]), + dict(id='panel', k='02', title='THE PANEL', g='panel', lines=[ + ("This is the panel. At the top there are three encoders.", 0), + ("ALGORITHM picks the track. PRESETS browses the sounds. And SELECT steps through the pages of the section you're in.", 1), + ("The four knobs control the four cards on the screen. " + "Turn them fast to sweep the whole range; turn them slowly to fine tune.", 2), + ("The buttons open the pages: ENV, LFO, FX, SCL, EDIT, GLO, SAVE, ARP and SEQ. " + "And the twenty-seven keys play the selected track.", 3), + ]), + dict(id='screen', k='03', title='THE SCREEN', g='screen', lines=[ + ("The screen always keeps the same order. At the top, the header: " + "transport, tempo, processor load and battery.", 0), + ("Below it, four cards, one per knob. The value you're turning lights up in orange.", 1), + ("In the middle, the page's graphic. And at the bottom, the page name and where you are.", 2), + ("Colours work like a thermal camera: cold is little, hot is a lot. " + "Violet is what's selected; orange, what's active.", 3), + ]), + dict(id='home', k='04', title='HOME', g='home', lines=[ + ("Press HOME and you reach the ecosystem: one creature per track.", 0), + ("Each species belongs to an engine, and its shape comes from its four knobs. " + "When the track plays, the creature swells and heats up with its own audio.", 1), + ("The selected track is drawn bigger. A muted track goes dark.", 2), + ]), + dict(id='layers', k='05', title='TAP AND HOLD', g='layers', lines=[ + ("All navigation comes down to two gestures. Tap a button to open its pages; tap it again for the next one.", 0), + ("Hold it to open its layer: while you hold it, the keys and knobs change roles, " + "and a map shows what each one does. Let go, and you're back where you were.", 1), + ("For example, hold GLO to mute tracks with the black keys, or hold FX to play effects live.", 2), + ]), + dict(id='engines', k='06', title='EIGHT ENGINES', g='engines', lines=[ + ("JIANT has eight engines, all synthesis, no samples. Any engine can go on any track.", 0), + ("ANALOG: two oscillators with a filter per voice. FM6: six-operator FM, with thirty-two algorithms. " + "PHASE: phase distortion.", 1), + ("LOFI: chip sounds, bytebeat and floatbeat. VOICE: a formant voice. " + "WHEEL: a drawbar organ with a rotary speaker.", 2), + ("NOISE: coloured and metallic noise. And DRUM-X, the synthesized drum kit.", 3), + ("Turn PRESETS to browse every engine's sounds in a single list. " + "And if you want something new, hold EDIT and turn SELECT: the sound gets a roll of the dice.", 4), + ]), + dict(id='signal', k='07', title='THE SIGNAL PATH', g='signal', lines=[ + ("This is how sound travels inside a track.", 0), + ("The engine makes the voice. The filter shapes it: low pass, high pass, band pass or comb. " + "The envelope and the LFO move it in time.", 1), + ("Then it goes through the track's distortion, with six types, including an amp emulator.", 2), + ("Level and pan place it in the mix, and three sends feed the chorus, the delay and the reverb, " + "shared by every track.", 3), + ("At the end, the master: an always-on limiter, with clip, punch and ducking.", 4), + ]), + dict(id='drumx', k='08', title='DRUM-X', g='drumx', lines=[ + ("DRUM-X is a drum kit of eight sounds generated in real time: " + "kick, snare, clap, two hi-hats, tom, rim and cowbell.", 0), + ("Every sound has two sides, A and B. The MORPH knob moves the whole kit from one side to the other: " + "it's the knob to play live.", 1), + ("There are nine factory kits, from 909 and 808 to industrial and acoustic. And every sound can be edited in depth: " + "pitch, noise, layers, feedback, and its own send to an effect.", 2), + ]), + dict(id='seq', k='09', title='THE SEQUENCER', g='seq', lines=[ + ("Every track has its own sixty-four step sequencer, with its own length, division, swing and gate. " + "Patterns of different lengths turn against each other.", 0), + ("On a melodic track, the STEP page is a piano roll: each step holds up to four notes, with accent and slide.", 1), + ("You can write step by step, or record live with REC and PLAY.", 2), + ("And each step can carry components: probability, ratchets, echoes, arpeggios, " + "or notes that walk up the scale, loop after loop.", 3), + ("With PLAYHEADS, up to three more heads read the same pattern at another speed, or backwards. " + "And MUTATE transforms the sound and the pattern every few bars.", 4), + ]), + dict(id='mod', k='10', title='MODULATION', g='mod', lines=[ + ("Modulation brings it to life. Every track has an envelope and an LFO, " + "with their destinations: pitch, filter, shape and amplitude.", 0), + ("The MOD matrix adds four more routes per track, with sources like velocity, " + "the modulation sequencer or noise, and destinations that reach the effects.", 1), + ("And the four macros: hold LFO, and the knobs become M1 to M4, each moving many parameters at once.", 2), + ]), + dict(id='fx', k='11', title='EFFECTS', g='fx', lines=[ + ("The effects. An analog or digital delay, with pitch and ping pong. " + "A reverb with five models, including SHIMMER, RESO tuned to the scale, and CLOUD, granular.", 0), + ("A stereo chorus, and the SLICER, which chops the audio into rhythms on the tracks you choose.", 1), + ("And live: hold FX, and every key is a momentary effect. Repeats, filters, octaves, stutters.", 2), + ("Everything you play can be recorded into a lane that repeats with the song.", 3), + ]), + dict(id='gen', k='12', title='GENERATOR AND DICE', g='gen', lines=[ + ("Out of ideas? On HOME, turn SELECT and the generator opens. Pick a genre, press OCT plus, " + "and a whole song appears: engines, sounds, parts, scale, tempo and effects.", 0), + ("The dice work on every part: hold SEQ, LFO or FX, and turn SELECT to vary just that.", 1), + ("And if you change your mind, hold GLO and press the G4 key: undo.", 2), + ]), + dict(id='arrange', k='13', title='SAVE AND ARRANGE', g='arrange', lines=[ + ("To save, every project has four sections, A to D. Save an idea in A, and a variation in B.", 0), + ("On the ARRANGE page you chain sections in rows, each with its length in bars. " + "Press PLAY, and the song plays in order.", 1), + ("And live, hold SAVE: the keys launch sections on the next bar.", 2), + ]), + dict(id='usb', k='14', title='USB AND MIDI', g='usb', lines=[ + ("The FM-1 is also a USB audio interface. In STEMS mode it sends eight channels: " + "the six tracks apart, plus the effects, straight into your DAW.", 0), + ("With IN+OUT, your computer or phone plays through the FM-1. " + "And the new STEMS+IN mode joins both: you record the stems, and your voice goes through the last track's effects.", 1), + ("Plus MIDI over USB, Bluetooth and TRS, with clock to sync with other gear.", 2), + ]), + dict(id='web', k='15', title='ON THE WEB', g='web', lines=[ + ("On the web there are three tools: the emulator, which runs JIANT in your browser; the installer; " + "and the editor, to manage sounds, banks and backups from your computer.", 0), + ("From the emulator you can also render the stems of a song from your backup, faster than real time.", 1), + ]), + dict(id='outro', k='', title='THANK YOU', g='outro', lines=[ + ("That's JIANT. The full manual, in English and Spanish, is on the project page.", 0), + ("If this work resonates with you, you can support it on Ko-fi, or on Cafecito from Argentina.", 1), + ("Thanks for watching, and thanks again to everyone who makes it possible. See you next time.", 2), + ]), +] + +SAY = [ + ('STEMS+IN', 'stems plus in'), ('IN+OUT', 'in plus out'), ('FM-1', 'F M one'), ('FM6', 'F M six'), + ('DRUM-X', 'drum X'), ('M1 to M4', 'M one to M four'), ('JIANT', 'Giant'), ('Juan Jiant', 'Juan Giant'), + ('Jiant', 'Giant'), ('LFO', 'L F O'), ('FX', 'F X'), ('SCL', 'scale'), ('ENV', 'envelope'), ('GLO', 'G L O'), + ('SEQ', 'seek'), ('DAW', 'D A W'), ('TRS', 'T R S'), ('G4', 'G four'), ('OCT plus', 'octave plus'), + ('USB', 'U S B'), ('MOD', 'mod'), ('ALGORITHM', 'algorithm'), ('PRESETS', 'presets'), ('SELECT', 'select'), + ('LOFI', 'lo-fi'), ('Ko-fi', 'Ko-fi'), ('Cafecito', 'Cafesito'), ('909', 'nine oh nine'), ('808', 'eight oh eight'), +] + + +def say(text): + import re + for a, b in SAY: + text = re.sub(r'(? build/tut/voice.wav (24 kHz mono), build/tut/timeline.json, build/tut/plan.txt (capture_tutorial.c's chapters) import json, os, sys from pathlib import Path import numpy as np import soundfile as sf sys.path.insert(0, str(Path(__file__).resolve().parent)) -from tutorial_script import CHAPTERS, say +LANG = sys.argv[4] if len(sys.argv) > 4 else 'es' +if LANG == 'en': from tutorial_script_en import CHAPTERS, say +else: from tutorial_script import CHAPTERS, say from kokoro_onnx import Kokoro D = Path(sys.argv[1]); D.mkdir(parents=True, exist_ok=True) -VOICE = sys.argv[2] if len(sys.argv) > 2 else 'em_alex' +VOICE = sys.argv[2] if len(sys.argv) > 2 else ('am_michael' if LANG == 'en' else 'em_alex') SPEED = float(sys.argv[3]) if len(sys.argv) > 3 else 0.94 KD = Path(os.environ.get('KOKORO', Path.home() / 'tts')) k = Kokoro(str(KD / 'kokoro.onnx'), str(KD / 'voices.bin')) @@ -23,7 +25,7 @@ out, t, chapters = [np.zeros(int(LEAD * SR), np.float32)], LEAD, [] for ci, c in enumerate(CHAPTERS): ch = dict(id=c['id'], k=c['k'], title=c['title'], g=c['g'], start=t, lines=[]) for text, cue in c['lines']: - a, sr = k.create(say(text), voice=VOICE, speed=SPEED, lang='es') + a, sr = k.create(say(text), voice=VOICE, speed=SPEED, lang='en-us' if LANG == 'en' else 'es') assert sr == SR a = a.astype(np.float32) nz = np.nonzero(np.abs(a) > 0.004)[0] # (the model's own silence at both ends trimmed) @@ -39,7 +41,7 @@ for ci, c in enumerate(CHAPTERS): v = np.concatenate(out) v = v / (np.abs(v).max() + 1e-9) * 0.89 sf.write(D / 'voice.wav', v, SR) -json.dump(dict(end=round(t, 3), voice=VOICE, chapters=chapters), open(D / 'timeline.json', 'w'), ensure_ascii=False, indent=1) +json.dump(dict(end=round(t, 3), voice=VOICE, lang=LANG, chapters=chapters), open(D / 'timeline.json', 'w'), ensure_ascii=False, indent=1) with open(D / 'plan.txt', 'w') as f: # capture_tutorial.c: "seconds chapter cue" a line f.write(f'{t:.3f} end 0\n') for ch in chapters: