diff --git a/README.md b/README.md index a6468855..62dc0a9c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ the FM-1, with sound, and is played with your computer keyboard or the mouse. Th editor update themselves with every change merged into `main`. > **Status: in development (v0.8.5).** It builds and passes every test (Felucca's and its own), Back up the flash before installing it. + **DRUM-X octaves** (0.8.5): the kit stays on its keys at every OCT; above the centre it ratchets in time (x2, x4, x8), + below it plays SHORT, GHOST or FLAM, each sound its own on each step, and live recording keeps exactly what you + played. MIDI drum notes outside 35–81 now trigger these variations: see the changelog before installing. > ⚡ **New in 0.6.85 – 0.6.92: a song generator you steer, a compact sequencer that breathes, a delay that feeds back.** > - **GEN (HOME + SELECT)**: a screen of three pages — GENRE (43 genres or RANDOM), SEED, ENERGY, FORM (loop, parts, @@ -582,17 +585,6 @@ Every update is listed here, newest first. (Since 0.6.80 at the end of the page: **EDIT · WORDS**; the LYRIC typing screen is the NAME screen's. - **Presets** (appended, every sound before keeps its number): CANTOR ES, CANTORA ES, SINGER EN, UTA JA, WORD CHOIR, SCAT EN, ROBOT EN, WHISPER JA. -- **What 0.8.5 costs** (0.8.4 → 0.8.5, the words and the mock-up's skin and lenses together): flash image 498108 → - 552440 B (+54.3 KB; the words +41.7 KB of it: the English dictionary 18.9 KB, the word banks 7.4 KB, the code, - phoneme table, UI and protocol ~15 KB; the skin and the three lenses the rest); the app slot (581564 B) keeps 29124 B - free. RAM .data+.bss 84848 → 85732 B of 98304 (+884: the six singers' state, 104 B each, and the lenses' state); the - lyrics (6 × 64 B) in the pool, the audio reads them there as it reads the FX lines. LOWBUF was full after 0.8.4 and - the project's scratch holds a copy of the lyrics (+384 B), so the fonts' decode tables (1.5 KB) moved from LOWBUF to - the pool: LOWBUF 28064 → 26900 B of 28672 (608 → 1772 B free). The pool 247584 → 257248 B (the lens panel's canvas - +7.5 KB, the decode tables, the lyrics; spare 72928 → 63264 B). No state per voice. CPU (callgrind, instructions a - sample, 4 voices): VOICE's vowels 1592 → 1605, singing 1743 (ES) / 1726 (EN), against ANALOG's 2314 with eight - voices; the heaviest section song/cputest 3046 → 3079 (+1.1 %). On the target VOICE's loop (tests/target_budget) - 312 → 315 with LANG OFF, 326 singing (ANALOG's 603). - **Tests**: tests/voice_test.c (40 Spanish words and 21 Japanese ones against their expected phonemes and syllables, the English dictionary, every bank word's syllables, the generator's determinism and phrase lengths, the vowels' F1 / F2, *s sh f* bands and levels, a plosive's closure and burst, no click at syllable changes, DC, clipping @@ -600,6 +592,52 @@ Every update is listed here, newest first. (Since 0.6.80 at the end of the page: trip and older projects without them (tests/project_test.c), LYRIC over the protocol and the editor's mock (tests/editor_test.c, web/test_web.mjs), the WORDS and LYRIC screens linted (tests/ui_render.c), cpu_vg's eng/VOICE.ES / .EN. +- **DRUM-X octaves** (the owner: "in the centre octave the DRUM-X as it is now; going up the octaves the same sounds in + ratchet with the step components that exist, an octave up half the ratchet time and so on; going down something + else"). On a DRUM track the keys keep the kit on the same keys at every OCT (C the kick, D the snare …); OCT now says + **how** they play, and the screen names it: **+1 RATCHET x2, +2 x4, +3 x8** (in time while held: playing on the step's + RATCH grid, swing included, stopped every step/n from the press); **−1 SHORT** (half the decay), **−2 GHOST** (short, + ~45 % of the level, darker: a ghost note), **−3 FLAM** (a soft grace hit, the hit ~20 ms later whatever the tempo). + OCT 0 is the kit as it was, bit for bit (every golden render unchanged). +- **Per sound** (the owner chose it): every step holds a **mode for each of the 8 sounds** (none, x2, x4, x8, SHORT, + GHOST, FLAM), on that sound's hit and its notes only. A hi-hat roll recorded onto a step with a kick ratchets the + hi-hat alone; a ghost snare leaves the kick as it is. On the DRUM grid (SEQ > STEP) **KNOB 3 HIT** of the selected + sound goes --, ON, x2, x4, x8, SHORT, GHOST, FLAM. The step's own RATCH / ECHO / TOUCH (SEQ > COMP; ECHO's new + **EVEN** keeps its repeats at one level, TOUCH a whole step's SHORT / GHOST / FLAM) work on the whole step as before. +- **Recorded as played** ("y que se graben así en record en la secuencia"): live REC writes the hit and its sound's mode, + so the pass after sounds as you heard it (tested to the block); a ratchet held over several steps writes each of them + (an early release in the last one puts it back, as a held note's TIE). The last hit recorded on a sound sets it. +- **MIDI**: 35–81 play the GM drum map exactly as before. The notes around it, which played their octave of 36–47 plain, + are now the octaves' bands by pitch class: 23–34 SHORT, 11–22 GHOST, 0–10 FLAM, 82–93 x2, 94–105 x4, 106–127 x8 (MIDI + OUT sends the keys' notes the same way). **A song or setup that sent drum notes below 35 or above 81 sounds different + now**: move them into 35–81 to keep the old sound. Notes stored in steps play as before, whatever their number; the + keys with OCT moved no longer reach GM 56–81 (MIDI still does). +- **Projects**: the same FUNC format; a step with lane modes sets bit 6 of its extension byte and adds 3 bytes (3 bits + a sound). Every 0.8.4 project loads unchanged (no modes) and saves byte for byte as before until a mode is set. + Firmware before 0.8.5 refuses a project holding a lane mode or a TOUCH (back up first) and plays an ECHO EVEN as an + ordinary, fading ECHO. User presets' patterns have no room for the modes. The editor protocol: INFO `4F 01 07`, 8 + mode bytes after a step's ratchet (written with them, read with STEP_GET's flag 1); every older reply unchanged. +- Tests: tests/drumx_oct_test.c (centre bit for bit, the ratchets stopped and playing on the grid, SHORT / GHOST / FLAM + measured, live REC played back as heard both ways, per sound: kick plain + hat x4 + snare GHOST on one step, recorded + and played back; the grid's HIT list; MIDI bands and MIDI REC; FUNC round trip, a 0.8.4-style step packed as before, + an older FUNB project with none; the OCT message, COMP); editor_test and web/test_web.mjs: the lane modes over the + protocol and the installer's notice. The installer (preview and official) shows a notice (EN / JA / ES) whenever + 0.8.5 is the version picked and asks to confirm a backup; the landing page does not. FELUCCA_VERSION is v0.8.5. + tests/ui_render.c: the grid's HIT x4 / GHOST, the OCT messages (RATCHET x8, FLAM), COMP's TOUCH and ECHO EVEN in + the mock-up's skin, every palette, linted. +- **What 0.8.5 costs** (0.8.4 → 0.8.5: the words, the DRUM-X octaves, the mock-up's skin and lenses together): flash + image 498108 → 555928 B (+57.8 KB: the words +41.7 KB of it, the English dictionary 18.9 KB, the word banks 7.4 KB, + their code, phoneme table, UI and protocol ~15 KB; the octaves +1.2 KB; the skin and the three lenses the rest); the + app slot (581564 B) keeps 25636 B free. A step is 3 bytes longer (17 → 20 B, the lanes' modes, every copy): RAM + .data+.bss 84848 → 88340 B of 98304 (the tracks' 408 steps +1224, the dice / shape / GEN copies +576, the held + ratchets; the six singers' state, 104 B each; the lenses' state). LOWBUF was full after 0.8.4: the project's scratch + (now with the lyrics, +384 B) and the fonts' decode tables (1.5 KB) moved from LOWBUF to the pool, the section stage + grew in it (+1152): LOWBUF 28064 → 18232 B of 28672 (10440 B free). The pool 247584 → 268412 B (the project scratch, + the lens panel's canvas +7.5 KB, the decode tables, the lyrics; spare 72928 → 52096 B); RAM code 21676 → 22084 B. No + state per voice. CPU (callgrind, instructions a sample): the heaviest section song/cputest 3079 → 3081; eng/DRUM + 1579 → 1582 (a table look-up a hit, a byte test a block when nothing is held or ratchets); VOICE's vowels 1606, + singing 1744 (ES) / 1727 (EN), against ANALOG's 2314 with eight voices. On the target VOICE's loop + (tests/target_budget) 312 → 315 with LANG OFF, 326 singing (ANALOG's 603); drum_render 33 and dx_run 419 unchanged. - **FX is a lens, as the approved mock-up** (FX "LENTE"): **TRACK · BUSES · EFFECT**, SELECT zooms. TRACK: an FX tap goes round SENDS · DIST · AUTO PAN, each with its picture (the sends as bars, DIST's curve, AUTO PAN's swing) and DIST's curve small under it. BUSES (a new page): the six modules DELAY REVERB CHORUS SLICER MASTER PUNCH as tiles diff --git a/docs/MANUAL.es.md b/docs/MANUAL.es.md index cdf2b218..afa7ce9c 100644 --- a/docs/MANUAL.es.md +++ b/docs/MANUAL.es.md @@ -109,7 +109,7 @@ Los nombres de abajo son los que usa el firmware (la pantalla HARDWARE CALIBRATI | **SEQ** | Páginas SEQ: en una página SEQ, el siguiente juego de perillas del nivel de zoom en el que estás; desde otro lado, vuelve al nivel y al juego que usaste por última vez en esa pista. | Capa **SEQ TOOLS** (en todas las páginas SEQ). | | **PLAY** | Arranca / para. | — | | **REC** | Arma / desarma la grabación en la pista seleccionada. | Capa **REC**: CLEAR, CLICK. | -| **OCT− / OCT+** | Octava del teclado (−3 a +3; los dos juntos: vuelve a 0). En páginas de acción y en diálogos: **OCT−** = atrás / NO, **OCT+** = hacerlo / YES. | — | +| **OCT− / OCT+** | Octava del teclado (−3 a +3; los dos juntos: vuelve a 0; en una pista DRUM el kit queda en sus teclas: ratchets arriba, SHORT / GHOST / FLAM abajo, ver [5](#5-drum-x)). En páginas de acción y en diálogos: **OCT−** = atrás / NO, **OCT+** = hacerlo / YES. | — | ### Las teclas @@ -642,6 +642,42 @@ DRUM-X es un kit sintetizado de ocho sonidos, **BD SD CP CH OH TM RS CB**, gener - **EDIT mantenido + SELECT** tira un kit nuevo alrededor del de fábrica. **EDIT mantenido + F3 (INIT)** trae de vuelta el kit de fábrica. +### El kit en cada octava (0.8.5) + +Las teclas tocan el kit en las mismas teclas en **cualquier OCT** (C el bombo, D la caja, F# el hi-hat cerrado …); OCT +ahora cambia **cómo** suenan, no qué sonido. La pantalla lo dice cuando apretás OCT en una pista DRUM: + +| OCT | Qué hace una tecla | Se graba (REC) como el golpe y el modo de su sonido | +|---|---|---| +| **+3** | **RATCHET x8**: el golpe ocho veces por paso mientras la mantenés | **x8** | +| **+2** | **RATCHET x4** | **x4** | +| **+1** | **RATCHET x2** | **x2** | +| **0** | el kit como siempre | ninguno (**ON**) | +| **−1** | **SHORT**: la mitad del decay | **SHORT** | +| **−2** | **GHOST**: corto, más suave (~45 %), más oscuro: una nota fantasma | **GHOST** | +| **−3** | **FLAM**: un golpe de adorno suave y el golpe ~20 ms después (sea cual sea el tempo) | **FLAM** | + +- Los ratchets van **a tempo**: con PLAY caen en la grilla del RATCH del paso (el comienzo de cada paso y cada paso/n, + con swing); parado, cada paso/n del DIV de la pista desde que tocás. Al soltar se detienen. +- **Cada sonido tiene su propio modo en cada paso** (0.8.5): un redoble de hi-hat grabado sobre un paso con bombo hace + ratchet solo del hi-hat, una caja fantasma deja el bombo como está. El modo vale para el golpe de ese sonido y para + sus notas en el paso (un tom grave en TM); el último golpe que grabás en un sonido lo define. +- **La grabación en vivo guarda lo que tocaste**: el paso donde cae el golpe recibe el golpe y el modo de su sonido; si + mantenés un ratchet varios pasos, cada paso en el que sigue apretado también se escribe (y lo toca el secuenciador, + así la vuelta siguiente suena exactamente como lo escuchaste). Si soltás antes de la mitad del último, ese paso + vuelve a como estaba, igual que con una nota sostenida de un sinte. +- **Verlo y editarlo** en SEQ > STEP (la grilla DRUM): KNOB 2 elige el sonido, **KNOB 3 HIT** recorre **--, ON, x2, x4, + x8, SHORT, GHOST, FLAM** para él en el paso del cursor (volver a -- saca el golpe y su modo). El RATCH, ECHO y TOUCH + propios del paso (SEQ > COMP) siguen valiendo para todo el paso, como antes. +- **MIDI** (0.8.5): las notas 35–81 siguen tocando el mapa GM de batería exactamente como antes. Las notas alrededor, + que antes sonaban como su octava de 36–47 sin más, ahora son estas octavas, por clase de altura: **23–34 SHORT, 11–22 + GHOST, 0–10 FLAM, 82–93 x2, 94–105 x4, 106–127 x8** (84 el bombo x2, 24 el bombo SHORT, 90 el hi-hat cerrado x2). Las + teclas mandan esas notas por MIDI OUT. **Una canción o un setup MIDI que mandaba notas de batería debajo de 35 o arriba + de 81** (un bombo en 24, por ejemplo) ahora va a escuchar estas variaciones: movelas a 35–81 (36–47 para las del kit) + para conservar el sonido de antes. Las notas guardadas en los pasos suenan como antes, sea cual sea su número. +- Con el ARP prendido las teclas alimentan el arpegio sin cambios (sin ratchet ni TOUCH). Las teclas de carril de la + grilla DRUM son siempre la octava central. + Un kit por sección, compartido por todas las pistas en DRUM: mientras otra pista toca DRUM-X, recorrer kits en una pista distinta deja ese kit como está ("KIT OF T4 KEPT", 0.8.1); cargá los kits en la pista de batería. El kit se guarda con cada sección de un proyecto (no con los presets de usuario — ver [12](#12-guardar-y-cargar)). --- @@ -749,6 +785,11 @@ seleccionada se graban como **automatización**. MENU > AUDIO tiene el **CLICK** FIRST solo la primera vez (una intro), !FIRST todas menos la primera (0.6.92; antes era TIMES). - **FILL**: el paso suena solo mientras mantenés **FX**. - **KILL**: el paso primero corta todo lo que suena en la pista (releases largos, notas sostenidas) y después toca. + - **TOUCH** (0.8.5, una pista DRUM): cómo se golpean todos sus sonidos, KNOB 3 **SHORT** (la mitad del decay), + **GHOST** (corto, más suave, más oscuro), **FLAM** (un golpe de adorno suave ~20 ms antes); un solo sonido: su modo + en la grilla (ver [5](#5-drum-x)). En otros motores no hace nada. + - **EVEN** del ECHO (0.8.5): un ECHO que mantiene cada repetición al nivel del paso (un ratchet más allá del x4 de + RATCH, puesto desde el editor o una versión de desarrollo de 0.8.5); la tarjeta muestra "x8 EVEN", KNOB 3 lo conserva. - **WALK** y **CLIMB** (0.6.98, a la manera de los componentes evolutivos del OP-Z y el OP-XY): las notas del paso se mueven un grado de la escala (WALK) o una octava (CLIMB) **cada tantas vueltas** del patrón (KNOB 4: 1 … 10, 12, 16 vueltas por movimiento), dentro de un **rango** (WALK 3, 5, 7 o 12 grados; CLIMB 1 … 4 octavas), y vuelven a diff --git a/docs/MANUAL.md b/docs/MANUAL.md index 03f964b7..3ff0682b 100644 --- a/docs/MANUAL.md +++ b/docs/MANUAL.md @@ -107,7 +107,7 @@ The names below are the ones the firmware uses (the HARDWARE CALIBRATION screen | **SEQ** | SEQ pages: on a SEQ page, the next set of knobs of the zoom level you are on; from elsewhere, back to the level and set you last used on that track. | **SEQ TOOLS** layer (on every SEQ page). | | **PLAY** | Start / stop. | — | | **REC** | Arms / disarms recording on the selected track. | **REC** layer: CLEAR, CLICK. | -| **OCT− / OCT+** | Keyboard octave (−3 to +3; both together: back to 0). On action pages and in dialogs: **OCT−** = back / NO, **OCT+** = do it / YES. | — | +| **OCT− / OCT+** | Keyboard octave (−3 to +3; both together: back to 0; on a DRUM track the kit stays on its keys: ratchets above, SHORT / GHOST / FLAM below, see [5](#5-drum-x)). On action pages and in dialogs: **OCT−** = back / NO, **OCT+** = do it / YES. | — | ### The keys @@ -618,6 +618,42 @@ DRUM-X is a synthesized kit of eight sounds, **BD SD CP CH OH TM RS CB**, genera - **EDIT held + SELECT** rolls a new kit around the factory one. **EDIT held + F3 (INIT)** brings the factory kit back. +### The kit in every octave (0.8.5) + +The keys play the kit on the same keys at **every OCT** (C the kick, D the snare, F# the closed hat …); OCT now +changes **how** they play, not which sound. The screen says it when you press OCT on a DRUM track: + +| OCT | What a key does | Recorded (REC) as the hit and its sound's mode | +|---|---|---| +| **+3** | **RATCHET x8**: the hit eight times a step while held | **x8** | +| **+2** | **RATCHET x4** | **x4** | +| **+1** | **RATCHET x2** | **x2** | +| **0** | the kit as it always was | none (**ON**) | +| **−1** | **SHORT**: half the decay | **SHORT** | +| **−2** | **GHOST**: short, softer (~45 %), darker: a ghost note | **GHOST** | +| **−3** | **FLAM**: a soft grace hit, then the hit ~20 ms later (whatever the tempo) | **FLAM** | + +- The ratchets are **in time**: playing, the hits fall on the step's RATCH grid (each step's start, then every step/n, + swing included); stopped, every step/n of the track's DIV from the press. Letting go stops them. +- **Each sound has its own mode on each step** (0.8.5): a hi-hat roll recorded onto a step that has a kick ratchets + the hi-hat only, a ghost snare leaves the kick as it is. The mode applies to that sound's hit and to its notes on the + step (a low tom on TM); the last hit you record on a sound sets it. +- **Live recording keeps what you played**: the step you hit gets the hit and its sound's mode; hold a ratchet over + several steps and every step it is held into is written too (and plays from the sequencer, so the next pass sounds + exactly as you heard it). Let go before the middle of the last one and that step is put back, as with a held synth + note. +- **See and edit it** on SEQ > STEP (the DRUM grid): KNOB 2 picks the sound, **KNOB 3 HIT** goes **--, ON, x2, x4, x8, + SHORT, GHOST, FLAM** for it on the cursor step (left back to -- takes the hit and its mode away). The step's own + RATCH, ECHO and TOUCH (SEQ > COMP) still work on the whole step, as before. +- **MIDI** (0.8.5): notes 35–81 still play the GM drum map exactly as before. The notes around it, which used to play + their octave of 36–47 plain, are now these octaves, by pitch class: **23–34 SHORT, 11–22 GHOST, 0–10 FLAM, 82–93 + x2, 94–105 x4, 106–127 x8** (84 the kick x2, 24 the kick SHORT, 90 the closed hat x2). The keys send those notes to + MIDI OUT. **A song or MIDI setup that sent drum notes below 35 or above 81** (a kick on 24, say) will now hear these + variations: move them into 35–81 (36–47 for the kit's own) to keep the old sound. Notes stored in the steps play as + before, whatever their number. +- With the ARP on, the keys feed the arp plain (no ratchet or TOUCH). The DRUM grid's lane keys are always the centre + octave. + One kit per section, shared by every track on DRUM: while another track plays DRUM-X, browsing kit presets on a different track keeps that kit ("KIT OF T4 KEPT", 0.8.1); load kits on the drum track itself. The kit is saved with each section of a project (not with user presets — see [12](#12-saving-and-loading)). --- @@ -718,6 +754,11 @@ recorded into the pattern, quantized to its steps, overdubbing. Knob moves on th the first time (an intro), !FIRST every loop but the first (0.6.92; it was TIMES). - **FILL**: the step plays only while **FX** is held. - **KILL**: the step first cuts everything the track is sounding (long releases, held notes), then plays. + - **TOUCH** (0.8.5, a DRUM track): how all its hits are struck, KNOB 3 **SHORT** (half the decay), **GHOST** (short, + softer, darker), **FLAM** (a soft grace hit ~20 ms before); one sound alone: its mode on the grid (see + [5](#5-drum-x)). On other engines it does nothing. + - ECHO's **EVEN** (0.8.5): an ECHO that keeps every repeat at the step's level (a ratchet past RATCH's x4, set from + the editor or a 0.8.5 development build); the card shows "x8 EVEN", KNOB 3 keeps it. - **WALK** and **CLIMB** (0.6.98, after the OP-Z's and OP-XY's evolving components): the step's notes move one degree of the scale (WALK) or one octave (CLIMB) **every so many loops** of the pattern (KNOB 4: 1 … 10, 12, 16 loops a move), over a **range** (WALK 3, 5, 7 or 12 degrees; CLIMB 1 … 4 octaves), then round again. KNOB 3 the diff --git a/docs/cheatsheet-controls.pdf b/docs/cheatsheet-controls.pdf index 3ac4cb6f..bec3fd62 100644 Binary files a/docs/cheatsheet-controls.pdf and b/docs/cheatsheet-controls.pdf differ diff --git a/docs/cheatsheet-controls.png b/docs/cheatsheet-controls.png index 113cd37a..78f7953a 100644 Binary files a/docs/cheatsheet-controls.png and b/docs/cheatsheet-controls.png differ diff --git a/docs/cheatsheet-sound.pdf b/docs/cheatsheet-sound.pdf index 3730c9dc..dda52a6f 100644 Binary files a/docs/cheatsheet-sound.pdf and b/docs/cheatsheet-sound.pdf differ diff --git a/docs/cheatsheet-sound.png b/docs/cheatsheet-sound.png index a3578180..97cf51c9 100644 Binary files a/docs/cheatsheet-sound.png and b/docs/cheatsheet-sound.png differ diff --git a/docs/cheatsheet/controls.html b/docs/cheatsheet/controls.html index 28ce85e4..7ddbe69b 100644 --- a/docs/cheatsheet/controls.html +++ b/docs/cheatsheet/controls.html @@ -53,7 +53,7 @@ ul { padding-left: 18px; } li { margin: 2px 0; }

JIANT FM · CONTROLS

every button, knob, layer, combo and page

firmware v0.8.5 · M-VAVE FM-1 · juanjiant-bit.github.io/JIANT
-
THE PANEL

KNOBS AND TRANSPORT

MASTERMaster volume.
SELECTScrolls the section's pages (SEQ: zooms PATTERN · BAR · STEP; SAVE: LIBRARY · PROJECT · SOUND; FX: TRACK · BUSES · EFFECT; HOME: GEN, the song generator). Held with a button, its dice (OK keeps, CANCEL back): HOME everything, EDIT the sound, SEQ the sequence, LFO the LFO, FX the effects. GLO + SELECT: the tempo.
PRESETSBrowses the sounds (factory and user). On step, list and song pages: the cursor / the row; SEQ at PATTERN: the bar. Hold a page button + PRESETS: jump through its pages.
ALGORITHMSelects the track from any page: T1–T4, or T1–T6 with TRACKS 6.
KNOB 1–4The four columns on screen. Fast sweeps the whole range, slow fine-tunes. With a layer held: the layer's.
OCT− · OCT+The keyboard's octave (both together: back to 0). On action pages and dialogs: back / confirm.
PLAYStart / stop. GLO + PLAY: restart from the top.
RECArms live recording on the selected track (notes and knob moves, overdub).
HOMETap: the ecosystem. Hold: the MENU.
KEYS27 keys play the selected track in its scale; with a layer held they become that layer's.

PAGE BUTTONS

BUTTONTAP: ITS PAGES, ONE PER TAPHOLD
ENVENV · ENV DEST—
LFOLFO · LFO DEST · MOD · MSEQ · MSEQ 2MACROS M1–M4 (stay latched)
FXthe zoom level's next (SELECT zooms; PRESETS the module): TRACK: SENDS · DIST · AUTO PAN | BUSES: DLY MIX · REV SIZE · CHORUS DEPTH · SLICER DEPTH, FX opens the module | EFFECT: DELAY · REVERB · CHORUS · SLICER · MASTER · PUNCH, their pagesPUNCH-IN FX
SCLSCL · CHORDROOT by key
EDITEDIT 1 · EDIT 2 · FILTER · VOICE (VOICE: WORDS; FM6: OPERATOR · OP ENV · OPERATOR 2; DRUM: KIT · KIT 2 · KIT 3 · X-MOD · FILTER · SOUND 1–4 · LEVELS 1–2 · STEREO)INIT · RECALL · sound mutes
GLOMIXER · GLOBAL · SYSTEMMUTE · SOLO · LEVEL · TAP
SAVEthe zoom level's two sets (SELECT zooms; from elsewhere SOUND's USER): LIBRARY: PROJECT · TOOLS | PROJECT: SECTIONS · ARRANGE | SOUND: USER · PRESETSSONG layer
ARPARP · ARP 2—
SEQthe zoom level's sets (SELECT zooms): PATTERN: PATTERN · STRETCH · PLAYHEADS · TRACK · MUTATE | BAR: STEP · NOTE · AUTOMATION · AUTO LIST | STEP: NOTE · COMP · COMP 2SEQ TOOLS
REC(transport)CLEAR · CLICK

BUTTON + PRESETS jumps through its pages (no wrap). SELECT alone scrolls the section's pages.

LAYERS · HOLD A BUTTON

FX · PUNCH-IN EFFECTS

F3REP 1/8
G3REP 1/16
A3REP 1/32
B3LPF
C4HPF
D4OCT−
E4OCT+
F4½ TEMPO
G4DEC−
A4DEC+
B4STUT 1/8
C5STUT 1/16
D5ATK+
E5ARP
F5RAND
G5ERASE
F#M1
G#M2
A#M3
C#M4
D#M5
F#M6
G#
A#TGT
C#
D#
F#

A key plays its effect while held (MENU FX LATCH ON: toggles); hold FX and let go untouched: LOCKED open, FX again unlocks; OCT- all off. In on the next 1/16. Black 1–6 mute T1–T6, A#4 picks which tracks the MIDI ones touch (all · synths · drums). With REC armed and playing they record into the section's lane; G5 erases it.

KNOBS

FILTERCRUSHTHROWDEPTH

GLO · MIX

F3SOLO 1
G3SOLO 2
A3SOLO 3
B3SOLO 4
C4SOLO 5
D4SOLO 6
E4ALL
F4TAP
G4UNDO
A4
B4
C5
D5
E5
F5
G5
F#M1
G#M2
A#M3
C#M4
D#M5
F#M6
G#KICK
A#SNR
C#HAT
D#PERC
F#

Black 1–6 mute T1–T6 (latched), 7–10 the DRUM-X groups. White: solo while held, E4 unmutes all, F4 tap tempo, G4 UNDO the last big change (again: redo), A4 FREEZE MUTATE. SELECT: the tempo. PLAY: restart.

KNOBS

LEVEL T1LEVEL T2LEVEL T3LEVEL T4

T5 or T6 selected: the knobs are T3–T6.

SAVE · SONG

F3PLAY A
G3PLAY B
A3PLAY C
B3PLAY D
C4STORE A
D4STORE B
E4STORE C
F4STORE D
G4
A4
B4
C5
D5LOOP/ SONG
E5SONG REC
F5
G5SONG
F#
G#
A#
C#
D#
F#
G#
A#
C#
D#
F#

PLAY A–D on the next bar (several in one hold: a quick chain), STORE the section into A–D. OCT+ stores the playing section, OCT− recalls it. On the SONG page KNOB 4 stores a scene.

KNOBS

SONG 1–8---

EDIT · SOUND

F3INIT
G3RECALL
A3
B3
C4
D4
E4
F4
G4
A4
B4
C5
D5
E5
F5
G5
F#BD
G#SD
A#CP
C#CH
D#OH
F#TM
G#RS
A#CB
C#
D#
F#

INIT: the factory sound (DRUM: the kit too). RECALL: the sound stored in the section. On a DRUM track black 1–8 mute each DRUM-X sound.

KNOBS

EDIT 1EDIT 2EDIT 3EDIT 4

LFO · MACROS

Knobs M1–M4; they stay latched when let go (LFO again: off). F3 rolls new routes, G3 clears them (only tracks that sound). LFO + SELECT: the track's LFO diced.

KNOBS

M1M2M3M4

SCL · SCALE

Any key sets the ROOT. ROOT and SCALE are every melodic track's (and RESO's).

KNOBS

ROOTSCLOFSPIT

SEQ · TOOLS

On the SEQ pages: F3 CLEAR · G3 REVERSE · A3 B3 SHIFT · C4 RANDOM · D4 COOK · E4 BEAT · F4 CLR AUTO (the automation).

KNOBS

LENDIVSWINGGATE

REC · RECORD

F3 CLEAR the track (at once; GLO + G4 undoes it), G3 the metronome CLICK.

KNOBS

CLICK---
COMBOS

BUTTONS TOGETHER

HOME · EDIT · SEQ · LFO · FX + SELECTTheir dice: everything · sound · sequence · LFO · effects (KEEP? OK / CANCEL).
PAGE BUTTON + PRESETSJump through that button's pages.
REC + FXEDITENVLFOSCLARPGLOClear that part's automation on the selected track (FX: the punch-in lane too).
SEQ + RECCLEAR ALL SEQUENCES? (OCT+ confirms).
SAVE + OCT+ / OCT−Store / recall the playing section.
GLO + PLAYRestart from the top.
GLO + SELECTTempo (from any page).
STEP HELD + KNOBA parameter lock on that step (roll, grid).
HOME heldMENU: knob accel, FX latch, hold time, USB level, palettes, animation…
EVERY PAGE · KNOB 1 – 4

ENV

ENV
ATKDECSUSREL
ENV DEST
FILTERPITCHSHAPELOOP

LFO

LFO
RATEWAVEPHASEFADE
LFO DEST
PITCHFILTERSHAPEAMP
MOD
SLOTSRCDESTAMT
MSEQ
STEPLEVELLENSLEW
MSEQ 2
DIV---

SCL · ARP

SCLROOT SCALE QUANT ALL TR
CHORD
CHORDVOICINGSTRUM-
ARP
MODERATEOCTGATE
ARP 2
SWINGPROBHOLDORDER

FX

FX
DISTCHORUSDLYREV
DIST
DISTTYPETONE-
AUTO PAN
DEPTHRATESYNCWAVE
SLICER
MODEPATRATEDEPTH
SL BUS
T1T2T3T4
SL BUS 2
T5T6FX-
SL PITCH
STEPPITCHLENQUANT
DLY
TIMEFEEDBKTONEMIX
DLY 2
WIDEPITCHSPRAYMOD
DLY 3
TYPEPING--
REVERB
TYPESIZEDAMPPRE/AIR
REVERB 2
MODRATEFILTWIDE
CHORUS
RATEDEPTHSTEREO-
MASTER
CLIPPUNCHDUCKREL
PUNCH
LENRESRECCLEAR

EDIT

EDIT 1
E1E2E3E4
EDIT 2
E5E6E7E8
WORDSLANG LYRIC POS (OCT+ TYPE)
RETRIG
RTRG---
OPERATOR
OPRATIOFINELEVEL
OP ENV
OPSTAGERATELEVEL
OPERATOR 2
OPMODEDETUNEVEL
FILTER
TYPECUTRESDRIVE
VOICE
VOICEGLIDEMODEPRIO
KIT 3
BPFEEDBK--
X-MOD
RATEDEPTHSHAPERAND
LEVELS
KICKSNARECLAPHATCL
LEVELS 2
HATOPTOMRIMBELL
SOUND
SOUNDSIDEPITCHPMOD
SOUND 2
SOUNDDECAYNOISECOLOR
SOUND 3
SOUNDMODEPM.TYPEDRIVE
SOUND 4
SOUNDLAYERFEEDBKSEND
STEREO
IMAGE---

SEQ

PATTERN
LENDIVSWINGGATE
STRETCH
x/÷REPEATNUDGEROTATE
PLAYHEADS
HEADRATEDIRINTVL
TRACKPITCH CHANCE HUMAN REC Q
MUTATE
SOUNDPATTERNAMOUNTMODE
STEP
STEPNOTETIMEFLAG
STEP · DRUM
STEPLANEHITACC
NOTE
FOCUSPITCHMOVEMICRO
AUTOMATION
PLAYEVENTLOCKCLEAR
AUTO LIST
ROWSTEPPARAMVALUE
COMP
STEPTYPEVALEVERY
COMP 2
STEPTYPEVALEVERY

GLO · SAVE

MIXER
LEVELPANREVMUTE
GLOBAL
BPMSWINGCLOCKTUNE
SYSTEM
TRACKSLOADROUTECPU
PRESETS
No.ENGFAVLIST
USER
SLOTLOADERASESAVE
PROJECTPROJECT SECT LOAD SAVE (PROJECT level: SECT NAME LOAD SAVE)
ARRANGEROW SECT BARS SCENE (OCT+ adds a row)
TOOLSCLEAR SEQ · INIT SOUND · DEL ROW · CLEAR SONG · NEW PROJECT · CPU TEST: K1 picks, OCT+
+
THE PANEL

KNOBS AND TRANSPORT

MASTERMaster volume.
SELECTScrolls the section's pages (SEQ: zooms PATTERN · BAR · STEP; SAVE: LIBRARY · PROJECT · SOUND; FX: TRACK · BUSES · EFFECT; HOME: GEN, the song generator). Held with a button, its dice (OK keeps, CANCEL back): HOME everything, EDIT the sound, SEQ the sequence, LFO the LFO, FX the effects. GLO + SELECT: the tempo.
PRESETSBrowses the sounds (factory and user). On step, list and song pages: the cursor / the row; SEQ at PATTERN: the bar. Hold a page button + PRESETS: jump through its pages.
ALGORITHMSelects the track from any page: T1–T4, or T1–T6 with TRACKS 6.
KNOB 1–4The four columns on screen. Fast sweeps the whole range, slow fine-tunes. With a layer held: the layer's.
OCT− · OCT+The keyboard's octave (both together: back to 0); on DRUM the kit stays put: +1/+2/+3 ratchet x2/x4/x8, −1 SHORT, −2 GHOST, −3 FLAM, each sound its own (grid KNOB 3 HIT). On action pages and dialogs: back / confirm.
PLAYStart / stop. GLO + PLAY: restart from the top.
RECArms live recording on the selected track (notes and knob moves, overdub).
HOMETap: the ecosystem. Hold: the MENU.
KEYS27 keys play the selected track in its scale; with a layer held they become that layer's.

PAGE BUTTONS

BUTTONTAP: ITS PAGES, ONE PER TAPHOLD
ENVENV · ENV DEST—
LFOLFO · LFO DEST · MOD · MSEQ · MSEQ 2MACROS M1–M4 (stay latched)
FXthe zoom level's next (SELECT zooms; PRESETS the module): TRACK: SENDS · DIST · AUTO PAN | BUSES: DLY MIX · REV SIZE · CHORUS DEPTH · SLICER DEPTH, FX opens the module | EFFECT: DELAY · REVERB · CHORUS · SLICER · MASTER · PUNCH, their pagesPUNCH-IN FX
SCLSCL · CHORDROOT by key
EDITEDIT 1 · EDIT 2 · FILTER · VOICE (VOICE: WORDS; FM6: OPERATOR · OP ENV · OPERATOR 2; DRUM: KIT · KIT 2 · KIT 3 · X-MOD · FILTER · SOUND 1–4 · LEVELS 1–2 · STEREO)INIT · RECALL · sound mutes
GLOMIXER · GLOBAL · SYSTEMMUTE · SOLO · LEVEL · TAP
SAVEthe zoom level's two sets (SELECT zooms; from elsewhere SOUND's USER): LIBRARY: PROJECT · TOOLS | PROJECT: SECTIONS · ARRANGE | SOUND: USER · PRESETSSONG layer
ARPARP · ARP 2—
SEQthe zoom level's sets (SELECT zooms): PATTERN: PATTERN · STRETCH · PLAYHEADS · TRACK · MUTATE | BAR: STEP · NOTE · AUTOMATION · AUTO LIST | STEP: NOTE · COMP · COMP 2SEQ TOOLS
REC(transport)CLEAR · CLICK

BUTTON + PRESETS jumps through its pages (no wrap). SELECT alone scrolls the section's pages.

LAYERS · HOLD A BUTTON

FX · PUNCH-IN EFFECTS

F3REP 1/8
G3REP 1/16
A3REP 1/32
B3LPF
C4HPF
D4OCT−
E4OCT+
F4½ TEMPO
G4DEC−
A4DEC+
B4STUT 1/8
C5STUT 1/16
D5ATK+
E5ARP
F5RAND
G5ERASE
F#M1
G#M2
A#M3
C#M4
D#M5
F#M6
G#
A#TGT
C#
D#
F#

A key plays its effect while held (MENU FX LATCH ON: toggles); hold FX and let go untouched: LOCKED open, FX again unlocks; OCT- all off. In on the next 1/16. Black 1–6 mute T1–T6, A#4 picks which tracks the MIDI ones touch (all · synths · drums). With REC armed and playing they record into the section's lane; G5 erases it.

KNOBS

FILTERCRUSHTHROWDEPTH

GLO · MIX

F3SOLO 1
G3SOLO 2
A3SOLO 3
B3SOLO 4
C4SOLO 5
D4SOLO 6
E4ALL
F4TAP
G4UNDO
A4
B4
C5
D5
E5
F5
G5
F#M1
G#M2
A#M3
C#M4
D#M5
F#M6
G#KICK
A#SNR
C#HAT
D#PERC
F#

Black 1–6 mute T1–T6 (latched), 7–10 the DRUM-X groups. White: solo while held, E4 unmutes all, F4 tap tempo, G4 UNDO the last big change (again: redo), A4 FREEZE MUTATE. SELECT: the tempo. PLAY: restart.

KNOBS

LEVEL T1LEVEL T2LEVEL T3LEVEL T4

T5 or T6 selected: the knobs are T3–T6.

SAVE · SONG

F3PLAY A
G3PLAY B
A3PLAY C
B3PLAY D
C4STORE A
D4STORE B
E4STORE C
F4STORE D
G4
A4
B4
C5
D5LOOP/ SONG
E5SONG REC
F5
G5SONG
F#
G#
A#
C#
D#
F#
G#
A#
C#
D#
F#

PLAY A–D on the next bar (several in one hold: a quick chain), STORE the section into A–D. OCT+ stores the playing section, OCT− recalls it. On the SONG page KNOB 4 stores a scene.

KNOBS

SONG 1–8---

EDIT · SOUND

F3INIT
G3RECALL
A3
B3
C4
D4
E4
F4
G4
A4
B4
C5
D5
E5
F5
G5
F#BD
G#SD
A#CP
C#CH
D#OH
F#TM
G#RS
A#CB
C#
D#
F#

INIT: the factory sound (DRUM: the kit too). RECALL: the sound stored in the section. On a DRUM track black 1–8 mute each DRUM-X sound.

KNOBS

EDIT 1EDIT 2EDIT 3EDIT 4

LFO · MACROS

Knobs M1–M4; they stay latched when let go (LFO again: off). F3 rolls new routes, G3 clears them (only tracks that sound). LFO + SELECT: the track's LFO diced.

KNOBS

M1M2M3M4

SCL · SCALE

Any key sets the ROOT. ROOT and SCALE are every melodic track's (and RESO's).

KNOBS

ROOTSCLOFSPIT

SEQ · TOOLS

On the SEQ pages: F3 CLEAR · G3 REVERSE · A3 B3 SHIFT · C4 RANDOM · D4 COOK · E4 BEAT · F4 CLR AUTO (the automation).

KNOBS

LENDIVSWINGGATE

REC · RECORD

F3 CLEAR the track (at once; GLO + G4 undoes it), G3 the metronome CLICK.

KNOBS

CLICK---
COMBOS

BUTTONS TOGETHER

HOME · EDIT · SEQ · LFO · FX + SELECTTheir dice: everything · sound · sequence · LFO · effects (KEEP? OK / CANCEL).
PAGE BUTTON + PRESETSJump through that button's pages.
REC + FXEDITENVLFOSCLARPGLOClear that part's automation on the selected track (FX: the punch-in lane too).
SEQ + RECCLEAR ALL SEQUENCES? (OCT+ confirms).
SAVE + OCT+ / OCT−Store / recall the playing section.
GLO + PLAYRestart from the top.
GLO + SELECTTempo (from any page).
STEP HELD + KNOBA parameter lock on that step (roll, grid).
HOME heldMENU: knob accel, FX latch, hold time, USB level, palettes, animation…
EVERY PAGE · KNOB 1 – 4

ENV

ENV
ATKDECSUSREL
ENV DEST
FILTERPITCHSHAPELOOP

LFO

LFO
RATEWAVEPHASEFADE
LFO DEST
PITCHFILTERSHAPEAMP
MOD
SLOTSRCDESTAMT
MSEQ
STEPLEVELLENSLEW
MSEQ 2
DIV---

SCL · ARP

SCLROOT SCALE QUANT ALL TR
CHORD
CHORDVOICINGSTRUM-
ARP
MODERATEOCTGATE
ARP 2
SWINGPROBHOLDORDER

FX

FX
DISTCHORUSDLYREV
DIST
DISTTYPETONE-
AUTO PAN
DEPTHRATESYNCWAVE
SLICER
MODEPATRATEDEPTH
SL BUS
T1T2T3T4
SL BUS 2
T5T6FX-
SL PITCH
STEPPITCHLENQUANT
DLY
TIMEFEEDBKTONEMIX
DLY 2
WIDEPITCHSPRAYMOD
DLY 3
TYPEPING--
REVERB
TYPESIZEDAMPPRE/AIR
REVERB 2
MODRATEFILTWIDE
CHORUS
RATEDEPTHSTEREO-
MASTER
CLIPPUNCHDUCKREL
PUNCH
LENRESRECCLEAR

EDIT

EDIT 1
E1E2E3E4
EDIT 2
E5E6E7E8
WORDSLANG LYRIC POS (OCT+ TYPE)
RETRIG
RTRG---
OPERATOR
OPRATIOFINELEVEL
OP ENV
OPSTAGERATELEVEL
OPERATOR 2
OPMODEDETUNEVEL
FILTER
TYPECUTRESDRIVE
VOICE
VOICEGLIDEMODEPRIO
KIT 3
BPFEEDBK--
X-MOD
RATEDEPTHSHAPERAND
LEVELS
KICKSNARECLAPHATCL
LEVELS 2
HATOPTOMRIMBELL
SOUND
SOUNDSIDEPITCHPMOD
SOUND 2
SOUNDDECAYNOISECOLOR
SOUND 3
SOUNDMODEPM.TYPEDRIVE
SOUND 4
SOUNDLAYERFEEDBKSEND
STEREO
IMAGE---

SEQ

PATTERN
LENDIVSWINGGATE
STRETCH
x/÷REPEATNUDGEROTATE
PLAYHEADS
HEADRATEDIRINTVL
TRACKPITCH CHANCE HUMAN REC Q
MUTATE
SOUNDPATTERNAMOUNTMODE
STEP
STEPNOTETIMEFLAG
STEP · DRUM
STEPLANEHITACC
NOTE
FOCUSPITCHMOVEMICRO
AUTOMATION
PLAYEVENTLOCKCLEAR
AUTO LIST
ROWSTEPPARAMVALUE
COMP
STEPTYPEVALEVERY
COMP 2
STEPTYPEVALEVERY

GLO · SAVE

MIXER
LEVELPANREVMUTE
GLOBAL
BPMSWINGCLOCKTUNE
SYSTEM
TRACKSLOADROUTECPU
PRESETS
No.ENGFAVLIST
USER
SLOTLOADERASESAVE
PROJECTPROJECT SECT LOAD SAVE (PROJECT level: SECT NAME LOAD SAVE)
ARRANGEROW SECT BARS SCENE (OCT+ adds a row)
TOOLSCLEAR SEQ · INIT SOUND · DEL ROW · CLEAR SONG · NEW PROJECT · CPU TEST: K1 picks, OCT+
\ No newline at end of file diff --git a/docs/cheatsheet/sound.html b/docs/cheatsheet/sound.html index 350d059c..6827438e 100644 --- a/docs/cheatsheet/sound.html +++ b/docs/cheatsheet/sound.html @@ -53,7 +53,7 @@ ul { padding-left: 18px; } li { margin: 2px 0; }

JIANT FM · SOUND · FX · MOD

engines, effects, modulation, sequencer and songs

firmware v0.8.5 · M-VAVE FM-1 · juanjiant-bit.github.io/JIANT
-
ENGINES · EDIT 1 / EDIT 2

NINE ENGINES, ALL SYNTHESIS

ENGINEEDIT 1EDIT 2WHAT TO KNOW
ANALOG
WAVEDETUNEMIXNOISE
CUTRESDRIVEINT
SAW SQR TRI SIN PWM SYNC RING SAW3; INT: osc 2 ±24 st. Its filter is per voice.
FM6
ALGFBMODRATIO
MEGVMODDETUNESLOT
Dexed's 6 operators, 32 algorithms drawn, .syx patches (SLOT), MOD / RATIO move the modulators. OPERATOR · OP ENV · OPERATOR 2: each operator on the device (ratio / fixed, fine, level, its envelope, mode, detune, velocity). SLOT B1–B32: a 32-voice .syx sent from the web editor.
PHASE
WAVEWAVE2DCWENV
DETUNELINESUBFB
Phase distortion (CZ); FB feeds the output back into the phase: hard edge to growl.
LOFI
CHIPWAVEDUTYCRUSH
-VIBBENDMASK
Chip: PLS TRI SAW NOIS WRAM. BYTE: ALGO VAR · MOTN GRIT BEND LOOP. FLOAT (floatbeat): ALGO VAR · MOTN FBK BEND LOOP; CHIP sets FULL / 4BIT / 1BIT.
VOICE
VOWELVOWEL2TALKSHIFT
BUZZBREATHQRAND
Formant voice (after klattsch): vowels, talk, breath. WORDS (0.8.5): LANG ES / EN / JA sings syllables, a note each (POS THEME ARTIC SHIFT · BUZZ BREATH Q LOOP); LYRIC TEXT (OCT+ on WORDS types it, KNOB 3 dice; the web editor sends it) or W1–16 words, S1–8 scat; "-" holds the vowel.
WHEEL
REGSUBBODYTOP
PERCCLICKDRIVEROTOR
Drawbar organ: registrations, percussion, rotary.
NOISE
MODECOLORFREQPEAK
TRKDENSEDRIFTCRUSH
Coloured and metallic noise, tracked or free.
DRUM-X
MORPHTUNETONEDECAY
NOISEFMENVFOLDDRIVE
8 sounds BD SD CP CH OH TM RS CB, sides A / B: MORPH morphs the kit. The kit first: KIT 3 BP FEEDBK, X-MOD RATE DEPTH SHAPE RAND. Then a sound (KNOB 1 the sound): SIDE PITCH PMOD · DECAY NOISE COLOR · MODE PM.TYPE DRIVE · LAYER (no note) FEEDBK SEND (CHO / DLY / REV). Last LEVELS and STEREO IMAGE (a knob through the kit's stereo placings).
ANIMAL
MODEPRESSCHAOSSIZE
SWEEPRATEGROUPTEMP
Animal calls (0.8.3), MODE the source: CMOS the 40106 / 4093 bird circuit (TOUCH COUPLE CAP · HYST RATE GROUP FM) · PULSE crickets, cicadas, frogs (CLICK Q · DETUNE) · WHSTL birds, a Hopf whistle · WING mosquito, bee, fly (BUZZ DRIFT · DOPPLR) · GLOTT wolf, bark, roar, purr (MOUTH ROUGH · AIR). GROUP: syllables + gaps; TEMP °C speeds a cricket up (Dolbear). A note is a call.

FILTER · EVERY ENGINE

TYPECUTRESDRV

LP · HP · BP · COMB. COMB rings tuned to the note: CUT moves it ±32 st, RES how much it rings. ANALOG and LOFI: per voice; the others: on the track, following LFO / ENV DEST FLT (DRV = the track's DIST).

VOICE · PLAYING

VCEGLDGLMODPRIO

POLY · MONO · LEG · UNI; glide and its mode; LAST / LOW / HIGH priority. 8 voices shared by the six tracks (MONO and LEGATO keep their note).

DICE

EDIT + SELECT: a random factory preset of the engine, every parameter moved up to a quarter of its range. DRUM-X: both sides of every sound around the factory kit. Heard at once: OCT+ OK keeps it, OCT- CANCEL brings the sound back. SEQ / LFO / FX + SELECT: the sequence, the LFO, the effects, the same way. HOME + SELECT: GEN, the song generator: GENRE (43 or RANDOM) · SEED · ENERGY · FORM; DRUMS · BASS · CHORDS · ARP · LEAD amounts; COMPLEX · SWING · HUMAN. OCT+ makes the piece (again: a new seed), HOME done. GLO + G4 undoes.

MODULATION

ENV · LFO

ENV

ATKDECSUSREL

ENV DEST

FLTPITSHPLOOP

LOOP: held, the envelope cycles from the sustain: an ADSR-shaped LFO.

LFO

RATEWAVEPHSFADE

SIN TRI SAW SQR S&H

LFO DEST

PITFLTSHPAMP

MOD MATRIX · 4 SLOTS A TRACK

SLOTSRCDSTAMT

SOURCES

LFOENVVELKEYRANDMODWATEXPRM1M2M3M4STEP

DESTINATIONS

PITCHCUTSHPAMPPANDISTCHODLYREVRATEVIBE1…E8CLIPPNCHD.TIMD.FBD.TOND.MIXR.SIZR.DMPC.RATC.DEP

E1…E8: the engine's own EDIT knobs. CLIP / PNCH: the master. D. R. C.: the DELAY, REVERB and CHORUS buses (a STEP source on D.TIM sequences the delay time).

MSEQ · MACROS

MSEQ · A CV SEQUENCER PER TRACK

STEPLVLLENSLEW

16 levels, DIV on MSEQ 2, in time with the transport. Use it from MOD, SRC STEP.

MACROS M1–M4

Hold LFO: the knobs are M1–M4, latched until LFO again. Each session starts with 2 random routes a track; F3 rolls new ones, G3 clears. By hand: MOD, SRC M1…M4. Saved with the project.

SEQUENCER

64 steps a track, up to 4 notes a step, piano roll and drum grid. LENTE: SELECT zooms PATTERN (the bars; PRESETS the bar) · BAR (the roll / grid) · STEP (one step large, its chips); SEQ taps round the level's sets and comes back to the track's last. Hold a step + turn a knob: a parameter lock. Step recording: hold a chord + KNOB 1 its length; + ARP: arpeggiated (K1 rate, K2 order, K3 oct). COMP / COMP 2: two components a step (CHANCE, RATCH, ARP NOTES / SEQ / SCALE, TRIG, RAND, OCT, TONAL, BEND, ECHO, PULSE, JUMP, REV, FILL, KILL, WALK, CLIMB); a TRIG or FILL wins; WALK / CLIMB: a degree / an octave further every N loops (K4), UP DOWN UP-DN RND over a range (K3), stackable; ARP: ORDER × range, RATE in note values (x1 1/32 1/32T 1/64 1/64T 1/128); RATCH / ECHO: DIV; EVERY (KNOB 4): the loops the step's components play on (ALWAYS 1:2 2:2 1:3 .. 4:4 1:8 FIRST !FIRST SKIP). TRACK: PITCH, CHANCE thins the whole track, HUMAN one amount (velocity, timing, gate, decay / release), REC Q. STRETCH / REPEAT act as the knob turns; ROTATE reads the sequence from another step; NOTE's MICRO moves a step off the grid. REC + knobs while playing: automation (64 records a section, MOTION page plays / clears them, AUTO LIST edits them).

PATTERN · TRACK

LENDIVSWGGATE
PITCHNHUMRECQ

SCALE · ARP

ROOT and SCALE are every melodic track's: CHR MAJ MIN DOR MIX PEN MPEN HARM PHRY LYD LOC MEL BLUES WHOLE DIMHW DIMWH. QNT snaps keys or the sequence, ALL TR (SCL KNOB 4) moves every sequence along the scale. CHORD: a key plays a chord (TRIAD 7TH ADD9 SUS2 SUS4 in key, MAJ MIN 7 MAJ7 MIN7 POWER), VOICING LEAD leads each to the next, STRUM as a harp.

ARP MODES

OFF UP DN UPDN RND ORD REPEAT DNUP UP+8 CONV DIVG PINKY THUMB WALK CHORD TRNS (the keys transpose the sequence)

SONGS

8 projects × 4 sections (A–D), a song of up to 16 rows by bars (SAVE › PROJECT › ARRANGE, OCT+ adds a row, PLAY plays; END: STOP, x2–x8, LOOP), SLOOP style. Each row can hold a scene: mutes, DRUM-X group mutes, macros and MIDI punch-ins. SAVE held plays sections live on the next bar, stores them, records the song (SONG REC). Each section keeps its sounds, steps, motion, kit and its SLICER.

EFFECTS

PER TRACK

FX · SENDS

DSTCHODLYREV

DIST

DSTTYPETONE-

SOFT · HARD · FOLD · CRUSH · RECT.

AUTO PAN

DEPTHRATESYNCWAVE

The track's pan swung L–R around its PAN. SYNC BEAT: RATE 4 BARS … 1/32, in time with the bar; FREE: in Hz. SIN · TRI · SAW · SQR · S&H, never a click.

SLICER · ONE ON A BUS

SLCRPATRATEDEPTH

OFF · GATE · STUT, 16 patterns, 1/8 … 32T. SL BUS: T1–T6 and FX (the delay / reverb / chorus returns) ON / OFF: everything on = the whole mix chopped after the effects. SL PITCH: the repeats' 16-step pitch (±24 st, tape style, QNT SCL to the scale).

DELAY · CHORUS

DLY

TIMEFDBKTONEMIX

DLY 2

WIDEPITCHSPRYMOD

DLY 3

TYPEPING--

Synced or free (5 ms – 2.95 s; past 0.74 s darker); PITCH / SPRY: a grain delay.

CHORUS

RATEDEPTHSTER-

STER: 0 as always, down to mono, up to twice as wide.

REVERB · FIVE MODELS

TYPESIZEDAMPPRE
MODRATEFILTWIDE
TYPEWHAT IT ISSIZEDAMPMODRATEWIDE
ROOMClassic roomdecaydarkenschorus on the tailits speedstereo
SPRINGAmp spring tanklength · decaydarkenswobblewobble speedstereo
SHIMRUp an octave on every pass; PRE → AIR (±24 st: down darker and lower, up airier and higher)decaydarkenshow much shimmer——
RESO4 strings tuned to the scale; PRE → PITCH (0–14 steps up), DAMP → FOLW (OFF / T1–T6: the chord follows that track's notes)how long they ringFOLWpast half: the chord opens——
CLOUDGranular wash; SIZE max freezes it; PRE → AIR (±24 st: the cloud down / up, darker / airier)decay · freezedarkensgrains pitched + chorusgrain densitygrain spread

MASTER

CLIPPNCHDUCKREL

CLIP saturates without getting louder. PNCH drives the drums: denser body. DUCK: the kick pulls the rest down (REL its release). An always-on leveler (slow 2:1, −9…+6 dB) before the limiter keeps patches at a steady volume.

PUNCH-IN FX (FX HELD)

REPEAT 1/8 · 1/16 · 1/32, LPF, HPF; on the notes: OCT−/+, ½ TEMPO, DEC−/+, STUTTER, ATK+, ARP, RANDOM. Knobs: FILTER CRUSH THROW DEPTH. Recordable per section.

+
ENGINES · EDIT 1 / EDIT 2

NINE ENGINES, ALL SYNTHESIS

ENGINEEDIT 1EDIT 2WHAT TO KNOW
ANALOG
WAVEDETUNEMIXNOISE
CUTRESDRIVEINT
SAW SQR TRI SIN PWM SYNC RING SAW3; INT: osc 2 ±24 st. Its filter is per voice.
FM6
ALGFBMODRATIO
MEGVMODDETUNESLOT
Dexed's 6 operators, 32 algorithms drawn, .syx patches (SLOT), MOD / RATIO move the modulators. OPERATOR · OP ENV · OPERATOR 2: each operator on the device (ratio / fixed, fine, level, its envelope, mode, detune, velocity). SLOT B1–B32: a 32-voice .syx sent from the web editor.
PHASE
WAVEWAVE2DCWENV
DETUNELINESUBFB
Phase distortion (CZ); FB feeds the output back into the phase: hard edge to growl.
LOFI
CHIPWAVEDUTYCRUSH
-VIBBENDMASK
Chip: PLS TRI SAW NOIS WRAM. BYTE: ALGO VAR · MOTN GRIT BEND LOOP. FLOAT (floatbeat): ALGO VAR · MOTN FBK BEND LOOP; CHIP sets FULL / 4BIT / 1BIT.
VOICE
VOWELVOWEL2TALKSHIFT
BUZZBREATHQRAND
Formant voice (after klattsch): vowels, talk, breath. WORDS (0.8.5): LANG ES / EN / JA sings syllables, a note each (POS THEME ARTIC SHIFT · BUZZ BREATH Q LOOP); LYRIC TEXT (OCT+ on WORDS types it, KNOB 3 dice; the web editor sends it) or W1–16 words, S1–8 scat; "-" holds the vowel.
WHEEL
REGSUBBODYTOP
PERCCLICKDRIVEROTOR
Drawbar organ: registrations, percussion, rotary.
NOISE
MODECOLORFREQPEAK
TRKDENSEDRIFTCRUSH
Coloured and metallic noise, tracked or free.
DRUM-X
MORPHTUNETONEDECAY
NOISEFMENVFOLDDRIVE
8 sounds BD SD CP CH OH TM RS CB, sides A / B: MORPH morphs the kit. The kit first: KIT 3 BP FEEDBK, X-MOD RATE DEPTH SHAPE RAND. Then a sound (KNOB 1 the sound): SIDE PITCH PMOD · DECAY NOISE COLOR · MODE PM.TYPE DRIVE · LAYER (no note) FEEDBK SEND (CHO / DLY / REV). Last LEVELS and STEREO IMAGE (a knob through the kit's stereo placings).
ANIMAL
MODEPRESSCHAOSSIZE
SWEEPRATEGROUPTEMP
Animal calls (0.8.3), MODE the source: CMOS the 40106 / 4093 bird circuit (TOUCH COUPLE CAP · HYST RATE GROUP FM) · PULSE crickets, cicadas, frogs (CLICK Q · DETUNE) · WHSTL birds, a Hopf whistle · WING mosquito, bee, fly (BUZZ DRIFT · DOPPLR) · GLOTT wolf, bark, roar, purr (MOUTH ROUGH · AIR). GROUP: syllables + gaps; TEMP °C speeds a cricket up (Dolbear). A note is a call.

FILTER · EVERY ENGINE

TYPECUTRESDRV

LP · HP · BP · COMB. COMB rings tuned to the note: CUT moves it ±32 st, RES how much it rings. ANALOG and LOFI: per voice; the others: on the track, following LFO / ENV DEST FLT (DRV = the track's DIST).

VOICE · PLAYING

VCEGLDGLMODPRIO

POLY · MONO · LEG · UNI; glide and its mode; LAST / LOW / HIGH priority. 8 voices shared by the six tracks (MONO and LEGATO keep their note).

DICE

EDIT + SELECT: a random factory preset of the engine, every parameter moved up to a quarter of its range. DRUM-X: both sides of every sound around the factory kit. Heard at once: OCT+ OK keeps it, OCT- CANCEL brings the sound back. SEQ / LFO / FX + SELECT: the sequence, the LFO, the effects, the same way. HOME + SELECT: GEN, the song generator: GENRE (43 or RANDOM) · SEED · ENERGY · FORM; DRUMS · BASS · CHORDS · ARP · LEAD amounts; COMPLEX · SWING · HUMAN. OCT+ makes the piece (again: a new seed), HOME done. GLO + G4 undoes.

MODULATION

ENV · LFO

ENV

ATKDECSUSREL

ENV DEST

FLTPITSHPLOOP

LOOP: held, the envelope cycles from the sustain: an ADSR-shaped LFO.

LFO

RATEWAVEPHSFADE

SIN TRI SAW SQR S&H

LFO DEST

PITFLTSHPAMP

MOD MATRIX · 4 SLOTS A TRACK

SLOTSRCDSTAMT

SOURCES

LFOENVVELKEYRANDMODWATEXPRM1M2M3M4STEP

DESTINATIONS

PITCHCUTSHPAMPPANDISTCHODLYREVRATEVIBE1…E8CLIPPNCHD.TIMD.FBD.TOND.MIXR.SIZR.DMPC.RATC.DEP

E1…E8: the engine's own EDIT knobs. CLIP / PNCH: the master. D. R. C.: the DELAY, REVERB and CHORUS buses (a STEP source on D.TIM sequences the delay time).

MSEQ · MACROS

MSEQ · A CV SEQUENCER PER TRACK

STEPLVLLENSLEW

16 levels, DIV on MSEQ 2, in time with the transport. Use it from MOD, SRC STEP.

MACROS M1–M4

Hold LFO: the knobs are M1–M4, latched until LFO again. Each session starts with 2 random routes a track; F3 rolls new ones, G3 clears. By hand: MOD, SRC M1…M4. Saved with the project.

SEQUENCER

64 steps a track, up to 4 notes a step, piano roll and drum grid. LENTE: SELECT zooms PATTERN (the bars; PRESETS the bar) · BAR (the roll / grid) · STEP (one step large, its chips); SEQ taps round the level's sets and comes back to the track's last. Hold a step + turn a knob: a parameter lock. Step recording: hold a chord + KNOB 1 its length; + ARP: arpeggiated (K1 rate, K2 order, K3 oct). COMP / COMP 2: two components a step (CHANCE, RATCH, ARP NOTES / SEQ / SCALE, TRIG, RAND, OCT, TONAL, BEND, ECHO, PULSE, JUMP, REV, FILL, KILL, WALK, CLIMB, TOUCH: a kit's SHORT / GHOST / FLAM); a TRIG or FILL wins; WALK / CLIMB: a degree / an octave further every N loops (K4), UP DOWN UP-DN RND over a range (K3), stackable; ARP: ORDER × range, RATE in note values (x1 1/32 1/32T 1/64 1/64T 1/128); RATCH / ECHO: DIV; EVERY (KNOB 4): the loops the step's components play on (ALWAYS 1:2 2:2 1:3 .. 4:4 1:8 FIRST !FIRST SKIP). TRACK: PITCH, CHANCE thins the whole track, HUMAN one amount (velocity, timing, gate, decay / release), REC Q. STRETCH / REPEAT act as the knob turns; ROTATE reads the sequence from another step; NOTE's MICRO moves a step off the grid. REC + knobs while playing: automation (64 records a section, MOTION page plays / clears them, AUTO LIST edits them).

PATTERN · TRACK

LENDIVSWGGATE
PITCHNHUMRECQ

SCALE · ARP

ROOT and SCALE are every melodic track's: CHR MAJ MIN DOR MIX PEN MPEN HARM PHRY LYD LOC MEL BLUES WHOLE DIMHW DIMWH. QNT snaps keys or the sequence, ALL TR (SCL KNOB 4) moves every sequence along the scale. CHORD: a key plays a chord (TRIAD 7TH ADD9 SUS2 SUS4 in key, MAJ MIN 7 MAJ7 MIN7 POWER), VOICING LEAD leads each to the next, STRUM as a harp.

ARP MODES

OFF UP DN UPDN RND ORD REPEAT DNUP UP+8 CONV DIVG PINKY THUMB WALK CHORD TRNS (the keys transpose the sequence)

SONGS

8 projects × 4 sections (A–D), a song of up to 16 rows by bars (SAVE › PROJECT › ARRANGE, OCT+ adds a row, PLAY plays; END: STOP, x2–x8, LOOP), SLOOP style. Each row can hold a scene: mutes, DRUM-X group mutes, macros and MIDI punch-ins. SAVE held plays sections live on the next bar, stores them, records the song (SONG REC). Each section keeps its sounds, steps, motion, kit and its SLICER.

EFFECTS

PER TRACK

FX · SENDS

DSTCHODLYREV

DIST

DSTTYPETONE-

SOFT · HARD · FOLD · CRUSH · RECT.

AUTO PAN

DEPTHRATESYNCWAVE

The track's pan swung L–R around its PAN. SYNC BEAT: RATE 4 BARS … 1/32, in time with the bar; FREE: in Hz. SIN · TRI · SAW · SQR · S&H, never a click.

SLICER · ONE ON A BUS

SLCRPATRATEDEPTH

OFF · GATE · STUT, 16 patterns, 1/8 … 32T. SL BUS: T1–T6 and FX (the delay / reverb / chorus returns) ON / OFF: everything on = the whole mix chopped after the effects. SL PITCH: the repeats' 16-step pitch (±24 st, tape style, QNT SCL to the scale).

DELAY · CHORUS

DLY

TIMEFDBKTONEMIX

DLY 2

WIDEPITCHSPRYMOD

DLY 3

TYPEPING--

Synced or free (5 ms – 2.95 s; past 0.74 s darker); PITCH / SPRY: a grain delay.

CHORUS

RATEDEPTHSTER-

STER: 0 as always, down to mono, up to twice as wide.

REVERB · FIVE MODELS

TYPESIZEDAMPPRE
MODRATEFILTWIDE
TYPEWHAT IT ISSIZEDAMPMODRATEWIDE
ROOMClassic roomdecaydarkenschorus on the tailits speedstereo
SPRINGAmp spring tanklength · decaydarkenswobblewobble speedstereo
SHIMRUp an octave on every pass; PRE → AIR (±24 st: down darker and lower, up airier and higher)decaydarkenshow much shimmer——
RESO4 strings tuned to the scale; PRE → PITCH (0–14 steps up), DAMP → FOLW (OFF / T1–T6: the chord follows that track's notes)how long they ringFOLWpast half: the chord opens——
CLOUDGranular wash; SIZE max freezes it; PRE → AIR (±24 st: the cloud down / up, darker / airier)decay · freezedarkensgrains pitched + chorusgrain densitygrain spread

MASTER

CLIPPNCHDUCKREL

CLIP saturates without getting louder. PNCH drives the drums: denser body. DUCK: the kick pulls the rest down (REL its release). An always-on leveler (slow 2:1, −9…+6 dB) before the limiter keeps patches at a steady volume.

PUNCH-IN FX (FX HELD)

REPEAT 1/8 · 1/16 · 1/32, LPF, HPF; on the notes: OCT−/+, ½ TEMPO, DEC−/+, STUTTER, ATK+, ARP, RANDOM. Knobs: FILTER CRUSH THROW DEPTH. Recordable per section.

\ No newline at end of file diff --git a/firmware/app.ld b/firmware/app.ld index 9791cb47..d6676520 100644 --- a/firmware/app.ld +++ b/firmware/app.ld @@ -6,8 +6,9 @@ * busy: the flash driver), .c1_text (the second core's loop), .hot_text (core 0's hottest audio code). A call reaches * +-4 MiB (pi32v2 imm23 x 2, no long calls in this compiler): RAM code there reaches the whole XIP image (build.py * checks the margin); at 0x01C00000 it reached none of it. - * LOWBUF 0x01C00000..0x01C07000 (0.6.78; 0.6.82: 4 KiB more, the steps grew): main-loop buffers (undo, the project - * scratch, the song section's stage; 0.8.4: the fonts' decode tables, in the pool since 0.8.5), zeroed at boot; 0x01C07000..0x01C08000 stays for RAM-run debug. + * LOWBUF 0x01C00000..0x01C07000 (0.6.78; 0.6.82: 4 KiB more, the steps grew): main-loop buffers (undo, the song + * section's stage; the project scratch until 0.8.4 and the fonts' decode tables in 0.8.4, both in the pool since + * 0.8.5), zeroed at boot; 0x01C07000..0x01C08000 stays for RAM-run debug. * RAM : .data/.bss (96 KiB) * POOL : big zero-initialised buffers (FX lines, canvases), section .pool * STACKS with 256-byte guard bands; NOINIT survives resets and UBOOT entry. diff --git a/firmware/src/core.h b/firmware/src/core.h index 5798b100..319b03fa 100644 --- a/firmware/src/core.h +++ b/firmware/src/core.h @@ -383,7 +383,26 @@ typedef struct { /* acid-style step: up to 4 notes (POLY), time, uint8_t cwhen; /* (0.6.82) WHEN each plays: bits 0-1 comp's, 2-3 comp2's (CW_*) */ uint8_t ctime; /* (0.6.82) bits 0-2 DIV: RATCH's and ECHO's parts a step/2 .. /8 apart (0: the step * shared out, as before); bits 3-6 LEN: a part's gate n/16 (0: the track's GATE) */ + uint8_t lm[3]; /* (0.8.5) each drum lane's own way of playing on this step (a DRUM track: its hit and + * its notes on the lane): 3 bits a lane, lane l at bits 3l..3l+2 of the 24, LM_* */ } step_t; +/* (0.8.5) a lane's mode (eng_drum.c, the DRUM-X octaves): its hit ratcheted x2 / x4 / x8 over the step, or struck SHORT, + * GHOST, FLAM; that lane only. 0: as ever (every step before 0.8.5) */ +enum { LM_NONE, LM_X2, LM_X4, LM_X8, LM_SHORT, LM_GHOST, LM_FLAM, LM_N }; +static uint32_t step_lmode(const step_t *s, uint32_t l) +{ + uint32_t v = (uint32_t)s->lm[0] | (uint32_t)s->lm[1] << 8 | (uint32_t)s->lm[2] << 16, m = (v >> (3u * (l & 7u))) & 7u; + return m < LM_N ? m : LM_NONE; +} +static void step_set_lmode(step_t *s, uint32_t l, uint32_t m) +{ + uint32_t v = (uint32_t)s->lm[0] | (uint32_t)s->lm[1] << 8 | (uint32_t)s->lm[2] << 16, sh = 3u * (l & 7u); + v = (v & ~(7u << sh)) | ((m < LM_N ? m : 0u) << sh); + s->lm[0] = (uint8_t)v; s->lm[1] = (uint8_t)(v >> 8); s->lm[2] = (uint8_t)(v >> 16); +} +static int step_lm_any(const step_t *s) { return s->lm[0] | s->lm[1] | s->lm[2]; } +static uint32_t lm_hits(uint32_t m) { return m == LM_X2 ? 2u : m == LM_X4 ? 4u : m == LM_X8 ? 8u : 1u; } /* a step */ +static uint32_t lm_touch(uint32_t m) { return m >= LM_SHORT && m <= LM_FLAM ? m - LM_SHORT + 1u : 0u; } /* TOUCH 1..3 */ /* (0.6.92) EVERY: on which loops of the pattern the step's components play (both of them; seq.c every_on), in cwhen's * bits 0-3: ALWAYS, 1:2 (the odd loops), 2:2, SKIP (kept, never), 1:3 2:3 3:3, 1:4 2:4 3:4 4:4, 1:8, FIRST, NOT FIRST. * (0.6.82 WHEN: bits 0-1 the first component's ALWAYS / 1:2 / 2:2 / SKIP, the same codes; bits 2-3 the second's, now @@ -417,7 +436,12 @@ static const uint8_t CT_DIVS[CT_NDIV] = {0, 2, 3, 4, 6, 8}; * x2..x4; 0.6.82: .. x8); PULSE: its notes again on the empty steps after it (carg 0..3: every 1..4); JUMP: then step carg + 1; * REV: back from here to step 1 (ping-pong); FILL: only while FX is held; KILL: what the track sounds cut first */ enum { CP_NONE, CP_ARPN, CP_ARPQ, CP_ARPS, CP_TRIG, CP_RAND, CP_OCT, CP_TONAL, CP_BEND, CP_ECHO, CP_PULSE, CP_JUMP, - CP_REV, CP_FILL, CP_KILL, CP_WALK, CP_CLIMB, CP_N }; + CP_REV, CP_FILL, CP_KILL, CP_WALK, CP_CLIMB, CP_TOUCH, CP_N }; +/* (0.8.5) TOUCH: on a DRUM track how the step's hits are struck (carg 0..2: SHORT, half the decay; GHOST, short, darker + * and softer; FLAM, a soft grace hit ~20 ms before the hit; eng_drum.c DXO_*): what a hit played in the octaves below + * the kit's records (OCT -1 .. -3, MIDI below 35: seq.c dxo_on). Other engines: nothing. ECHO's carg bit 7, EVEN + * (0.8.5): its repeats all at the step's level, a ratchet past RATCH's x4 (OCT +3 on a kit records x8 so) */ +#define CP_ECHO_EVEN 0x80u /* (0.6.98) WALK and CLIMB (after the OP-Z's and OP-XY's evolving components): the step's notes move one degree of the * scale (WALK) or one octave (CLIMB) every RATE loops of the pattern, over a RANGE of moves, then round again: UP, * DOWN, UP-DN (there and back) or RND (a random place a move, the same every time round). carg: bits 0-3 RATE @@ -432,9 +456,9 @@ enum { CP_NONE, CP_ARPN, CP_ARPQ, CP_ARPS, CP_TRIG, CP_RAND, CP_OCT, CP_TONAL, C static const uint8_t CP_WRATES[CP_NWRATE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16}; static const uint8_t CP_WDEGS[4] = {3, 5, 7, 12}; /* the range of carg each component's KNOB 3 turns (ARP: KNOB 3 / 4 their own; WALK CLIMB: theirs) */ -static const uint8_t CP_AMAX[CP_N] = {0, 0, 0, 0, 11, 7, 5, 14, 24, 6, 3, 63, 0, 0, 0, 0, 0}; -static const uint8_t CP_ADEF[CP_N] = {0, 0, 0, 0, 0, 2, 0, 9, 7, 1, 0, 0, 0, 0, 0, 0x40, 0x00}; -static const uint8_t CP_AMIN[CP_N] = {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const uint8_t CP_AMAX[CP_N] = {0, 0, 0, 0, 11, 7, 5, 14, 24, 6, 3, 63, 0, 0, 0, 0, 0, 2}; +static const uint8_t CP_ADEF[CP_N] = {0, 0, 0, 0, 0, 2, 0, 9, 7, 1, 0, 0, 0, 0, 0, 0x40, 0x00, 0}; +static const uint8_t CP_AMIN[CP_N] = {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static int cp_iswalk(uint32_t c) { return c == CP_WALK || c == CP_CLIMB; } #define CP_ORD(a) ((uint32_t)(a) & 3u) /* UP DOWN UP-DN RND */ /* (0.6.62) JUMP: its step (bits 0-5) and TIMES (bits 6-7); REV: TIMES (bits 0-1). TIMES: ALWAYS, x1 (once a pass of @@ -586,6 +610,9 @@ typedef struct track { uint16_t dbt; uint8_t ss_n, ss_i; /* (0.6.84) STRUM on the sequencer's chords: the step's notes still to come in, in */ uint8_t ss_nn[4 + NLANE], ss_vv[4 + NLANE]; /* order low to high (seq.c seq_step, seq_tick), ss_due samples to the next */ + uint8_t dtch, ss_tch; /* (0.8.5) a step's TOUCH (1..3, 0 none) on the sequencer's next drum hits; .. on the + * queued ones (HUMAN TIME: seq_tick) */ + uint8_t lr_on; /* (0.8.5) the playing step has a lane ratcheting (seq.c seq_lane_rat) */ uint32_t ss_due, ss_gap; /* (.. and the gap between them; 0.6.88: 32 bits, a long TIMING) */ uint16_t ext; /* (0.6.88) TIMING: samples the playing step began before its place (it is early) */ int8_t mic; /* .. the playing step's own TIMING (ST_MICRO), late: seq_step queues its notes */ diff --git a/firmware/src/editor.c b/firmware/src/editor.c index 0a6adb19..6b739340 100644 --- a/firmware/src/editor.c +++ b/firmware/src/editor.c @@ -261,9 +261,14 @@ static void ed_step_put(step_t *st, const uint8_t *a, uint32_t na) } if (na >= 12u) step_set_chance(st, a[11] <= 100u ? a[11] : 100u); if (na >= 13u) step_set_ratchet(st, a[12]); + if (na >= 21u) /* (0.8.5, INFO 4F 01 07) each lane's mode, 0..6 (core.h LM_*) */ + for (i = 0; i < NLANE; i++) + step_set_lmode(st, i, a[13 + i] < LM_N ? a[13 + i] : LM_NONE); ui.force = 1; } -static void ed_step_reply(const step_t *st) /* the same 13 bytes */ +static void ed_step_reply(const step_t *st, int lanes) /* the same 13 bytes; (0.8.5) then the 8 lanes' modes, when the + * request asked for them (a write with them, a read with its + * flag 1): every reply of before as it was */ { uint32_t i; ed_b(st->n); @@ -277,6 +282,8 @@ static void ed_step_reply(const step_t *st) /* the same 13 bytes */ ed_b((uint32_t)(st->hit >> 7) | (uint32_t)(st->acc >> 7) << 1); ed_b(step_chance(st)); ed_b(step_ratchet(st)); + for (i = 0; lanes && i < NLANE; i++) + ed_b(step_lmode(st, i)); } /* a flash write from the editor while the transport runs: stop it first (the erase silences the audio and @@ -314,6 +321,13 @@ static void ed_motion_reply(uint32_t k, uint32_t rc, uint32_t kinds) if (MOTION_TRK(&motion.event[i]) == k) ed_b((motion.event[i].param & MOTION_LOCK) != 0u); } +static int ed_lm_ok(const uint8_t *a) /* (0.8.5) eight lane modes, each 0..6 */ +{ + uint32_t i; + for (i = 0; i < NLANE; i++) + if (a[i] >= LM_N) return 0; + return 1; +} static int ed_args_ok(uint32_t cmd, const uint8_t *a, uint32_t n) { switch (cmd) { @@ -325,21 +339,25 @@ static int ed_args_ok(uint32_t cmd, const uint8_t *a, uint32_t n) return n == 2u || (cmd == ED_TRACK_PARAM && n == 4u); case ED_SET: return n == 4u; - case ED_STEP_GET: case ED_NAMES: + case ED_STEP_GET: + return n == 1u || (n == 2u && a[1] == 1u); /* (0.8.5: 1, the lanes' modes too) */ + case ED_NAMES: case ED_UP_GET: case ED_UP_LOAD: case ED_UP_ERASE: case ED_WATCH: case ED_TRACK_DUMP: case ED_MENU_DESC: return n == 1u; case ED_MENU_SET: return n == 3u; case ED_STEP_SET: return n == 9u || n == 12u || (n == 13u && a[12] <= 100u) || /* notes only, or the complete grid extension, */ - (n == 14u && a[12] <= 100u && a[13] >= 1u && a[13] <= 4u); /* its chance, its ratchet */ + (n == 14u && a[12] <= 100u && a[13] >= 1u && a[13] <= 4u) || /* its chance, its ratchet, */ + (n == 22u && a[12] <= 100u && a[13] >= 1u && a[13] <= 4u && ed_lm_ok(a + 14)); /* (0.8.5) the lanes' modes */ case ED_TRACK: return n <= 1u; case ED_TRACK_MIX: return n == 1u || n == 4u; case ED_TRACK_STEP: - return n == 2u || n == 10u || n == 13u || (n == 14u && a[13] <= 100u) || - (n == 15u && a[13] <= 100u && a[14] >= 1u && a[14] <= 4u); + return n == 2u || (n == 3u && a[2] == 1u) || n == 10u || n == 13u || (n == 14u && a[13] <= 100u) || + (n == 15u && a[13] <= 100u && a[14] >= 1u && a[14] <= 4u) || + (n == 23u && a[13] <= 100u && a[14] >= 1u && a[14] <= 4u && ed_lm_ok(a + 15)); case ED_MOTION: return (n == 1u || (n == 2u && (a[1] == 2u || a[1] == 7u)) || (n == 3u && a[1] == 1u && a[2] <= 1u) || (n == 6u && (a[1] == 3u || a[1] == 5u)) || (n == 4u && a[1] == 4u) || (n == 3u && a[1] == 6u)) && @@ -411,6 +429,7 @@ static void ed_handle(const uint8_t *f, uint32_t n) /* f: the bytes between F0 ed_b(0x4C); ed_b(1); ed_b(1); /* 1.1 parameter locks: MOTION ops 5..7, the kinds after the records */ ed_b(0x56); ed_b(1); ed_b(FM6_NBANK); /* (JIANT 0.6.11, Felucca 1.4.1) FM6's voice bank: cmds 74..77, SLOT 9..40 */ ed_b(0x4A); ed_b(1); ed_b(1); /* (JIANT 0.6.62) 'J': this is JIANT (the web installer writes over it, web/index_pkg.html) */ + ed_b(0x4F); ed_b(1); ed_b(LM_N); /* (0.8.5) 'O': the DRUM-X octaves, a step's lane modes 0..6 after its ratchet */ ed_b(0x59); ed_b(1); ed_b(LYR_LEN - 1u); /* (JIANT 0.8.5) 'Y': LYRIC (cmd 39), a track's lyric, at most 63 bytes */ break; case ED_GET: @@ -472,7 +491,7 @@ static void ed_handle(const uint8_t *f, uint32_t n) /* f: the bytes between F0 } ed_w.st[a[0]] = ed_step_sig(&seq_steps(TSEL)[a[0]]); ed_b(a[0]); - ed_step_reply(&seq_steps(TSEL)[a[0]]); + ed_step_reply(&seq_steps(TSEL)[a[0]], na == 22u || (cmd == ED_STEP_GET && na == 2u)); break; } case ED_PRESET: { /* engine, preset */ @@ -696,7 +715,7 @@ static void ed_handle(const uint8_t *f, uint32_t n) /* f: the bytes between F0 ed_w.st[a[1]] = ed_step_sig(&seq_steps(&trk[a[0]])[a[1]]); ed_b(a[0]); ed_b(a[1]); - ed_step_reply(&seq_steps(&trk[a[0]])[a[1]]); + ed_step_reply(&seq_steps(&trk[a[0]])[a[1]], na == 23u || na == 3u); break; } case ED_TRACK_PARAM: { /* track, id [, v14] -> track, id, v14 */ diff --git a/firmware/src/eng_drum.c b/firmware/src/eng_drum.c index a4b28e64..59ff80dc 100644 --- a/firmware/src/eng_drum.c +++ b/firmware/src/eng_drum.c @@ -7,7 +7,7 @@ * Before Felucca 1.0 this engine was PHYS's MODEL DRUM; those sounds load as it (drum_from_phys in core.h). * * Keys and notes: the keys play the General MIDI drum map with the kick on the first C (C KICK, C# RIM, - * D SNARE, D# CLAP, F# HAT CL, A# HAT OP, F G A B C D TOMS, C# CYM, G# BELL; OCT -/+ move it), and a note + * D SNARE, D# CLAP, F# HAT CL, A# HAT OP, F G A B C D TOMS, C# CYM, G# BELL; at every OCT: above it ratcheted, below it damped, 0.8.5), and a note * plays its GM drum on its lane (35..81: kicks, snares, toms, hats, cymbals and bells on BELL, congas on TOM, claves * on RIM, each at its pitch from the lane's; other notes as their octave of 36..47), so GM patterns and MIDI parts * play as drums. @@ -39,6 +39,8 @@ typedef struct { uint8_t age; /* blocks since the hit (255: and more): PUNCH's shape */ int8_t rm, rt; /* (0.5.1) X-MOD RAND: this hit's MORPH offset, its tune (1/16 semitones) */ int16_t bc, bd, bs; /* (0.6.82) a step's BEND on the hit: now, where to, a block's step (1/16 semitones) */ + uint8_t dm, fl, fv; /* (0.8.5) its TOUCH 0..3 (DXO_*: SHORT GHOST FLAM, 0 as the kit has it); FLAM: blocks + * to the hit itself (0 none), its velocity */ } drum_lane_t; /* (JIANT 0.5.1) X-MOD (EDIT > X-MOD on a DRUM track): the kit's own modulator, saved with the kit (project.c, in its * reserved bytes): RATE (OFF, 4BAR 2BAR 1BAR 1/2 1/4 1/8 1/16 1/32: a tempo-synced LFO), DPTH (how far it moves @@ -93,6 +95,49 @@ static const int8_t DRUM_GM[47][2] = { }; static uint32_t drum_gm_ix(uint32_t note) { return (note >= 35u && note <= 81u ? note : 36u + (note + 120u - 36u) % 12u) - 35u; } +/* (JIANT 0.8.5) the octaves of the kit. OCT 0, where the keys play the GM map (key 7 the kick, 36), is the kit as it + * always was. The other octaves play the same sounds on the same keys (drum_keys: OCT no longer moves the notes). + * Above, ratcheted in time while held (seq.c dxo_tick): x2 at OCT +1, x4 at +2, x8 at +3; recorded as the hit and the + * step's RATCH x2 / x4, at +3 its ECHO x8 EVEN (core.h CP_ECHO_EVEN: the eight at one level). Below, each hit with a + * TOUCH (drum_lane_t.dm; the step's TOUCH component, core.h CP_TOUCH, when recorded): OCT -1 SHORT (half the decay), + * -2 GHOST (short, darker, at ~45 % of its level: a ghost note), -3 FLAM (a soft grace hit, then the hit itself + * DXO_FLAM later, ~20 ms whatever the tempo). MIDI keeps the GM map on 35..81, as ever; the notes around it, which + * played their octave of 36..47 plain, are those octaves' bands: 23..34 -1, 11..22 -2, 0..10 -3, 82..93 +1, 94..105 + * +2, 106..127 +3, each by its pitch class (84 the kick x2, 24 the kick SHORT). dx_in_tch: a live hit's TOUCH, + * track_t.dtch: a step's */ +static const uint8_t DXO_RAT[4] = {1, 2, 4, 8}; /* OCT 0 +1 +2 +3: hits a step */ +static const int8_t DXO_DEC[4] = {0, -14, -14, 0}; /* TOUCH 0..3: on DECAY (14: half the decay time, dx_tau) */ +static const int8_t DXO_TON[4] = {0, 0, -24, 0}; /* .. on TONE (COLOR: the lane's filter, its drive) */ +static const uint8_t DXO_VEL[4] = {128, 128, 58, 58}; /* .. on the velocity, /128 (FLAM: its grace hit's) */ +#define DXO_FLAM ((FS * 20u / 1000u + CTL / 2u) / CTL) /* FLAM: blocks from the grace hit to the hit (~20 ms) */ +static uint8_t dx_in_tch, dx_in_rat; /* the live note's TOUCH / RATCH (seq.c dxo_on; 0 none) */ +static int32_t drum_oct_of(uint32_t note) /* a MIDI note's octave of the kit */ +{ + if (note >= 35u && note <= 81u) + return 0; + if (note < 35u) + return -(int32_t)((35u - note + 11u) / 12u); + return note >= 106u ? 3 : note >= 94u ? 2 : 1; +} +static uint32_t drum_oct_base(uint32_t note) { return 36u + (note + 120u - 36u) % 12u; } /* .. its sound (36..47) */ +/* the MIDI note of key note at octave o (MIDI OUT): its band's note of the same pitch class (DRUM_GM's 48..55 are + * their pitch class there) */ +static uint32_t drum_oct_note(uint32_t note, int32_t o) +{ + int32_t lo, hi, n; + if (!o) + return note; + lo = o > 0 ? 82 + 12 * (o > 3 ? 2 : o - 1) : o == -1 ? 23 : o == -2 ? 11 : 0; + hi = o > 2 ? 127 : o == -3 ? 10 : lo + 11; + n = lo + (((int32_t)drum_oct_base(note) - lo) % 12 + 12) % 12; + return (uint32_t)(n > hi ? n - 12 >= 0 ? n - 12 : 11 : n); +} +static const char *drum_oct_name(int32_t o) /* what OCT does on a DRUM track (ui_input.c) */ +{ + static const char *const N[7] = {"FLAM", "GHOST", "SHORT", "DRUM-X KIT", "RATCHET x2", "RATCHET x4", "RATCHET x8"}; + return N[clamp(o, -3, 3) + 3]; +} + /* ----------------------------------------------------- the grid's lanes --- */ /* A step's lane hits (step_t.hit / acc, the DRUM grid: SEQ > STEP on a DRUM track) play these GM notes, on any * engine: DRUM strikes its lanes, a synth plays the pitches. Each is the designed pitch of @@ -204,6 +249,14 @@ static void drum_note_on(track_t *t, voice_t *v) L->bd = t->dbend; L->bs = (int16_t)(t->dbend ? ((t->dbend < 0 ? -t->dbend : t->dbend) + t->dbt) / (t->dbt ? t->dbt : 1u) : 0); L->owner = (uint8_t)(i + 1u); /* (its last voice, if another, ends: drum_amp) */ + L->dm = (uint8_t)((dx_in_tch ? dx_in_tch : t->dtch) & 3u); /* (0.8.5) TOUCH: a key below the kit's octave, a step */ + L->fl = 0; + if (L->dm) { + L->fv = v->vel; + v->vel = (uint8_t)((v->vel * DXO_VEL[L->dm] + 64u) >> 7 ? (v->vel * DXO_VEL[L->dm] + 64u) >> 7 : 1u); + if (L->dm == 3u) + L->fl = (uint8_t)(DXO_FLAM + 1u); /* (FLAM: the grace hit now, the hit DXO_FLAM blocks on, drum_render) */ + } v->s[0] = (int32_t)lane; v->env_out = v->vel * 258; /* the hit starts at its level (no ramp from 0) */ v->env = 1 << 24; /* the ADSR held at full from here, not from drum_amp: @@ -235,7 +288,7 @@ static int32_t drum_amp(track_t *t, voice_t *v, int32_t adsr) return 0; if (v->stage == 4u) /* (0.6.74) given up: env_tick's fade, not held at full */ return adsr; - if (!L || (!L->x.live && !L->x.trig)) { + if (!L || (!L->x.live && !L->x.trig && !L->fl)) { /* (0.8.5: a FLAM's hit to come keeps it) */ v->active = v->gate = 0; v->stage = 0; v->env = 0; @@ -390,6 +443,7 @@ static void drum_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const uint32_t g0 = L->mg; if (!g0) { L->x.live = L->x.trig = 0; /* (drum_amp ends the voice) */ + L->fl = 0; L->x.hl = 0; /* (0.6.19: the next hit starts its upsampling from 0) */ return; } @@ -398,6 +452,15 @@ static void drum_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const ml.amp1 = m->amp1 * (int32_t)(g0 - 1u) / (int32_t)DXG_FADE; m = &ml; } + if (L->fl == 2u) /* (0.8.5) FLAM: its velocity back a block before the hit + * (voice.c takes the level before the render) */ + v->vel = L->fv; + if (L->fl && !--L->fl) { /* .. the hit itself */ + dx_trigger(&L->x); + L->age = 0; + if (((uint32_t)v->s[0] & (DV_NLANE - 1u)) == DV_HATC) + dx_choke(&drum_kit_of(t)[DV_HATO].x); + } if (lv < 127) { /* the lane's LEVEL (square law) on the block's amplitude * ramp, not per sample; 100 %: the ramp as it was */ int32_t gl = lv * lv * 2 + (lv * lv >> 6); /* Q15, 127: 32508 (not used), 64: 8256 */ @@ -419,7 +482,7 @@ static void drum_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const } dx_run(&dx_kit[(uint32_t)v->s[0] & (DV_NLANE - 1u)], &L->x, p[P_E0] + dx_mot_v + L->rm + lfo_shp, L->st * 16 + L->rt + L->bc + (p[P_E1] - 64) * 3 + t->pfx_pit + lfo_pit, - p[P_E3] - 64, p[P_E2] - 64, p[P_E4] - 64, p[P_E6], p[P_E5], y, n); + p[P_E3] - 64 + DXO_DEC[L->dm & 3u], p[P_E2] - 64 + DXO_TON[L->dm & 3u], p[P_E4] - 64, p[P_E6], p[P_E5], y, n); { /* PUNCH: the boost before the knee (driven into it, as * Drum Buss), the tail's cut on the amplitude ramp */ int32_t pu = pnch_eff; @@ -493,11 +556,11 @@ static __attribute__((noinline)) void drum_bus(const track_t *t, int32_t *out, u } } -/* the GM drum map, the first C (key 7) is the kick (C2, 36) */ +/* the GM drum map, the first C (key 7) is the kick (C2, 36), at every OCT (0.8.5: the octaves, above) */ static int32_t drum_keys(const track_t *t, uint32_t k) { (void)t; - return clamp(29 + 12 * song.octave + (int32_t)k, 0, 127); + return clamp(29 + (int32_t)k, 0, 127); /* (0.8.5: every octave; OCT ratchets / damps, seq.c dxo_on) */ } /* {MRPH, TUNE, TONE, DECY, NOIS, FM, FOLD, DRV}; the kit suggests the BEAT pattern (GM notes) */ diff --git a/firmware/src/midi_control.c b/firmware/src/midi_control.c index 48448e6a..b693faef 100644 --- a/firmware/src/midi_control.c +++ b/firmware/src/midi_control.c @@ -90,14 +90,22 @@ static void midi_release(uint32_t ch, uint32_t note) if (!--midi_ch[ch].owned[id - 1u]) midi_ch[ch].targets &= (uint8_t)~(1u << (id - 1u)); } - if (id && !midi_local_held(&trk[id - 1u], note)) + if (id && drum_track(&trk[id - 1u]) && drum_oct_of(note)) { /* (0.8.5) a band of the kit's octaves */ + dxo_off(&trk[id - 1u], DXO_MIDI + (ch << 7) + note); + if (!midi_local_held(&trk[id - 1u], drum_oct_base(note))) + input_off(&trk[id - 1u], drum_oct_base(note)); + } else if (id && !midi_local_held(&trk[id - 1u], note)) input_off(&trk[id - 1u], note); /* input_off also checks other MIDI owners */ } /* a MIDI note-on (ch, note) of track t. A note another key or MIDI note holds already sounds: not started again */ static void midi_play(track_t *t, uint32_t ch, uint32_t note, uint32_t vel) { - (void)ch; + if (drum_track(t) && drum_oct_of(note)) { /* (0.8.5) the kit in another octave: its sound, ratcheted / + * damped (seq.c dxo_on) */ + dxo_on(t, drum_oct_base(note), drum_oct_of(note), vel, DXO_MIDI + (ch << 7) + note); + return; + } if (!midi_note_held(t, note) && !midi_local_held(t, note)) input_on(t, note, vel); } @@ -159,6 +167,8 @@ static void midi_silence_track(uint32_t track) track_t *t = &trk[track]; uint32_t i; trk_all_off(t); + if (track < NPART) + dxo_n[track] = 0; /* (0.8.5) a held ratchet stops */ t->nheld = t->arp_phys = t->rh_n = 0; arp_forget(t); t->seq_n = t->seq_hold = t->slide_glide = 0; diff --git a/firmware/src/project.c b/firmware/src/project.c index 08836aa2..a6a03ba9 100644 --- a/firmware/src/project.c +++ b/firmware/src/project.c @@ -276,6 +276,7 @@ static void proj_trk_from(proj_trk_t *d, const int16_t *p, uint32_t np, uint8_t s->flags = step[k].flags & 3u; /* accent, slide: x1 (no RATCH then) */ s->vel = step[k].vel; s->hit = s->acc = 0; + s->lm[0] = s->lm[1] = s->lm[2] = 0; } } @@ -734,7 +735,7 @@ static uint8_t proj_full; /* the last proj_pack fa static int proj_step_empty(const step_t *s) { return !s->n && s->time == ST_REST && !s->flags && !s->vel && !s->hit && !s->acc && !s->probability && !s->comp && - !s->comp2 && !s->cwhen && !s->ctime; + !s->comp2 && !s->cwhen && !s->ctime && !step_lm_any(s); } static uint32_t proj_step_x(const step_t *s, uint32_t *nn) /* its x byte (0: none), *nn the notes stored */ { @@ -744,12 +745,14 @@ static uint32_t proj_step_x(const step_t *s, uint32_t *nn) /* its x byte (0: n *nn = all ? 4u : s->n; return (s->hit || s->acc ? 1u : 0u) | (s->probability ? 2u : 0u) | (r & 2u ? 4u : 0u) | (all ? 8u : 0u) | (s->comp ? 16u : 0u) | /* (0.6.39) a component: two bytes, its type and arguments */ - (s->comp2 || s->cwhen || s->ctime ? 32u : 0u); /* (0.6.82) the second, WHEN, DIV / LEN: four more */ + (s->comp2 || s->cwhen || s->ctime ? 32u : 0u) | /* (0.6.82) the second, WHEN, DIV / LEN: four more */ + (step_lm_any(s) ? 64u : 0u); /* (0.8.5) the lanes' modes: three more (firmware before refuses) */ } static uint32_t proj_step_size(const step_t *s) { uint32_t nn, x = proj_step_x(s, &nn); - return 2u + nn + (x ? 1u + (x & 1u ? 2u : 0u) + (x & 2u ? 1u : 0u) + (x & 16u ? 2u : 0u) + (x & 32u ? 4u : 0u) : 0u); + return 2u + nn + (x ? 1u + (x & 1u ? 2u : 0u) + (x & 2u ? 1u : 0u) + (x & 16u ? 2u : 0u) + (x & 32u ? 4u : 0u) + + (x & 64u ? 3u : 0u) : 0u); } static int proj_fm_kept(const project_t *q, uint32_t t) { @@ -853,6 +856,7 @@ static int proj_pack(project_store_t *out, const project_t *q) if (x & 2u) b[pos++] = s->probability; if (x & 16u) { b[pos++] = s->comp; b[pos++] = s->carg; } if (x & 32u) { b[pos++] = s->comp2; b[pos++] = s->carg2; b[pos++] = s->cwhen; b[pos++] = s->ctime; } + if (x & 64u) { b[pos++] = s->lm[0]; b[pos++] = s->lm[1]; b[pos++] = s->lm[2]; } } } memcpy(b + pos, &q->chain, sizeof q->chain); pos += sizeof q->chain; @@ -1036,7 +1040,7 @@ static int proj_unpack_c(project_t *q, const uint8_t *b) if (meta & 128u) { if (pos + 1u > room) return 0; x = b[pos++]; - if (!x || (x & ~63u)) return 0; + if (!x || (x & ~127u)) return 0; if (x & 8u) nn = 4u; } if (pos + nn + 1u > room) return 0; @@ -1062,6 +1066,14 @@ static int proj_unpack_c(project_t *q, const uint8_t *b) s->carg2 = b[pos++]; s->cwhen = b[pos++]; s->ctime = b[pos++]; if (CT_DIV(s) >= CT_NDIV || s->ctime > 127u) return 0; } + s->lm[0] = s->lm[1] = s->lm[2] = 0; + if (x & 64u) { /* (0.8.5) the lanes' modes (a 7: none) */ + uint32_t l; + if (pos + 3u > room) return 0; + s->lm[0] = b[pos++]; s->lm[1] = b[pos++]; s->lm[2] = b[pos++]; + for (l = 0; l < NLANE; l++) + step_set_lmode(s, l, step_lmode(s, l)); + } r |= (x >> 1) & 2u; step_set_ratchet(s, r + 1u); } @@ -1302,7 +1314,8 @@ static void proj_legacy_drums(track_t *t) t->p[P_DIST + i] = (int16_t)(pr->fx[i] ? pr->fx[i] - 1 : FX_DEF[i]); } -static project_t proj_scratch __attribute__((section(".lowbuf"))); /* (0.6.78: below the RAM code, app.ld) */ /* decoded main-loop work, never audio ISR (0.6: pool) */ +static project_t proj_scratch __attribute__((section(".pool"))); /* (0.8.5: the pool again, LOWBUF full with the steps' + * lane modes; 0.6.78 .. 0.8.4 LOWBUF) */ /* decoded main-loop work, never audio ISR (0.6: pool) */ static char proj_name[PROJ_NAME_LEN + 1u] /* the name of the music as it is now (loaded, saved, the editor's */ __attribute__((section(".pool"))); /* runtime restore); "" = none. A save takes it unless one is given */ #define PROJ_NO_SLOT 0xFFu diff --git a/firmware/src/seq.c b/firmware/src/seq.c index 2405c27f..e4c76324 100644 --- a/firmware/src/seq.c +++ b/firmware/src/seq.c @@ -37,6 +37,7 @@ static uint32_t kb_prev; static volatile uint8_t kb_boot_hold; /* #137: set from power-on to the end of the splash (main.c): the keys sound nothing, * and one held across its end stays silent until it is let go and pressed again */ static uint8_t kb_note[27], kb_trk[27]; /* per key: the note it started and on which track */ +static int8_t kb_oct[27]; /* (0.8.5) .. on a DRUM track, the kit's octave it plays (OCT then: seq.c dxo_on) */ static volatile uint8_t kb_asleep; /* MENU > SCREEN OFF (ui.c): the screen dark or waking, a key pressed now only * wakes it (silent, no layer, its release nothing) */ static uint8_t last_note = 60; @@ -494,6 +495,7 @@ static volatile uint8_t cin_left, cin_total; /* the count-in's beats still to static volatile uint32_t cin_pos; /* samples into its beat playing */ static uint8_t cin_flush; /* the count-in ended in this block: record what was kept */ static uint8_t cin_note[NTRK][4], cin_vel[NTRK][4], cin_n[NTRK], cin_up[NTRK]; /* kept notes; cin_up bit k: let go */ +static uint8_t cin_oct[NTRK][4]; /* (0.8.5) .. a kit's octave: its hits a step (bits 0-3), TOUCH (4-5) */ static int seq_counting(void) { return cin_left != 0u; } static uint32_t click_beat_len(void) { return 4u * div_samples(2); } /* DIV 2: 1/16 */ static int click_wanted(void) /* CLICK REC: while a track is armed (not in a song: no recording) */ @@ -571,6 +573,53 @@ static uint32_t seq_src(const track_t *t, uint32_t idx) return (uint32_t)(((int32_t)(idx % (uint32_t)len) - o + len) % len); } +/* (0.8.5) a recorded hit's octave (dx_in_rat / dx_in_tch: the key's or MIDI note's, eng_drum.c) as its lane's mode on + * the step (core.h LM_*): x2 / x4 / x8 above the kit's octave, SHORT / GHOST / FLAM below, none in it; that lane only + * (its hit and its notes), the rest of the step as it was. The last hit recorded on a lane sets it */ +static uint32_t rec_lmode(void) +{ + if (dx_in_tch) + return LM_SHORT + (dx_in_tch - 1u) % 3u; + return dx_in_rat >= 8u ? LM_X8 : dx_in_rat >= 4u ? LM_X4 : dx_in_rat >= 2u ? LM_X2 : LM_NONE; +} +/* a hit (a GM note) into step s of a DRUM track (rec_note, a held ratchet's next step: dxo_rec_hold) */ +static void rec_drum(track_t *t, step_t *s, uint32_t note, uint32_t vel, int32_t mic) +{ + uint32_t l = drum_lane(note), k; + if (s->time != ST_NOTE || (!s->n && !s->hit)) { + s->n = s->hit = s->acc = 0; + s->flags = 0; + s->vel = 0; + ST_MICRO_SET(s, mic); /* (0.6.88) its place off the grid (REC Q) */ + if (s->comp == CP_TOUCH) /* (0.8.5: an empty step's TOUCH left over: not this hit's) */ + s->comp = s->carg = 0; + if (s->comp2 == CP_TOUCH) + s->comp2 = s->carg2 = 0; + s->lm[0] = s->lm[1] = s->lm[2] = 0; + } + s->time = ST_NOTE; + if (note == DRUM_LANE_NOTE[l]) { /* a lane's note: its hit */ + s->hit |= (uint8_t)(1u << l); + if (vel > 110) + s->acc |= (uint8_t)(1u << l); + } else { /* another GM drum (a low tom, a crash): a note */ + for (k = 0; k < s->n && s->note[k] != note; k++) + ; + if (k == s->n) { + if (s->n < 4u) + s->n++; + s->note[s->n - 1u] = (uint8_t)note; + } + if (vel > 110) + s->flags |= SF_ACCENT; + } + if (vel > s->vel) + s->vel = (uint8_t)vel; + step_set_lmode(s, l, rec_lmode()); + t->seq_active = 1; +} +static uint8_t rec_at, rec_late; /* (0.8.5) the step (play index + 1) the last hit went into; + * 1: the next one (it was played late in the one before) */ /* live recording: the note goes into the nearest step, as swung (the one playing, or * the next one when it is past the middle of the playing one). Overdub: a step that * holds notes gets this one added (a chord of up to 4; when full, the last note is @@ -597,32 +646,9 @@ static void rec_note(track_t *t, uint32_t note, uint32_t vel) mic = clamp(mic * (127 - clamp(t->p[P_HRQ], 0, 127)) / 127, -8, 7); } if (drum_track(t)) { /* DRUM: into the grid, no holds (hits) */ - uint32_t l = drum_lane(note); - if (s->time != ST_NOTE || (!s->n && !s->hit)) { - s->n = s->hit = s->acc = 0; - s->flags = 0; - s->vel = 0; - ST_MICRO_SET(s, mic); /* (0.6.88) its place off the grid (REC Q) */ - } - s->time = ST_NOTE; - if (note == DRUM_LANE_NOTE[l]) { /* a lane's note: its hit */ - s->hit |= (uint8_t)(1u << l); - if (vel > 110) - s->acc |= (uint8_t)(1u << l); - } else { /* another GM drum (a low tom, a crash): a note */ - for (k = 0; k < s->n && s->note[k] != note; k++) - ; - if (k == s->n) { - if (s->n < 4u) - s->n++; - s->note[s->n - 1u] = (uint8_t)note; - } - if (vel > 110) - s->flags |= SF_ACCENT; - } - if (vel > s->vel) - s->vel = (uint8_t)vel; - t->seq_active = 1; + rec_drum(t, s, note, vel, mic); + rec_at = (uint8_t)(idx + 1u); + rec_late = (uint8_t)next; if (next) { if (t->rskip_idx != idx) t->rskip_n = 0; @@ -693,6 +719,7 @@ static void rec_hold(track_t *t, uint32_t idx, uint32_t len) s->flags = 0; s->vel = 0; s->hit = s->acc = 0; + s->lm[0] = s->lm[1] = s->lm[2] = 0; } /* a key of a recorded note is up: the hold ends with the last one */ @@ -724,6 +751,7 @@ static __attribute__((noinline)) void cin_keep(track_t *t, uint32_t note, uint32 } cin_note[i][k] = (uint8_t)note; cin_vel[i][k] = (uint8_t)vel; + cin_oct[i][k] = (uint8_t)((dx_in_rat & 15u) | (dx_in_tch & 3u) << 4); cin_up[i] &= (uint8_t)~(1u << k); } @@ -763,6 +791,160 @@ static void input_off(track_t *t, uint32_t note) trk_note_off(t, note); /* other mode (ARP switched while held) */ } +/* ------------------------------------------- (0.8.5) the kit's octaves --- */ +/* A DRUM track's note in another octave than the kit's (eng_drum.c DXO_*): a key at OCT +-n (kb_oct), a MIDI note of a + * band around the GM map (drum_oct_of). Below: the hit with TOUCH n (dx_in_tch on its note-on: SHORT GHOST FLAM). + * Above: the hit, then again x2 / x4 / x8 a step while held (dxo_tick): playing, on the grid the sequencer's lane + * ratchets use (a part every step / n from each step's start, swung as the steps are: seq_lane_rat), stopped, every + * step / n from the press. Recording, playing (rec_on), the step it goes into gets the hit and its lane's mode + * (rec_lmode: that lane only); every step entered while it is held too, before it plays (dxo_rec_hold: the sequencer + * plays those, the held note is silent there), so the pass after plays what was heard; let go before the middle of + * such a step, that step is put back (dxo_bak), as a held synth note's TIE. The ARP on: the notes go to it plain. Each + * held one: its key or MIDI note (id), up to DXO_N a track (one more replaces the last) */ +#define DXO_N 4u +#define DXO_KEY 0x100u /* id: a key (+ k), a MIDI note (+ ch << 7 + note) */ +#define DXO_MIDI 0x1000u +typedef struct { + uint16_t id, idx; /* who holds it; the step (play index) part counts in */ + uint8_t note, vel, r, part; /* the hit, its hits a step, the part struck last (255 none) */ + uint8_t quiet, rec; /* a step (+ 1) it is silent in (the sequencer plays it); the + * step (+ 1) its press was recorded into */ + uint32_t cnt; /* stopped: samples since its last hit */ +} dxo_t; +static dxo_t dxo[NPART][DXO_N]; +static uint8_t dxo_n[NPART]; +static step_t dxo_bak[NPART]; /* the step a held one was last recorded into, as it was */ +static uint8_t dxo_bak_at[NPART]; /* .. which (its source step + 1; 0 none), entered at play idx */ +static uint16_t dxo_bak_idx[NPART]; +static uint32_t dxo_part(const track_t *t, uint32_t r) /* the part of the playing step it is in */ +{ + uint32_t sl = step_samples(t, div_samples((uint32_t)t->p[P_SDIV]), t->seq_idx) / (r ? r : 1u), p; + p = t->seq_pos / (sl ? sl : 1u); + return p < r ? p : r - 1u; +} +static void dxo_on(track_t *t, uint32_t note, int32_t o, uint32_t vel, uint32_t id) +{ + uint32_t ti = trk_index(t), k; + dxo_t *e; + if (!o || t->p[P_AMODE] || ti >= NPART || !drum_track(t)) { + input_on(t, note, vel); + return; + } + if (o < 0) { + dx_in_tch = (uint8_t)(o < -3 ? 3 : -o); + input_on(t, note, vel); + dx_in_tch = 0; + return; + } + dx_in_rat = DXO_RAT[o > 3 ? 3 : o]; + rec_at = 0; + input_on(t, note, vel); /* (its first hit; recorded with the RATCH) */ + for (k = 0; k < dxo_n[ti] && dxo[ti][k].id != id; k++) + ; + if (k == dxo_n[ti] && dxo_n[ti] < DXO_N) + dxo_n[ti]++; + e = &dxo[ti][k < DXO_N ? k : DXO_N - 1u]; + e->id = (uint16_t)id; + e->note = (uint8_t)note; + e->vel = (uint8_t)vel; + e->r = dx_in_rat; + e->cnt = 0; + e->idx = t->seq_idx; + e->part = song.playing && t->seq_pos < 0x7FFFFFFFu ? (uint8_t)dxo_part(t, e->r) : 255u; + e->quiet = e->rec = 0; + if (cin_left) /* (the count-in keeps it for step 1) */ + e->rec = 1; + else if (rec_at && rec_on(t)) { + e->rec = rec_at; + if (rec_late) /* into the next step: silent to its end, as it plays back */ + e->quiet = (uint8_t)(t->seq_idx + 1u); + } + dx_in_rat = 0; +} +static void dxo_off(track_t *t, uint32_t id) +{ + uint32_t ti = trk_index(t), k, j = 0; + if (ti >= NPART || !dxo_n[ti]) + return; + for (k = 0; k < dxo_n[ti]; k++) + if (dxo[ti][k].id != id) + dxo[ti][j++] = dxo[ti][k]; + if (j == dxo_n[ti]) + return; + dxo_n[ti] = (uint8_t)j; + if (!j && dxo_bak_at[ti]) { /* let go early in a step it was held into: that step back */ + if (rec_on(t) && dxo_bak_idx[ti] == t->seq_idx && seq_src(t, t->seq_idx) == dxo_bak_at[ti] - 1u && + t->seq_pos < step_samples(t, div_samples((uint32_t)t->p[P_SDIV]), t->seq_idx) / 2u) + t->step[dxo_bak_at[ti] - 1u] = dxo_bak[ti]; + dxo_bak_at[ti] = 0; + } +} +/* the sequencer enters step idx of track t (before it plays it): recording, the held ones go into it */ +static __attribute__((noinline)) void dxo_rec_hold(track_t *t, uint32_t idx) +{ + uint32_t ti = trk_index(t), k, src = seq_src(t, idx), bak = 0; + for (k = 0; k < dxo_n[ti]; k++) { + dxo_t *e = &dxo[ti][k]; + if (e->rec == idx + 1u) { /* (its press went into this one: it plays it) */ + e->quiet = (uint8_t)(idx + 1u); + continue; + } + if (!rec_on(t) || !drum_track(t)) + continue; + if (!bak) { + dxo_bak[ti] = t->step[src]; + dxo_bak_at[ti] = (uint8_t)(src + 1u); + dxo_bak_idx[ti] = (uint16_t)idx; + bak = 1; + } + dx_in_rat = e->r; + rec_drum(t, &t->step[src], e->note, e->vel, 0); + dx_in_rat = 0; + e->quiet = (uint8_t)(idx + 1u); + } +} +static void dxo_hit(track_t *t, const dxo_t *e) { trk_note_on(t, e->note, e->vel); } +/* a block on (events_block, after the sequencer): the held ones' next hits */ +static __attribute__((noinline)) void dxo_tick(track_t *t, uint32_t n) +{ + uint32_t ti = trk_index(t), k; + if (!drum_track(t) || t->p[P_AMODE]) { + dxo_n[ti] = 0; + return; + } + for (k = 0; k < dxo_n[ti]; k++) { + dxo_t *e = &dxo[ti][k]; + uint32_t r = e->r ? e->r : 1u, part; + if (!song.playing || t->seq_pos >= 0x7FFFFFFFu) { /* stopped: from the press */ + uint32_t per = div_samples((uint32_t)t->p[P_SDIV]) / r; + e->part = 255u; + e->idx = 0xFFFFu; + e->cnt += n; + if (per && e->cnt >= per) { + e->cnt -= per; + if (e->cnt >= per) + e->cnt = 0; + dxo_hit(t, e); + } + continue; + } + e->cnt = 0; + part = dxo_part(t, r); + if (t->seq_idx != e->idx) { + e->idx = t->seq_idx; + e->part = 255u; + } + if (e->quiet == t->seq_idx + 1u) { + e->part = (uint8_t)part; + continue; + } + if (part != e->part) { + e->part = (uint8_t)part; + dxo_hit(t, e); + } + } +} + /* the effect of key k in the FX layer (PF_N none): the first PF_M1 white keys (F3 .. A4) in order, black keys * 1..4 (F#3 G#3 A#3 C#4) the track mutes */ static uint32_t perf_key(uint32_t k) @@ -807,9 +989,9 @@ static void key_next(uint32_t k, track_t *t) uint32_t x = kb_snd[k][kb_on[k]], mc = trk_midi_ch(trk_index(t)); if (!midi_local_held(t, x)) { in_norec = kb_sn[k] > 1u; /* (0.6.84: the chord's notes recorded at once, key_on) */ - input_on(t, x, 100); + dxo_on(t, x, kb_oct[k], 100, DXO_KEY + k); /* (0.8.5: a kit's octave; else input_on) */ in_norec = 0; - mo_key(t, 0x09u | (0x90u | mc) << 8 | x << 16 | 100u << 24); + mo_key(t, 0x09u | (0x90u | mc) << 8 | drum_oct_note(x, kb_oct[k]) << 16 | 100u << 24); } kb_on[k]++; } @@ -862,6 +1044,8 @@ static void key_off(uint32_t k, track_t *t) uint32_t n = kb_on[k], i, mc = trk_midi_ch(trk_index(t)); if (!n) return; + if (kb_oct[k] > 0) + dxo_off(t, DXO_KEY + k); /* (0.8.5) its ratchet ends (LATCH too) */ kb_on[k] = 0; /* (the strum's notes not in yet: never) */ kb_sn[k] = 0; if (key_latch(t)) { /* LATCH: it keeps sounding (recorded as let go) */ @@ -876,7 +1060,7 @@ static void key_off(uint32_t k, track_t *t) if (midi_local_held(t, x)) continue; input_off(t, x); - mo_key(t, 0x08u | (0x80u | mc) << 8 | x << 16); + mo_key(t, 0x08u | (0x80u | mc) << 8 | drum_oct_note(x, kb_oct[k]) << 16); } } @@ -937,6 +1121,7 @@ static void keyboard_block(void) kb_note[k] = key_black(k) && key_place(k) < NLANE ? DRUM_LANE_NOTE[key_place(k)] : KB_SILENT; else kb_note[k] = (uint8_t)kb_map(&trk[kb_trk[k]], k); + kb_oct[k] = (int8_t)(!song.grid && drum_track(&trk[kb_trk[k]]) ? song.octave : 0); /* (0.8.5) */ if (kb_note[k] == KB_SILENT) continue; key_on(k, &trk[kb_trk[k]]); @@ -1147,7 +1332,7 @@ static uint32_t step_parts(const track_t *t, const step_t *s, uint32_t *div) cp_get(t, o, CP_ARPN, CP_ARPS, &a); return *div = CP_RATES[CP_RATE(a) % CP_NRATE]; } - h = s->time == ST_NOTE && CP_HAS(t, s, CP_ECHO, &a) ? 2u + a % 7u : step_ratchet(s); + h = s->time == ST_NOTE && CP_HAS(t, s, CP_ECHO, &a) ? 2u + (a & ~CP_ECHO_EVEN) % 7u : step_ratchet(s); d = CT_DIVS[CT_DIV(s) % CT_NDIV]; if (h < 2u || !d) return *div = h; @@ -1433,6 +1618,7 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint (t->p[P_AMODE] == AM_TRNS ? t->trn : 0); /* ARP TRNS: the keys' interval */ if (!(skip & SEQ_REP)) { t->rat_left = 0; + t->lr_on = 0; if ((skip & SEQ_MISS) || (!(skip & SEQ_ROLLED) && !step_rolls(t, s))) { seq_release(t); @@ -1506,7 +1692,9 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint gate = step_samples(t, period, t->seq_idx) / div * (CT_LEN(s) ? CT_LEN(s) * 8u : (uint32_t)t->p[P_SGATE]) / 128u; if (!(skip & SEQ_REP)) t->rat_left = (uint8_t)(hits - 1u); - if (!arp && CP_HAS(t, s, CP_ECHO, 0)) { /* (0.6.42) ECHO: each repeat softer */ + uint8_t ea = 0; + if (!arp && CP_HAS(t, s, CP_ECHO, &ea) && !(ea & CP_ECHO_EVEN)) { /* (0.6.42) ECHO: each repeat softer + * (0.8.5: EVEN, a ratchet: all at one level) */ uint32_t part = (skip & SEQ_REP) ? hits - 1u - t->rat_left : 0u; vel = vel * (hits - part) / hits; if (vel < 8u) vel = 8u; @@ -1568,6 +1756,10 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint } if (oct) dp += cp_oct(t, oa); t->dpit = (int8_t)clamp(dp, -48, 48); + { /* (0.8.5) TOUCH: SHORT GHOST FLAM on the hits (eng_drum.c) */ + uint8_t da = 0; + t->dtch = (uint8_t)(CP_HAS(t, s, CP_TOUCH, &da) ? 1u + da % 3u : 0u); + } t->dbend = (int16_t)(bend ? ((int32_t)(ba % 25u) - 12) * 16 : 0); t->dbt = (uint16_t)clamp((int32_t)(step_samples(t, period, t->seq_idx) / CTL), 1, 65535); } @@ -1632,12 +1824,22 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint } t->ss_gap = gap; t->ss_due = hdel ? hdel : 1u; + t->ss_tch = t->dtch; /* (0.8.5: the queued hits keep their TOUCH) */ gate += hdel; } + { /* (0.8.5) a kit: each lane's own mode on its hits (TOUCH now, the ratchets after: seq_lane_rat) */ + uint32_t l; + for (l = 0; kit && !(skip & SEQ_REP) && l < NLANE; l++) + if (lm_hits(step_lmode(s, l)) > 1u) + t->lr_on = 1; + } for (i = 0; i < m; i++) if (!((sk >> i) & 1u)) { - uint32_t a0 = vage; + uint32_t a0 = vage, dt0 = t->dtch, lt = kit ? lm_touch(step_lmode(s, drum_lane(nn[i]))) : 0u; + if (lt) + t->dtch = (uint8_t)lt; seq_note_on(t, nn[i], vv[i]); + t->dtch = (uint8_t)dt0; if (bend && !kit && vage != a0) { /* (0.6.42) BEND: its voice glides over the step */ uint32_t k2, ticks = step_samples(t, period, t->seq_idx) / CTL; int32_t d = ((int32_t)(ba % 25u) - 12) * 16; @@ -1653,6 +1855,7 @@ static __attribute__((noinline)) void seq_step(track_t *t, const step_t *s, uint } t->dpit = 0; /* (0.6.82: the keys' hits as they are) */ t->dbend = 0; + t->dtch = 0; if (slide_in) /* release what is not held over */ for (i = 0; i < t->seq_n; i++) { for (j = 0; j < m && nn[j] != t->seq_notes[i]; j++) @@ -1685,6 +1888,37 @@ static __attribute__((noinline)) void seq_ratchet(track_t *t, uint32_t period) seq_step(t, s, period, SEQ_REP); } +/* (0.8.5) the lanes ratcheting on the playing step (LM_X2 / X4 / X8, seq_step struck their first part): each again at + * every step / n (the grid RATCH's parts and the held keys' ratchets keep, dxo_tick), that lane's hit and notes alone, + * the step read again (an edit ends it); n: the samples the step moved on in this block */ +static __attribute__((noinline)) void seq_lane_rat(track_t *t, uint32_t period, uint32_t n) +{ + const step_t *s = t->cv_on ? &t->cvs : &seq_steps(t)[seq_src(t, t->seq_idx)]; + uint32_t sl = step_samples(t, period, t->seq_idx), pos = t->seq_pos, prev, l, k, any = 0; + uint32_t vel = (s->flags & SF_ACCENT) ? 127u : (s->vel ? s->vel : 96u); + if (pos >= 0x7FFFFFFFu || s->time != ST_NOTE) { + t->lr_on = 0; + return; + } + prev = pos > n ? pos - n : 0u; + for (l = 0; l < NLANE; l++) { + uint32_t r = lm_hits(step_lmode(s, l)), q, pn; + if (r < 2u) + continue; + any = 1; + q = sl / r; + pn = pos / (q ? q : 1u); + if (pn <= prev / (q ? q : 1u) || pn >= r) + continue; + if ((s->hit >> l) & 1u) + seq_note_on(t, DRUM_LANE_NOTE[l], (s->acc >> l) & 1u ? 127u : vel); + for (k = 0; k < s->n && k < 4u; k++) + if (drum_lane(s->note[k]) == l) + seq_note_on(t, s->note[k], vel); + } + t->lr_on = (uint8_t)any; +} + /* 1/2 TEMPO let go (pfx.c): the track back where it would be had it run on, from where it was pressed */ static __attribute__((noinline)) void pfx_resync(track_t *t, uint32_t period, uint32_t len) { @@ -1722,7 +1956,15 @@ static void seq_tick(track_t *t, uint32_t n) t->ss_due -= n; } else { do { /* (0.6.87: HUMAN TIME without a strum: the chord together) */ + t->dtch = t->ss_tch; + if (trk_kit(t)) { /* (0.8.5) its lane's TOUCH, from the step playing */ + const step_t *ps = t->cv_on ? &t->cvs : &seq_steps(t)[seq_src(t, t->seq_idx)]; + uint32_t lt = lm_touch(step_lmode(ps, drum_lane(t->ss_nn[t->ss_i]))); + if (lt) + t->dtch = (uint8_t)lt; + } seq_note_on(t, t->ss_nn[t->ss_i], t->ss_vv[t->ss_i]); + t->dtch = 0; t->ss_i++; } while (!t->ss_gap && t->ss_i < t->ss_n); t->ss_due = t->ss_gap; @@ -1768,6 +2010,8 @@ static void seq_tick(track_t *t, uint32_t n) if (!t->seq_idx && !start && t->loops < 0xFFFFu) t->loops++; /* (0.6.39) one more loop of the pattern (TRIG) */ rec_hold(t, t->seq_idx, len ? len : 1u); + if (trk_index(t) < NPART && dxo_n[trk_index(t)]) + dxo_rec_hold(t, t->seq_idx); /* (0.8.5) a held ratchet records into it */ { const step_t *s = &seq_steps(t)[(t->pfx & PFX_RND) && !(rng() & 1u) /* (JIANT) RANDOM held: half the */ ? rng() % (len ? len : 1u) : seq_src(t, t->seq_idx)]; /* steps, any */ @@ -1800,6 +2044,8 @@ static void seq_tick(track_t *t, uint32_t n) } if (t->rat_left) seq_ratchet(t, period); + if (t->lr_on) + seq_lane_rat(t, period, n); fugue_tick(t, n, period, len); /* (0.6.52) */ } @@ -1844,7 +2090,10 @@ static __attribute__((noinline)) void cin_record(void) track_t *t = &trk[i]; for (k = 0; k < cin_n[i]; k++) if (rec_on(t)) { + dx_in_rat = (uint8_t)(cin_oct[i][k] & 15u); + dx_in_tch = (uint8_t)(cin_oct[i][k] >> 4); rec_note(t, cin_note[i][k], cin_vel[i][k]); + dx_in_rat = dx_in_tch = 0; if ((cin_up[i] >> k) & 1u) rec_release(t, cin_note[i][k]); } @@ -1952,6 +2201,8 @@ static void events_block(uint32_t n) } latch_was = (uint8_t)(key_latch(t) ? latch_was | 1u << i : latch_was & ~(1u << i)); if ((pr >> i) & 1u) { + if (i < NPART) + dxo_n[i] = 0; /* (0.8.5) the held ratchets stop */ if ((latch_was >> i) & 1u) latch_release(t); /* (0.6.19: MIDI OUT's latched notes end too) */ midi_forget_track(i); @@ -2013,6 +2264,9 @@ static void events_block(uint32_t n) chain_tick(seq_n); for (i = 0; i < NTRK; i++) seq_tick(&trk[i], seq_n); + for (i = 0; i < NPART; i++) /* (0.8.5) the kit's octaves held: their ratchets */ + if (dxo_n[i]) + dxo_tick(&trk[i], clock_mode ? seq_n : n); if (cin_flush) cin_record(); if (song.playing) diff --git a/firmware/src/ui.c b/firmware/src/ui.c index e5571d97..6901e98b 100644 --- a/firmware/src/ui.c +++ b/firmware/src/ui.c @@ -836,7 +836,7 @@ static uint32_t note_len(const track_t *t, uint32_t c, uint32_t len) } enum { COMP_OFF, COMP_CHANCE, COMP_RATCH, COMP_ARPN, COMP_ARPQ, COMP_ARPS, COMP_TRIG, COMP_RAND, COMP_OCT, COMP_TONAL, - COMP_BEND, COMP_ECHO, COMP_PULSE, COMP_JUMP, COMP_REV, COMP_FILL, COMP_KILL, COMP_WALK, COMP_CLIMB, COMP_N }; /* (CP_* in order) */ + COMP_BEND, COMP_ECHO, COMP_PULSE, COMP_JUMP, COMP_REV, COMP_FILL, COMP_KILL, COMP_WALK, COMP_CLIMB, COMP_TOUCH, COMP_N }; /* (CP_* in order) */ static const char *const EV_NAMES[EV_N] = {"ALWAYS", "1:2", "2:2", "SKIP", "1:3", "2:3", "3:3", "1:4", "2:4", "3:4", "4:4", "1:8", "FIRST", "!FIRST"}; /* (0.6.92) EVERY */ /* (0.6.92) a part of the step as a note value: n parts a step of the track's DIV (1/16: x2 1/32, x3 1/32T, x4 1/64 ..; @@ -853,7 +853,8 @@ static void rate_name(const track_t *t, uint32_t n, char *b) b[0] = '1'; b[1] = '/'; fmt_int(b + 2, (int32_t)v); str_cpy(b + str_len(b), tr, 2); } static const char *const COMP_NAMES[COMP_N] = {"OFF", "CHANCE", "RATCH", "NOTES", "SEQ", "SCALE", "TRIG", "RAND", "OCT", - "TONAL", "BEND", "ECHO", "PULSE", "JUMP", "REV", "FILL", "KILL", "WALK", "CLIMB"}; + "TONAL", "BEND", "ECHO", "PULSE", "JUMP", "REV", "FILL", "KILL", "WALK", "CLIMB", + "TOUCH"}; /* (0.6.82) the COMP pages one after another: COMP (the step's first component), COMP 2 (its second), WHEN (theirs, and * the step's LEN): which this is (0..2) */ static uint32_t comp_slot(void) @@ -896,6 +897,7 @@ static void step_clear(step_t *st) st->comp = st->carg = 0; st->comp2 = st->carg2 = st->cwhen = st->ctime = 0; st->probability = 0; + st->lm[0] = st->lm[1] = st->lm[2] = 0; /* (0.8.5) */ } /* ------------------------------------------------------- the DRUM grid --- */ @@ -952,10 +954,26 @@ static void grid_hit(track_t *t, uint32_t i, uint32_t l, uint32_t on) } else { s->hit &= (uint8_t)~b; s->acc &= (uint8_t)~b; + step_set_lmode(s, l % NLANE, LM_NONE); /* (0.8.5) its mode goes with it */ if (!s->n && !s->hit) step_clear(s); } } +/* (0.8.5) the grid's HIT of lane l at step i as one list: --, ON, then its modes x2 x4 x8 SHORT GHOST FLAM (0..7) */ +static const char *const GRID_HIT[LM_N + 1] = {"--", "ON", "x2", "x4", "x8", "SHORT", "GHOST", "FLAM"}; +static uint32_t grid_hit_of(const step_t *s, uint32_t l) +{ + return (step_lanes(s) >> (l % NLANE)) & 1u ? 1u + step_lmode(s, l) : 0u; +} +static void grid_hit_set(track_t *t, uint32_t i, uint32_t l, uint32_t v) +{ + if (!v) { + grid_hit(t, i, l, 0); + return; + } + grid_hit(t, i, l, 1); + step_set_lmode(&t->step[i % NSTEP], l, v - 1u); +} /* the accent of lane l at step i (on 1, off 0, toggled 2); an accent on an empty lane adds the hit */ static void grid_acc(track_t *t, uint32_t i, uint32_t l, uint32_t on) @@ -1204,6 +1222,7 @@ static void load_pat16(track_t *t, const uint8_t *note, const uint8_t *flags) s->vel = n ? 96 : 0; s->hit = s->acc = 0; s->probability = 0; + s->lm[0] = s->lm[1] = s->lm[2] = 0; /* (0.8.5) */ if (drum_track(t)) /* a DRUM track: the lanes' notes as its grid */ step_to_grid(s); } diff --git a/firmware/src/ui_draw.c b/firmware/src/ui_draw.c index 6e5dad9a..b3ecdfed 100644 --- a/firmware/src/ui_draw.c +++ b/firmware/src/ui_draw.c @@ -972,7 +972,8 @@ static void draw_columns(void) case COMP_OCT: lb = "MODE"; str_cpy(val, OCTN[a % 6], sizeof val); un = "OCT"; break; case COMP_TONAL: lb = "SHIFT"; a -= 7; val[0] = a < 0 ? '-' : '+'; fmt_int(val + 1, a < 0 ? -a : a); un = "DEG"; break; case COMP_BEND: lb = "BEND"; a -= 12; val[0] = a < 0 ? '-' : '+'; fmt_int(val + 1, a < 0 ? -a : a); un = "ST"; break; - case COMP_ECHO: lb = "REPEAT"; val[0] = 'x'; fmt_int(val + 1, 2 + a % 7); break; + case COMP_ECHO: lb = "REPEAT"; val[0] = 'x'; fmt_int(val + 1, 2 + (a & 127) % 7); un = a & 128 ? "EVEN" : ""; break; + case COMP_TOUCH: { static const char *const TN[3] = {"SHORT", "GHOST", "FLAM"}; lb = "HIT"; str_cpy(val, TN[a % 3], sizeof val); break; } /* (0.8.5) */ case COMP_PULSE: lb = "EVERY"; fmt_int(val, 1 + a % 4); un = a ? "STEPS" : "STEP"; break; case COMP_JUMP: lb = "TO STEP"; fmt_int(val, (int32_t)CP_JTO(a) + 1); break; case COMP_WALK: case COMP_CLIMB: { /* (0.6.98) MODE and RANGE in one: the range as the unit */ @@ -1247,7 +1248,7 @@ static void draw_columns(void) fmt_int(sl + 1, TSEL->p[P_SLEN]); draw_column(0, "STEP", sn, sl, VAL(0u), -1, ICON_AUTO); draw_column(1, "LANE", drum_lane_name(TSEL, ui.lane), "", VAL(1u), -1, ICON_AUTO); - draw_column(2, "HIT", on ? "ON" : "--", "", on ? VAL(2u) : T_DIM, -1, ICON_AUTO); + draw_column(2, "HIT", GRID_HIT[grid_hit_of(st, ui.lane)], "", on ? VAL(2u) : T_DIM, -1, ICON_AUTO); /* (0.8.5: its mode) */ draw_column(3, "ACC", ac ? "ON" : "--", "", ac ? VAL(3u) : T_DIM, -1, ICON_AUTO); return; } diff --git a/firmware/src/ui_input.c b/firmware/src/ui_input.c index 6baded0c..c14ee22a 100644 --- a/firmware/src/ui_input.c +++ b/firmware/src/ui_input.c @@ -564,7 +564,8 @@ static void page_go(int32_t d) cursor_set((int32_t)(b * 16u + ui.cursor % 16u < len ? b * 16u + ui.cursor % 16u : len - 1u)); } -/* the grid's knobs: 1 STEP (the cursor), 2 LANE, 3 HIT and 4 ACC of the lane at the cursor (right on, left off) */ +/* the grid's knobs: 1 STEP (the cursor), 2 LANE, 3 HIT and 4 ACC of the lane at the cursor (right on, left off; 0.8.5: + * HIT on along its modes, ui.c GRID_HIT) */ static void grid_edit(uint32_t slot, int32_t steps) { if (slot == 0u) @@ -572,7 +573,8 @@ static void grid_edit(uint32_t slot, int32_t steps) else if (slot == 1u) ui.lane = (uint8_t)clamp((int32_t)ui.lane + (steps > 0 ? 1 : -1), 0, NLANE - 1); else if (slot == 2u) - grid_hit(TSEL, ui.cursor, ui.lane, steps > 0); + grid_hit_set(TSEL, ui.cursor, ui.lane, + (uint32_t)clamp((int32_t)grid_hit_of(&TSEL->step[ui.cursor], ui.lane) + (steps > 0 ? 1 : -1), 0, LM_N)); else grid_acc(TSEL, ui.cursor, ui.lane, steps > 0); } @@ -904,8 +906,10 @@ static void comp_knob(uint32_t slot, int32_t steps) step_set_ratchet(st, (uint32_t)clamp((int32_t)step_ratchet(st) + d, 1, 4)); else if (*cp == CP_JUMP && slot == 2u) /* (0.6.62) TO STEP (0.6.92: TIMES is EVERY, KNOB 4) */ *ap = (uint8_t)((*ap & 0xC0u) | (uint32_t)clamp((int32_t)CP_JTO(*ap) + steps, 0, 63)); - else if (v >= COMP_TRIG && slot == 2u && *cp > CP_ARPS && CP_AMAX[*cp]) /* TRIG .. PULSE: their value */ - *ap = (uint8_t)clamp((int32_t)*ap + d, CP_AMIN[*cp], CP_AMAX[*cp]); + else if (v >= COMP_TRIG && slot == 2u && *cp > CP_ARPS && CP_AMAX[*cp]) /* TRIG .. PULSE: their value (0.8.5: ECHO's + * EVEN kept) */ + *ap = (uint8_t)((*cp == CP_ECHO ? *ap & CP_ECHO_EVEN : 0u) | + (uint32_t)clamp((int32_t)(*cp == CP_ECHO ? *ap & ~CP_ECHO_EVEN : *ap) + d, CP_AMIN[*cp], CP_AMAX[*cp])); else if ((v == COMP_WALK || v == COMP_CLIMB) && slot == 2u) { /* (0.6.98) MODE x RANGE: one list, a range after another */ int32_t i = clamp((int32_t)(CP_WMODE(*ap) * 4u + CP_WRNG(*ap)) + d, 0, 15); *ap = CP_WARG(CP_WRATE(*ap), (uint32_t)i / 4u, (uint32_t)i % 4u); @@ -2282,6 +2286,8 @@ static void ui_input_frame(void) song.octave = 0; else song.octave += b == B_OCTDN ? (song.octave > -3 ? -1 : 0) : (song.octave < 3 ? 1 : 0); + if (drum_track(TSEL) && !song.grid) /* (0.8.5) the kit's octaves: what this one does */ + ui_message(drum_oct_name(song.octave)); break; } default: /* page buttons (GLO SCL ENV LFO EDIT ARP): when let go */ diff --git a/tests/drumx_oct_test.c b/tests/drumx_oct_test.c new file mode 100644 index 00000000..ccd18bb8 --- /dev/null +++ b/tests/drumx_oct_test.c @@ -0,0 +1,744 @@ +/* SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments */ +/* (JIANT 0.8.5) DRUM-X OCTAVES (eng_drum.c DXO_*, seq.c dxo_*): the kit in every octave of the keys, on the real + * sequencer, MIDI, project and UI sources (with the stubs of tests/ui_test.c): + * CENTRE OCT 0: the keys' notes and hits as before (key 7 the kick, 36), no ratchet, no TOUCH, a hit bit for bit + * the one a plain note-on renders; recorded: the hit alone. + * UP OCT +1 / +2 / +3: the same sound ratcheted x2 / x4 / x8 a step while held, stopped (from the press, a + * step / n apart) and playing (on the sequencer's RATCH grid); the release ends it. + * DOWN OCT -1 SHORT (half the length, its level), -2 GHOST (short, darker, under 55 % of the level), -3 FLAM (a + * soft grace hit, the hit itself ~20 ms later at its level): measured on the engine's output. + * REC real-time recording, playing: an upper octave writes the hit and the step's RATCH x2 / x4 (x8: ECHO x8 + * EVEN), in each step it is held into (an early release puts the last one back); the pass after plays the + * very hits that were heard (each at the same sample, to the block); a lower one writes the hit and the + * step's TOUCH, played back with it (the same length and level as live); MIDI the same; FUNC round trip. + * MIDI 35..81 the GM map as before; 82.. ratchet bands, ..34 TOUCH bands (by pitch class), note-offs end them. + * UI OCT on a DRUM track says what the octave does; SEQ > COMP shows a recorded TOUCH step, ECHO's EVEN kept + * by its knob. + * Built and run by tests/run_tests.sh. */ +#define UI_TEST_NO_MAIN 1 +#define PROJ_FUNB_WRITER 1 /* (an older format to load: FUNB, as JIANT 0.2 .. 0.5 wrote it) */ +#include "ui_test.c" + +#define KICK_KEY 7u /* the first C: the kick (36) at OCT 0 */ +static track_t *dt; + +static track_t *drum_setup(void) +{ + uint32_t i; + ui_power_on(); + for (i = 0; i < NTRK; i++) { + track_defaults_steps(&trk[i]); + if (i != 3u) + trk[i].p[P_MUTE] = 1; + } + dt = &trk[3]; + set_engine_of(dt, ENGI_DRUM); + dt->engine = dt->eng_req; + song.sel = 3; + song.octave = 0; + song.rec = 0; + song.playing = 0; + dt->p[P_SLEN] = 16; + dt->p[P_SSWING] = 0; + song.g[G_SWING] = 0; + song.g[G_ROUTE] = 0; + memset(dxo_n, 0, sizeof dxo_n); + kb_prev = fm1_in.notes = 0; + events_block(CTL); /* (the sound load's panic, as the ISR takes it) */ + return dt; +} +static uint32_t step_len(uint32_t idx) { return step_samples(dt, div_samples((uint32_t)dt->p[P_SDIV]), idx); } +static uint32_t now_s; /* samples since the test's clock started */ +/* nb blocks of the ISR's events (keys, MIDI, the sequencer, the held octaves); at[]: the sample of each hit */ +static uint32_t run_b(uint32_t nb, uint32_t *at, uint32_t nat, uint32_t *nh) +{ + uint32_t b, v0; + for (b = 0; b < nb; b++) { + v0 = vage; + events_block(CTL); + for (; v0 < vage; v0++) { + if (at && *nh < nat) + at[*nh] = now_s; + (*nh)++; + } + now_s += CTL; + } + return *nh; +} +static void key_dn(uint32_t k) { fm1_in.notes |= 1u << k; } +static void key_upk(uint32_t k) { fm1_in.notes &= ~(1u << k); } +static const drum_lane_t *lane(uint32_t l) { return &drum_kit[3][l]; } +static uint32_t lane_modes_but(const step_t *s, uint32_t l) /* the lanes other than l with a mode (a mask) */ +{ + uint32_t m = 0, k; + for (k = 0; k < NLANE; k++) + if (k != l && step_lmode(s, k)) + m |= 1u << k; + return m; +} + +/* ---------------------------------------------------------------- audio --- */ +/* the engine's own output of the hit on lane l (drum_render at full amplitude: no mix, no sends, no tails) */ +#define AN (FS * 2u) +static int32_t abuf[AN]; +static void eng_render(uint32_t l, uint32_t n) +{ + voice_t *v = 0; + vmod_t m; + uint32_t i, k; + memset(&m, 0, sizeof m); + for (i = 0; i < NVOICE; i++) + if (dt->v[i].active && drum_lane_of(dt, &dt->v[i]) == &drum_kit[3][l]) + v = &dt->v[i]; + memset(abuf, 0, sizeof abuf); + if (v) + m.amp1 = v->vel * 258; /* (the voice's level: voice.c, the ADSR held at full) */ + for (k = 0; v && k + CTL <= n; k += CTL) { + int32_t o[CTL]; + memset(o, 0, sizeof o); + m.amp0 = m.amp1; + m.amp1 = v->vel * 258; + drum_render(dt, v, o, CTL, &m); + for (i = 0; i < CTL; i++) + abuf[k + i] = o[i]; + } +} +static void quiet_kit(void) /* every hit ended, the lanes from rest */ +{ + uint32_t i; + for (i = 0; i < NVOICE; i++) + dt->v[i].active = 0; + memset(drum_kit, 0, sizeof drum_kit); +} +/* the hit's length: the last 5 ms window above -40 dB of the loudest one */ +static uint32_t hit_len(uint32_t n) +{ + double pk = 0, w; + uint32_t i, j, last = 0, win = FS / 200u; + for (i = 0; i + win <= n; i += win) { + for (w = 0, j = 0; j < win; j++) + w += (double)abuf[i + j] * abuf[i + j]; + w = sqrt(w / win); + if (w > pk) pk = w; + } + for (i = 0; i + win <= n; i += win) { + for (w = 0, j = 0; j < win; j++) + w += (double)abuf[i + j] * abuf[i + j]; + if (sqrt(w / win) > pk * 0.01) + last = i + win; + } + return last; +} +/* brightness of its first 30 ms: the first difference's energy over the signal's */ +static double bright(void) +{ + double a = 0, d = 0; + uint32_t i; + for (i = 1; i < FS * 30u / 1000u; i++) { + double x = abuf[i], y = (double)abuf[i] - abuf[i - 1]; + a += x * x; + d += y * y; + } + return a > 0 ? d / a : 0; +} +static void strike_dmp(uint32_t note, uint32_t dmp) +{ + quiet_kit(); + dx_in_tch = (uint8_t)dmp; + trk_note_on(dt, note, 100); + dx_in_tch = 0; + trk_note_off(dt, note); + eng_render(drum_lane(note), AN); +} + +static int centre(void) +{ + int bad = 0, ok = 1; + uint32_t nh = 0, k; + static int32_t a[FS / 2]; + drum_setup(); + for (k = 0; k < 27u; k++) + for (song.octave = -3; song.octave <= 3; song.octave++) + ok &= kb_map(dt, k) == 29u + k; + song.octave = 0; + bad += check("DRUM keys: every octave the same notes (key 7 the kick, 36)", ok); + key_dn(KICK_KEY); + run_b(FS / CTL, 0, 0, &nh); + key_upk(KICK_KEY); + run_b(4, 0, 0, &nh); + bad += check("OCT 0: one hit for a held key, nothing held over (no ratchet), no TOUCH", + nh == 1u && !dxo_n[3] && lane(DV_KICK)->dm == 0u); + /* the same hit through the keys and through a plain note-on: bit for bit */ + quiet_kit(); + key_dn(KICK_KEY); + events_block(CTL); + key_upk(KICK_KEY); + eng_render(DV_KICK, FS / 2u); + memcpy(a, abuf, sizeof a); + events_block(CTL); + quiet_kit(); + trk_note_on(dt, 36, 100); + trk_note_off(dt, 36); + eng_render(DV_KICK, FS / 2u); + bad += check("OCT 0: a key's kick renders bit for bit as a plain note-on 36", !memcmp(a, abuf, sizeof a)); + /* recording at OCT 0: the hit, nothing else */ + drum_setup(); + song.rec = 1u << 3; + seq_start(); + nh = 0; + run_b(1, 0, 0, &nh); + key_dn(KICK_KEY); + run_b(2, 0, 0, &nh); + key_upk(KICK_KEY); + run_b(2, 0, 0, &nh); + ok = dt->step[0].hit == 1u << DV_KICK && step_ratchet(&dt->step[0]) == 1u && !dt->step[0].comp && !dt->step[0].comp2; + seq_stop(); + bad += check("REC at OCT 0: the hit alone (x1, no component), as before", ok); + return bad; +} + +/* hits in about `steps` steps of the track's DIV with the key held at OCT o, transport stopped */ +static uint32_t held_stopped(int32_t o, uint32_t steps, uint32_t *at) +{ + uint32_t nh = 0, nb = steps * div_samples((uint32_t)dt->p[P_SDIV]) / CTL - 1u; + drum_setup(); + song.octave = o; + now_s = 0; + key_dn(KICK_KEY); + run_b(nb, at, 64, &nh); + key_upk(KICK_KEY); + return nh; +} +static int up(void) +{ + int bad = 0, ok = 1; + uint32_t at[64], nh, k, per, o; + static const uint8_t R[4] = {1, 2, 4, 8}; + for (o = 1; o <= 3u; o++) { + nh = held_stopped((int32_t)o, 4, at); + per = div_samples((uint32_t)dt->p[P_SDIV]) / R[o]; + ok &= nh == 4u * R[o] && dxo_n[3] == 1u; + for (k = 1; k < nh && k < 64u; k++) { + int32_t d = (int32_t)(at[k] - at[0]) - (int32_t)(k * per); /* (in the block holding its sample) */ + ok &= d > -(int32_t)CTL && d <= 0; + } + for (k = 0; k < NVOICE; k++) + ok &= !dt->v[k].active || dt->v[k].note == 36u; + nh = 0; + run_b(div_samples((uint32_t)dt->p[P_SDIV]) * 2u / CTL, 0, 0, &nh); + ok &= nh == 0u && !dxo_n[3]; + if (!ok) printf("ui: OCT +%u stopped: %u hits in 4 steps\n", o, held_stopped((int32_t)o, 4, at)); + } + bad += check("OCT +1 / +2 / +3 stopped: x2 / x4 / x8 a step from the press, the kick; the release ends it", ok); + /* playing: on the sequencer's grid (a part every step / n from each step's start) */ + ok = 1; + for (o = 1; o <= 3u; o++) { + uint32_t s0, i; + drum_setup(); + song.octave = (int32_t)o; + seq_start(); + now_s = 0; + nh = 0; + run_b(1, 0, 0, &nh); /* (step 1 begins) */ + s0 = now_s - CTL; + key_dn(KICK_KEY); + nh = 0; + run_b((step_len(0) * 4u) / CTL - 1u, at, 64, &nh); + key_upk(KICK_KEY); + ok &= nh == 4u * R[o]; + for (i = 1; i < nh && i < 64u; i++) { /* hit i: part i % n of step i / n */ + uint32_t want = s0 + (i / R[o]) * step_len(0) + (i % R[o]) * (step_len(0) / R[o]); + int32_t d = (int32_t)at[i] - (int32_t)want; + ok &= d >= 0 && d < (int32_t)CTL; + } + seq_stop(); + } + bad += check("OCT +1 / +2 / +3 playing: n hits a step, each on the RATCH grid of the step (to the block)", ok); + return bad; +} + +static double rms_of(uint32_t a, uint32_t b) +{ + double w = 0; + uint32_t i; + for (i = a; i < b; i++) + w += (double)abuf[i] * abuf[i]; + return sqrt(w / (b - a)); +} +static int32_t peak(uint32_t a, uint32_t b) +{ + int32_t p = 0; + uint32_t i; + for (i = a; i < b; i++) + p = abs(abuf[i]) > p ? abs(abuf[i]) : p; + return p; +} +static int down(void) +{ + int bad = 0, ok = 1, okg = 1, okf = 1; + uint32_t len[4], d, l, nh; + int32_t pk[4]; + uint32_t ms = FS / 1000u, at = DXO_FLAM * CTL; + double br[4], r0 = 0, g0, g1; + static const uint8_t NOTE[3] = {36, 38, 42}; /* kick, snare, closed hat */ + drum_setup(); + for (l = 0; l < 3u; l++) { + for (d = 0; d < 4u; d++) { + strike_dmp(NOTE[l], d); + len[d] = hit_len(AN); + br[d] = bright(); + pk[d] = peak(0, AN); + if (!d) + r0 = rms_of(0, 5u * ms); + } + ok &= len[1] < len[0] * 3u / 4u && len[1] > len[0] / 5u && pk[1] * 10 > pk[0] * 8; + okg &= len[2] < len[0] * 3u / 4u && pk[2] * 100 < pk[0] * 55 && br[2] < br[1] * 0.97; + strike_dmp(NOTE[l], 3); /* FLAM: the grace hit, the hit ~20 ms on */ + g0 = rms_of(0, 5u * ms); /* (the first 5 ms of each, RMS) */ + g1 = rms_of(at, at + 5u * ms); + okf &= g0 < g1 * 0.65 && g1 > r0 * 0.65 && hit_len(AN) > len[0] && at > 18u * ms && at < 23u * ms; + printf("ui: note %u: length %u %u %u %u samples, peak %d %d %d, brightness %.4f %.4f %.4f; FLAM grace %.0f, hit %.0f (plain %.0f)\n", + NOTE[l], len[0], len[1], len[2], len[3], pk[0], pk[1], pk[2], br[0], br[1], br[2], g0, g1, r0); + } + bad += check("TOUCH SHORT: under 3/4 of the length, the same level, every lane", ok); + bad += check("TOUCH GHOST: short, under 55 % of the level, darker", okg); + bad += check("TOUCH FLAM: a grace hit under 65 % of the hit, the hit ~20 ms later (a retrigger)", okf); + /* the keys: OCT -1 / -2 / -3 strike with TOUCH 1 / 2 / 3, nothing held over */ + ok = 1; + for (d = 1; d <= 3u; d++) { + drum_setup(); + song.octave = -(int32_t)d; + nh = 0; + key_dn(KICK_KEY); + run_b(FS / 2u / CTL, 0, 0, &nh); + key_upk(KICK_KEY); + run_b(2, 0, 0, &nh); + ok &= nh == 1u && lane(DV_KICK)->dm == d && !dxo_n[3] && !dx_in_tch; + } + bad += check("OCT -1 / -2 / -3: one hit, TOUCH SHORT / GHOST / FLAM on it", ok); + return bad; +} + +/* real-time recording, upper octave: held over steps 2..4, what plays back the pass after is what was heard */ +static int rec_up(void) +{ + int bad = 0, ok = 1; + uint32_t live[32], back[32], nl = 0, nb = 0, k, s2, loop, o; + static const uint8_t R[4] = {1, 2, 4, 8}; + for (o = 1; o <= 3u; o++) { + drum_setup(); + song.octave = (int32_t)o; + song.rec = 1u << 3; + seq_start(); + now_s = 0; + nl = nb = 0; + while (!(dt->seq_idx == 2u && dt->seq_pos < CTL)) /* to step 3's first block (index 2) */ + run_b(1, 0, 0, &nb); + s2 = now_s - CTL; + nb = 0; + key_dn(KICK_KEY); + while (!(dt->seq_idx == 4u && dt->seq_pos + 2u * CTL > step_len(4))) /* held to the end of step 5 */ + run_b(1, live, 32, &nl); + key_upk(KICK_KEY); + while (dt->seq_idx != 1u) /* the rest of the pass */ + run_b(1, 0, 0, &nb); + loop = 0; + for (k = 0; k < 16u; k++) + loop += step_len(k); + for (k = 0; k < 16u; k++) { + const step_t *s = &dt->step[k]; + int has = k >= 2u && k <= 4u; + ok &= has ? s->time == ST_NOTE && s->hit == 1u << DV_KICK && lm_hits(step_lmode(s, DV_KICK)) == R[o] && + !s->comp && step_ratchet(s) == 1u && lane_modes_but(s, DV_KICK) == 0u + : s->time != ST_NOTE || (!s->hit && !s->n); + } + nb = 0; + while (!(dt->seq_idx == 5u)) /* the next pass, steps 3..5 */ + run_b(1, back, 32, &nb); + ok &= nl == 3u * R[o] && nb == nl; + for (k = 0; k < nl && k < nb && k < 32u; k++) { + int32_t d = (int32_t)(back[k] - loop) - (int32_t)live[k]; /* (the press: a block late, as heard) */ + ok &= d >= -(int32_t)CTL && d <= (int32_t)CTL; + } + (void)s2; + if (!ok) printf("ui: REC OCT +%u: %u hits live, %u played back\n", o, nl, nb); + seq_stop(); + } + bad += check("REC OCT +1 / +2 / +3: the kick and the KICK lane's x2 / x4 / x8 in each step held (the step x1); played back as heard", ok); + /* an early release in a step it was held into puts that step back */ + drum_setup(); + song.octave = 1; + song.rec = 1u << 3; + seq_start(); + nb = 0; + while (!(dt->seq_idx == 2u && dt->seq_pos < CTL)) + run_b(1, 0, 0, &nb); + key_dn(KICK_KEY); + while (!(dt->seq_idx == 3u && dt->seq_pos >= CTL)) + run_b(1, 0, 0, &nb); + key_upk(KICK_KEY); + run_b(2, 0, 0, &nb); + ok = step_lmode(&dt->step[2], DV_KICK) == LM_X2 && dt->step[2].hit == 1u << DV_KICK && !dt->step[3].hit && + !step_lm_any(&dt->step[3]) && !dxo_n[3]; + seq_stop(); + bad += check(" let go early in the next step: that step back as it was (one step recorded)", ok); + /* late in a step: into the next one (the sequencer plays its later parts, the live ones stop) */ + drum_setup(); + song.octave = 1; + song.rec = 1u << 3; + seq_start(); + nb = 0; + while (!(dt->seq_idx == 6u && dt->seq_pos > step_len(6) * 3u / 4u)) + run_b(1, 0, 0, &nb); + nl = 0; + key_dn(KICK_KEY); + while (!(dt->seq_idx == 7u && dt->seq_pos + 2u * CTL > step_len(7))) + run_b(1, 0, 0, &nl); + key_upk(KICK_KEY); + run_b(4, 0, 0, &nl); + ok = dt->step[7].hit == 1u << DV_KICK && step_lmode(&dt->step[7], DV_KICK) == LM_X2 && !dt->step[6].hit && !dt->step[8].hit && + nl == 2u; + seq_stop(); + bad += check(" pressed late in a step: into the next (x2), 2 hits heard, as it plays back", ok); + return bad; +} + +static int rec_down(void) +{ + int bad = 0, ok = 1; + uint32_t d, nb, len0, len1; + int32_t pk0; + for (d = 1; d <= 3u; d++) { + drum_setup(); + song.octave = -(int32_t)d; + song.rec = 1u << 3; + seq_start(); + nb = 0; + while (!(dt->seq_idx == 6u && dt->seq_pos < CTL)) + run_b(1, 0, 0, &nb); + key_dn(KICK_KEY - 2u); /* A#: 34, the open hat's octave below (GM 46) */ + run_b(3, 0, 0, &nb); + key_upk(KICK_KEY - 2u); + key_dn(KICK_KEY); + run_b(2, 0, 0, &nb); + key_upk(KICK_KEY); + run_b(2, 0, 0, &nb); + ok &= lane(DV_KICK)->dm == d; + { + const step_t *s = &dt->step[6]; + ok &= s->hit == 1u << DV_KICK && s->n == 1u && s->note[0] == 34u && !s->comp && step_ratchet(s) == 1u && + step_lmode(s, DV_KICK) == LM_SHORT + d - 1u && step_lmode(s, DV_HATO) == LM_SHORT + d - 1u && + lane_modes_but(s, DV_KICK) == (1u << DV_HATO); + } + song.octave = 0; + drum_kit[3][DV_KICK].dm = drum_kit[3][DV_HATO].dm = 0; + while (dt->seq_idx != 7u) /* step 7 again, the next pass: TOUCH d on its hits */ + run_b(1, 0, 0, &nb); + while (dt->seq_idx != 6u) + run_b(1, 0, 0, &nb); + ok &= lane(DV_KICK)->dm == d && lane(DV_HATO)->dm == d && dt->dtch == 0u; + seq_stop(); + } + bad += check("REC OCT -1 / -2 / -3: each lane's SHORT / GHOST / FLAM (a note on its lane too), played back with it", ok); + /* played back, the same sound: the live hit and the sequenced one, the same length */ + drum_setup(); + strike_dmp(38, 2); + len0 = hit_len(AN); + pk0 = peak(0, AN); + quiet_kit(); + dt->step[0] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_SNARE}; + step_set_lmode(&dt->step[0], DV_SNARE, LM_GHOST); + dt->p[P_SLEN] = 64; + seq_start(); + nb = 0; + run_b(2, 0, 0, &nb); + eng_render(DV_SNARE, AN); + seq_stop(); + len1 = hit_len(AN); + ok = nb == 1u && len1 + FS / 100u > len0 && len1 < len0 + FS / 100u && lane(DV_SNARE)->dm == 2u && + peak(0, AN) * 10 > pk0 * 9 && peak(0, AN) * 10 < pk0 * 11; + bad += check(" a GHOST step plays the snare as the live OCT -2 hit (its length within 10 ms, its level 10 %)", ok); + return bad; +} + +static uint32_t mev(uint32_t st, uint32_t note, uint32_t vel) /* a MIDI event on channel 4 (track 4): its hits */ +{ + uint32_t v0 = vage; + midi_event(st, 3, note, vel); + return vage - v0; +} +static uint32_t cnt[128]; /* note-ons by note over run_c */ +static void run_c(uint32_t nb) +{ + uint32_t b, i, a0; + for (b = 0; b < nb; b++) { + a0 = vage; + events_block(CTL); + for (i = 0; i < NVOICE; i++) + if (dt->v[i].active && dt->v[i].age > a0) + cnt[dt->v[i].note & 127u]++; + now_s += CTL; + } +} +/* (0.8.5) per sound: each lane's mode on its own hit only */ +static int per_lane(void) +{ + int bad = 0, ok; + uint32_t nb; + drum_setup(); + dt->p[P_SLEN] = 1; /* a one-step loop: the kick plain, the closed hat x4, the snare GHOST */ + dt->step[0] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK | 1u << DV_HATC | 1u << DV_SNARE}; + step_set_lmode(&dt->step[0], DV_HATC, LM_X4); + step_set_lmode(&dt->step[0], DV_SNARE, LM_GHOST); + seq_start(); + memset(cnt, 0, sizeof cnt); + run_c(1); + ok = lane(DV_KICK)->dm == 0u && lane(DV_SNARE)->dm == 2u && lane(DV_HATC)->dm == 0u; + run_c(step_len(0) / CTL - 1u); /* (the rest of the pass) */ + ok &= cnt[36] == 1u && cnt[38] == 1u && cnt[42] == 4u; + run_c(step_len(0) * 3u / CTL); /* three more passes */ + ok &= cnt[36] == 4u && cnt[38] == 4u && cnt[42] == 16u && lane(DV_KICK)->dm == 0u && lane(DV_SNARE)->dm == 2u; + if (!ok) printf("ui: per lane: kick %u snare %u hat %u\n", cnt[36], cnt[38], cnt[42]); + seq_stop(); + bad += check("per sound: kick plain + closed hat x4 + snare GHOST on one step: 1 + 4 + 1 a pass, the kick not damped", ok); + /* the step's own RATCH x2 still repeats it all, the hat's x4 on top of the first part */ + drum_setup(); + dt->p[P_SLEN] = 1; + dt->step[0] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK}; + step_set_ratchet(&dt->step[0], 2); + seq_start(); + memset(cnt, 0, sizeof cnt); + run_c(step_len(0) / CTL); + seq_stop(); + bad += check(" a step's RATCH x2 as before (lanes without a mode)", cnt[36] == 2u); + /* recorded live: the kick at OCT 0 and the closed hat at OCT +2 into the same step, then the snare at OCT -2 */ + drum_setup(); + song.rec = 1u << 3; + seq_start(); + nb = 0; + while (!(dt->seq_idx == 4u && dt->seq_pos < CTL)) + run_b(1, 0, 0, &nb); + key_dn(KICK_KEY); + run_b(2, 0, 0, &nb); + key_upk(KICK_KEY); + song.octave = 2; + key_dn(KICK_KEY + 6u); /* F#: the closed hat */ + run_b(2, 0, 0, &nb); + key_upk(KICK_KEY + 6u); + song.octave = -2; + key_dn(KICK_KEY + 2u); /* D: the snare */ + run_b(2, 0, 0, &nb); + key_upk(KICK_KEY + 2u); + song.octave = 0; + run_b(2, 0, 0, &nb); + { + const step_t *s = &dt->step[4]; + ok = s->hit == (1u << DV_KICK | 1u << DV_HATC | 1u << DV_SNARE) && step_lmode(s, DV_KICK) == LM_NONE && + step_lmode(s, DV_HATC) == LM_X4 && step_lmode(s, DV_SNARE) == LM_GHOST && step_ratchet(s) == 1u && !s->comp; + } + while (dt->seq_idx != 3u) /* the next pass: step 5 plays them each its own way */ + run_b(1, 0, 0, &nb); + memset(cnt, 0, sizeof cnt); + while (dt->seq_idx != 5u) + run_c(1); + ok &= cnt[36] == 1u && cnt[42] == 4u && cnt[38] == 1u && lane(DV_KICK)->dm == 0u && lane(DV_SNARE)->dm == 2u; + seq_stop(); + bad += check("REC per sound: kick OCT 0, hat OCT +2, snare OCT -2 on one step: the kick 1, the hat x4, the snare GHOST", ok); + /* the grid: KNOB 3 HIT goes -- ON x2 x4 x8 SHORT GHOST FLAM on the selected lane */ + drum_setup(); + go_page(GR_ROLL); + frame(); + ui.lane = DV_HATC; + cursor_set(2); + { + uint32_t k; + ok = grid_on() && grid_hit_of(&dt->step[2], DV_HATC) == 0u; + for (k = 1; k <= LM_N; k++) { + grid_edit(2, 1); + ok &= grid_hit_of(&dt->step[2], DV_HATC) == k && ((dt->step[2].hit >> DV_HATC) & 1u) && + step_lmode(&dt->step[2], DV_HATC) == k - 1u; + } + grid_edit(2, 1); + ok &= step_lmode(&dt->step[2], DV_HATC) == LM_FLAM; + frame(); + ui.lane = DV_KICK; + grid_edit(2, 1); + ok &= step_lmode(&dt->step[2], DV_KICK) == LM_NONE && step_lmode(&dt->step[2], DV_HATC) == LM_FLAM; + ui.lane = DV_HATC; + for (k = 0; k < LM_N; k++) + grid_edit(2, -1); + ok &= !((dt->step[2].hit >> DV_HATC) & 1u) && step_lmode(&dt->step[2], DV_HATC) == LM_NONE && + ((dt->step[2].hit >> DV_KICK) & 1u); + } + bad += check("grid KNOB 3 HIT: -- ON x2 x4 x8 SHORT GHOST FLAM, that lane only; off clears its mode", ok); + /* projects: none of these: the steps packed as 0.8.4 packed them (x bit 6 unset); with one, bit 6 and three bytes */ + { + project_t before, after; + project_store_t a, b; + drum_setup(); + dt->step[1] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK}; + project_capture(&before); + ok = proj_pack(&a, &before) && proj_step_x(&dt->step[1], &nb) == 1u; + step_set_lmode(&dt->step[1], DV_KICK, LM_FLAM); + project_capture(&before); + ok &= proj_pack(&b, &before) && (proj_step_x(&dt->step[1], &nb) & 64u) && proj_step_size(&dt->step[1]) == 2u + 1u + 2u + 3u && + proj_import(&after, &b, sizeof b) && step_lmode(&after.t[3].step[1], DV_KICK) == LM_FLAM; + dt->step[1].lm[0] = 7u; /* (a 7 reads as none) */ + project_capture(&before); + ok &= proj_pack(&b, &before) && proj_import(&after, &b, sizeof b) && step_lmode(&after.t[3].step[1], DV_KICK) == LM_NONE; + bad += check("FUNC: a step without lane modes as before; with them x bit 6 + 3 bytes, round trip; a 7 none", ok); + dt = &trk[3]; + trk[0].step[3] = (step_t){{36}, 1, ST_NOTE, 0, 100, 1u << DV_SNARE}; + project_capture(&before); + proj_pack_vb(&a, &before); + ok = proj_import(&after, &a, sizeof a) && after.t[0].step[3].hit == 1u << DV_SNARE && !step_lm_any(&after.t[0].step[3]); + for (nb = 0; nb < NSTEP; nb++) + ok &= !step_lm_any(&after.t[0].step[nb]) && !step_lm_any(&after.t[3].step[nb]); + bad += check(" an older project (FUNB) loads with no lane modes, its hits as they were", ok); + } + return bad; +} +static int midi(void) +{ + int bad = 0, ok = 1; + uint32_t nb, i; + static const uint8_t GM[6] = {35, 36, 42, 49, 56, 81}; + drum_setup(); + for (i = 0; i < 6u; i++) { + nb = mev(0x90, GM[i], 100); + run_b(FS / 4u / CTL, 0, 0, &nb); + ok &= nb == 1u && !dxo_n[3] && lane(drum_lane(GM[i]))->dm == 0u; + mev(0x80, GM[i], 0); + run_b(1, 0, 0, &nb); + } + bad += check("MIDI 35..81: the GM map as before, one hit, no ratchet, no TOUCH", ok); + ok = drum_oct_of(34) == -1 && drum_oct_of(23) == -1 && drum_oct_of(22) == -2 && drum_oct_of(11) == -2 && + drum_oct_of(10) == -3 && drum_oct_of(0) == -3 && drum_oct_of(82) == 1 && drum_oct_of(93) == 1 && + drum_oct_of(94) == 2 && drum_oct_of(105) == 2 && drum_oct_of(106) == 3 && drum_oct_of(127) == 3; + for (i = 35; i <= 81u; i++) + ok &= drum_oct_of(i) == 0; + ok &= drum_oct_base(84) == 36u && drum_oct_base(24) == 36u && drum_oct_base(90) == 42u && drum_oct_base(0) == 36u; + for (i = 0; i < 128u; i++) /* MIDI OUT's band note comes back as the same sound and octave */ + if (i >= 36u && i <= 47u) + ok &= drum_oct_of(drum_oct_note(i, 1)) == 1 && drum_oct_base(drum_oct_note(i, 1)) == i && + drum_oct_of(drum_oct_note(i, 3)) == 3 && drum_oct_base(drum_oct_note(i, -1)) == i && + drum_oct_of(drum_oct_note(i, -1)) == -1 && drum_oct_of(drum_oct_note(i, -2)) == -2; + bad += check("MIDI bands: ..10 -3, 11..22 -2, 23..34 -1, 35..81 the GM map, 82..93 +1, 94..105 +2, 106.. +3", ok); + ok = 1; + { + static const uint8_t UPN[3] = {84, 96, 108}, R[3] = {2, 4, 8}, DN[3] = {24, 12, 0}; + for (i = 0; i < 3u; i++) { + drum_setup(); + now_s = 0; + nb = mev(0x90, UPN[i], 100); + run_b(4u * div_samples((uint32_t)dt->p[P_SDIV]) / CTL - 1u, 0, 0, &nb); + ok &= nb == 4u * R[i] && dxo_n[3] == 1u; + mev(0x80, UPN[i], 0); + nb = 0; + run_b(div_samples((uint32_t)dt->p[P_SDIV]) * 2u / CTL, 0, 0, &nb); + ok &= nb == 0u && !dxo_n[3]; + nb += mev(0x90, DN[i], 100); + run_b(2, 0, 0, &nb); + mev(0x80, DN[i], 0); + run_b(2, 0, 0, &nb); + ok &= nb == 1u && lane(DV_KICK)->dm == i + 1u; + } + } + bad += check("MIDI 84 / 96 / 108: the kick x2 / x4 / x8 while held; 24 / 12 / 0: the kick SHORT / GHOST / FLAM", ok); + /* MIDI recording */ + drum_setup(); + song.rec = 1u << 3; + seq_start(); + nb = 0; + while (!(dt->seq_idx == 3u && dt->seq_pos < CTL)) + run_b(1, 0, 0, &nb); + mev(0x90, 90, 100); /* F#: the closed hat, +1 */ + run_b(4, 0, 0, &nb); + mev(0x80, 90, 0); + while (!(dt->seq_idx == 5u && dt->seq_pos < CTL)) + run_b(1, 0, 0, &nb); + mev(0x90, 26, 100); /* D: the snare, -1 */ + run_b(2, 0, 0, &nb); + mev(0x80, 26, 0); + run_b(2, 0, 0, &nb); + seq_stop(); + ok = dt->step[3].hit == 1u << DV_HATC && step_lmode(&dt->step[3], DV_HATC) == LM_X2 && !dt->step[4].hit && + dt->step[5].hit == 1u << DV_SNARE && step_lmode(&dt->step[5], DV_SNARE) == LM_SHORT && !dt->step[5].comp; + bad += check("MIDI REC: 90 the closed hat x2, 26 the snare SHORT, each into its step", ok); + { /* FUNC round trip */ + project_t before, after; + project_store_t packed; + project_capture(&before); + ok = proj_pack(&packed, &before) && proj_import(&after, &packed, sizeof packed) && + step_lmode(&after.t[3].step[3], DV_HATC) == LM_X2 && step_lmode(&after.t[3].step[5], DV_SNARE) == LM_SHORT && + after.t[3].step[5].hit == 1u << DV_SNARE && !memcmp(&before, &after, sizeof before); + bad += check(" the recorded steps (the hat x2, the snare SHORT) through a project save and load, every byte", ok); + } + return bad; +} + +static int ui_part(void) +{ + int bad = 0, ok; + drum_setup(); + frame(); + press(B_OCTUP); + ok = song.octave == 1 && msg_is("RATCHET x2"); + press(B_OCTUP); + ok &= song.octave == 2 && msg_is("RATCHET x4"); + press(B_OCTDN); + press(B_OCTDN); + press(B_OCTDN); + ok &= song.octave == -1 && msg_is("SHORT"); + press(B_OCTDN); + ok &= song.octave == -2 && msg_is("GHOST"); + press(B_OCTDN); + ok &= song.octave == -3 && msg_is("FLAM"); + song.octave = 2; + press(B_OCTUP); + ok &= song.octave == 3 && msg_is("RATCHET x8"); + bad += check("OCT on a DRUM track: RATCHET x2 / x4 / x8, SHORT, GHOST, FLAM", ok); + song.octave = 0; + dt->step[2] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK}; + dt->step[2].comp = CP_TOUCH; + dt->step[2].carg = 2; + go_page(GR_COMP); + cursor_set(2); + frame(); + ok = comp_view() == COMP_TOUCH; + bad += check("SEQ > COMP: a TOUCH step shows TOUCH", ok); + dt->step[3] = (step_t){{0}, 0, ST_NOTE, 0, 100, 1u << DV_KICK}; + dt->step[3].comp = CP_ECHO; + dt->step[3].carg = CP_ECHO_EVEN | 6u; + cursor_set(3); + frame(); + comp_knob(2, -1); + ok = comp_view() == COMP_ECHO && dt->step[3].carg == (CP_ECHO_EVEN | 5u); + { + uint32_t dv; + comp_knob(2, 1); + ok &= dt->step[3].carg == (CP_ECHO_EVEN | 6u) && step_parts(dt, &dt->step[3], &dv) == 8u; + } + bad += check("SEQ > COMP: a recorded x8 shows ECHO x8 EVEN; KNOB 3 keeps EVEN", ok); + return bad; +} + +int main(void) +{ + int bad = 0; + bad += centre(); + bad += up(); + bad += down(); + bad += rec_up(); + bad += rec_down(); + bad += midi(); + bad += per_lane(); + bad += ui_part(); + if (bad) { + printf("drumx octaves: %d FAILED\n", bad); + return 1; + } + printf("drumx octaves: all ok\n"); + return 0; +} diff --git a/tests/editor_test.c b/tests/editor_test.c index c04288d1..a5e145e4 100644 --- a/tests/editor_test.c +++ b/tests/editor_test.c @@ -145,7 +145,7 @@ static int preferences(void) int bad = 0; uint8_t a[4] = {0, 7, 0, 0}; reset(); - uint32_t n = request(ED_INFO, a, 0), n0 = n - 3u; /* (0.8.5: the 'Y' tag last, LYRIC) */ + uint32_t n = request(ED_INFO, a, 0), n0 = n - 6u; /* (0.8.5: the 'O' tag, the DRUM lane modes, then 'Y' last, LYRIC) */ bad += check("INFO explicitly tags display capabilities after SONG without changing command 33", ED_SONG == 33 && ED_UI_STATE == 34 && ED_FAV_SET == 38 && host_wire[n0 - 37] == CHAIN_ROWS && host_wire[n0 - 36] == 0x55 && @@ -162,6 +162,7 @@ static int preferences(void) host_wire[n0 - 10] == 0x4C && host_wire[n0 - 9] == 1 && host_wire[n0 - 8] == 1 && /* 1.1 parameter locks */ host_wire[n0 - 7] == 0x56 && host_wire[n0 - 6] == 1 && host_wire[n0 - 5] == 32 && /* (0.6.11) FM6 voice bank */ host_wire[n0 - 4] == 0x4A && host_wire[n0 - 3] == 1 && host_wire[n0 - 2] == 1 && /* (0.6.62) JIANT: the installer */ + host_wire[n - 7] == 0x4F && host_wire[n - 6] == 1 && host_wire[n - 5] == LM_N && /* (0.8.5) DRUM lane modes */ host_wire[n - 4] == 0x59 && host_wire[n - 3] == 1 && host_wire[n - 2] == LYR_LEN - 1u); /* (0.8.5) LYRIC, 63 */ request(ED_UI_SET, a, 2); bad += check("UI_SET updates the actual palette and reports RAM-only saving", @@ -351,6 +352,28 @@ static int steps(void) a[14] = 1; n = request(ED_TRACK_STEP, a, 15); bad += check("TRACK_STEP sets the ratchet of any track (x4, then back to x1)", ok && n == 21u && step_ratchet(&trk[1].step[2]) == 1u && !(trk[1].step[2].flags & SF_RATCH)); + /* (0.8.5, INFO 4F 01 07) the lanes' modes: 8 bytes after the ratchet, in a reply only when asked for */ + memcpy(a, (const uint8_t[]){0, 0, 0, 0, 0, 0, ST_NOTE, 0, 100, 0x09, 0, 0, 100, 1, 0, 0, 0, 2, 0, 0, 0, 0}, 22); + n = request(ED_STEP_SET, a, 22); + ok = n == 28u && step_lmode(&TSEL->step[0], DV_HATC) == LM_X4 && host_wire[n - 9 + DV_HATC] == LM_X4 && + TSEL->step[0].hit == 0x09 && step_ratchet(&TSEL->step[0]) == 1u; + n = request(ED_STEP_SET, a, 14); + ok &= n == 20u && step_lmode(&TSEL->step[0], DV_HATC) == LM_X4; + a[1] = 1; n = request(ED_STEP_GET, a, 2); + ok &= n == 28u && host_wire[n - 9 + DV_HATC] == LM_X4; + n = request(ED_STEP_GET, a, 1); + ok &= n == 20u; + bad += check("STEP_SET / STEP_GET the lanes' modes (8 after the ratchet); without them kept, replies as before", ok); + before = TSEL->step[0]; + memcpy(a, (const uint8_t[]){0, 0, 0, 0, 0, 0, ST_NOTE, 0, 100, 0x09, 0, 0, 100, 1, 0, 0, 0, 7, 0, 0, 0, 0}, 22); + bad += check("STEP_SET refuses a lane mode past 6 and leaves the step", + !request(ED_STEP_SET, a, 22) && !memcmp(&before, &TSEL->step[0], sizeof before)); + memcpy(a, (const uint8_t[]){3, 5, 0, 0, 0, 0, 0, ST_NOTE, 0, 100, 1, 0, 0, 100, 1, 6, 0, 0, 0, 0, 0, 0, 0}, 23); + n = request(ED_TRACK_STEP, a, 23); + ok = n == 29u && step_lmode(&trk[3].step[5], DV_KICK) == LM_FLAM; + a[2] = 1; n = request(ED_TRACK_STEP, a, 3); + bad += check("TRACK_STEP the lanes' modes of any track (FLAM on the kick; a read with 1 replies them)", + ok && n == 29u && host_wire[n - 9 + DV_KICK] == LM_FLAM); return bad; } diff --git a/tests/run_tests.sh b/tests/run_tests.sh index a3ccbba7..142afdf9 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -75,6 +75,10 @@ # Browser emulator (web/emu, when emcc is there): the firmware in WebAssembly (build/emu) boots, plays keys and MIDI, # draws, lights its LEDs, keeps a save across instances, plays a song bit for bit as the same file # built with cc (web/emu/native_check.c); the cost of 1 s of a heavy song against real time. +# DRUM-X OCTAVES (tests/drumx_oct_test.c, 0.8.5): OCT 0 the kit as before (bit for bit); OCT +1 / +2 / +3 ratchets x2 / x4 / +# x8 in time while held (stopped and playing), -1 / -2 / -3 SHORT / GHOST / FLAM (length, level, tone, +# the grace hit measured); real-time REC: the step's RATCH / ECHO x8 EVEN / TOUCH, the pass after the +# very hits heard; MIDI's bands around 35..81, MIDI REC, a project round trip, the OCT message, COMP. # DRUM-X (tests/drumx_test.c): the DRUM engine (src/drumx_voice.c): every lane sounds, stays under full scale and ends, # MORPH A <-> B (also while a hit rings), PITCH, the hat choke, MRPH on the knob; demos in build/drumx_demo/. # NOISE (tests/noise_test.c): the engine (src/eng_noise.c): COLR's slope (white, pink, brown), the filter and the @@ -178,6 +182,8 @@ if [ -f build/gen/felucca_tables.h ]; then run "GEN (0.6.91): the song generator, every genre: deterministic, one scale, the kick anchored, the bass's roots, chord tones, forms, the screen" "$OUT/gen_test" $CC -O1 -w -Ibuild/gen -Ifirmware/src -o "$OUT/ratchet_test" tests/ratchet_test.c -lm run "RATCH: x1..x4 in a step (notes, chords, drum hits), gates, chance, swing, projects, user presets, CHANCE page" "$OUT/ratchet_test" + $CC -O1 -w -Ibuild/gen -Ifirmware/src -o "$OUT/drumx_oct_test" tests/drumx_oct_test.c -lm + run "DRUM-X OCTAVES (0.8.5): ratchets above the kit, SHORT GHOST FLAM below, live, recorded and played back as heard, MIDI bands" "$OUT/drumx_oct_test" $CC -O1 -w -Ibuild/gen -Ifirmware/src -o "$OUT/midi_control_test" tests/midi_control_test.c -lm run "USB/TRS clock, bend, sustain, ownership and panic recovery" "$OUT/midi_control_test" $CC -O1 -w -DFELUCCA_FM4=1 -Ibuild/gen -Ifirmware/src -o "$OUT/digital_test" tests/digital_test.c -lm diff --git a/tests/ui_render.c b/tests/ui_render.c index f50bce92..c849d92c 100644 --- a/tests/ui_render.c +++ b/tests/ui_render.c @@ -659,6 +659,7 @@ enum { S_HOME, S_HOME_IDLE, S_MESSAGE, S_MESSAGE_KEY, S_MESSAGE_NOFILE, S_PRESET S_HEAD_BPM_LOCKED, S_HEAD_GLO_TURN, S_HEAD_DOWNBEAT, S_HEAD_BEAT_2, S_SAVE_LIB, S_SAVE_TOOLS, S_SAVE_PROJ, S_SAVE_ARR, S_SAVE_SOUND, S_SAVE_PRESETS, S_FXL_SENDS, S_FXL_DIST, S_FXL_PAN, S_FXL_BUSES, S_FXL_DELAY, S_FXL_DELAY2, S_FXL_REVERB, S_FXL_SLICER, S_FXL_MASTER, + S_DRUM_X4, S_DRUM_GHOST, S_DRUM_OCT_UP, S_DRUM_OCT_DN, S_COMP_TOUCH, S_COMP_EVEN, S_MIXER_T4, S_HOME_T4, S_MOCK_HOME, S_MOCK_PRESETS, S_MOCK_SEQ, S_MOCK_DRUM, S_MOCK_MIXER, S_MOCK_DIALOG, S_MOCK_MENU, S_COUNT }; static const char *const S_NAME[S_COUNT] = {"home", "home_idle", "message", "message_key", "message_nofile", "presets", "presets_nofav", "user", "phrases", "project", "tools", "song_empty", "song", "step", "pattern", "chance", "comp", "comp_trig", "comp_echo", "mutate", "morph", "dx_image", "dx_send", "page_flash", "page_flash_home", "fugue", "motion", "drum", @@ -684,6 +685,7 @@ static const char *const S_NAME[S_COUNT] = {"home", "home_idle", "message", "mes "save_library", "save_tools", "save_project", "save_arrange", "save_sound", "save_presets", "fx_track_sends", "fx_track_dist", "fx_track_pan", "fx_buses", "fx_effect_delay", "fx_effect_delay2", "fx_effect_reverb", "fx_effect_slicer", "fx_effect_master", + "drum_hit_x4", "drum_hit_ghost", "drum_oct_x8", "drum_oct_flam", "comp_touch", "comp_echo_even", "mixer_tracks4", "home_tracks4", "mock_home", "mock_presets", "mock_seq", "mock_drum", "mock_mixer", "mock_dialog", "mock_menu"}; /* the scenes of the UI design screens: the state the UI-redesign @@ -1334,6 +1336,25 @@ static void setup(int s) lyr_set(song.sel, "SAKURA SAKURA YAYOI NO SORA WA MI WATASU KAGIRI KASUMI KA KUMO"); go_page(GR_LYRIC); name_open(NK_LYRIC, song.sel); nm.cur = 40; nm.key = 3; nm.tap = 1; nm.t = fm1_ms; break; + /* (0.8.5) DRUM-X octaves: the grid's HIT as its modes (the hat on step 3 x4; the snare on step 5 GHOST, the hat + * beside it FLAM); OCT on a DRUM track names the octave (+3 RATCHET x8, -3 FLAM); COMP's TOUCH and ECHO EVEN */ + case S_DRUM_X4: case S_DRUM_GHOST: + drum(0); go_page(GR_ROLL); trk[3].seq_idx = 9; + step_set_lmode(&trk[3].step[2], 3, LM_X4); step_set_lmode(&trk[3].step[4], 1, LM_GHOST); + step_set_lmode(&trk[3].step[4], 3, LM_FLAM); + if (s == S_DRUM_X4) { ui.cursor = 2; ui.lane = 3; } else { ui.cursor = 4; ui.lane = 1; } + break; + case S_DRUM_OCT_UP: case S_DRUM_OCT_DN: + drum(0); go_page(GR_ROLL); ui.cursor = 4; ui.lane = 1; + song.octave = s == S_DRUM_OCT_UP ? 3 : -3; + ui_message(drum_oct_name(song.octave)); + break; + case S_COMP_TOUCH: case S_COMP_EVEN: + drum(0); + trk[3].step[0].comp = s == S_COMP_TOUCH ? CP_TOUCH : CP_ECHO; + trk[3].step[0].carg = s == S_COMP_TOUCH ? 1u : (uint8_t)(2u | CP_ECHO_EVEN); + go_page(GR_COMP); ui.cursor = 0; + break; default: break; } if (s != S_FUGUE) diff --git a/tools/gen_cheatsheets.py b/tools/gen_cheatsheets.py index 21313142..b5af9abe 100644 --- a/tools/gen_cheatsheets.py +++ b/tools/gen_cheatsheets.py @@ -133,7 +133,7 @@ def controls(): ('ALGORITHM', 'Selects the track from any page: T1–T4, or T1–T6 with TRACKS 6.'), ('KNOB 1–4', 'The four columns on screen. Fast sweeps the whole range, slow fine-tunes. With a layer held: ' 'the layer\'s.'), - ('OCT− · OCT+', 'The keyboard\'s octave (both together: back to 0). On action pages and dialogs: back / confirm.'), + ('OCT− · OCT+', 'The keyboard\'s octave (both together: back to 0); on DRUM the kit stays put: +1/+2/+3 ratchet x2/x4/x8, −1 SHORT, −2 GHOST, −3 FLAM, each sound its own (grid KNOB 3 HIT). On action pages and dialogs: back / confirm.'), ('PLAY', 'Start / stop. GLO + PLAY: restart from the top.'), ('REC', 'Arms live recording on the selected track (notes and knob moves, overdub).'), ('HOME', 'Tap: the ecosystem. Hold: the MENU.'), @@ -343,7 +343,7 @@ def sound(): b.append('
') b.append(card('SEQUENCER', HEAT[4], '

64 steps a track, up to 4 notes a step, piano roll and drum grid. LENTE: SELECT zooms PATTERN (the bars; PRESETS the bar) · BAR (the roll / grid) · STEP (one step large, its chips); SEQ taps round the level\'s sets and comes back to the track\'s last. Hold a step + turn a knob: ' - 'a parameter lock. Step recording: hold a chord + KNOB 1 its length; + ARP: arpeggiated (K1 rate, K2 order, K3 oct). COMP / COMP 2: two components a step (CHANCE, RATCH, ARP NOTES / SEQ / SCALE, TRIG, RAND, OCT, TONAL, BEND, ECHO, PULSE, JUMP, REV, FILL, KILL, WALK, CLIMB); a TRIG or FILL wins; WALK / CLIMB: a degree / an octave further every N loops (K4), UP DOWN UP-DN RND over a range (K3), stackable; ARP: ORDER × range, RATE in note values (x1 1/32 1/32T 1/64 1/64T 1/128); RATCH / ECHO: DIV; EVERY (KNOB 4): the loops the step\'s components play on (ALWAYS 1:2 2:2 1:3 .. 4:4 1:8 FIRST !FIRST SKIP). TRACK: PITCH, CHANCE thins the whole track, HUMAN one amount (velocity, timing, gate, decay / release), REC Q. STRETCH / REPEAT act as the knob turns; ROTATE reads the sequence from another step; NOTE\'s MICRO moves a step off the grid. REC + knobs while playing: ' + 'a parameter lock. Step recording: hold a chord + KNOB 1 its length; + ARP: arpeggiated (K1 rate, K2 order, K3 oct). COMP / COMP 2: two components a step (CHANCE, RATCH, ARP NOTES / SEQ / SCALE, TRIG, RAND, OCT, TONAL, BEND, ECHO, PULSE, JUMP, REV, FILL, KILL, WALK, CLIMB, TOUCH: a kit\'s SHORT / GHOST / FLAM); a TRIG or FILL wins; WALK / CLIMB: a degree / an octave further every N loops (K4), UP DOWN UP-DN RND over a range (K3), stackable; ARP: ORDER × range, RATE in note values (x1 1/32 1/32T 1/64 1/64T 1/128); RATCH / ECHO: DIV; EVERY (KNOB 4): the loops the step\'s components play on (ALWAYS 1:2 2:2 1:3 .. 4:4 1:8 FIRST !FIRST SKIP). TRACK: PITCH, CHANCE thins the whole track, HUMAN one amount (velocity, timing, gate, decay / release), REC Q. STRETCH / REPEAT act as the knob turns; ROTATE reads the sequence from another step; NOTE\'s MICRO moves a step off the grid. REC + knobs while playing: ' 'automation (64 records a section, MOTION page plays / clears them, AUTO LIST edits them).

' '

PATTERN · TRACK

' + knobs('LEN', 'DIV', 'SWG', 'GATE') + knobs('PIT', 'CHN', 'HUM', 'RECQ'))) b.append(card('SCALE · ARP', HEAT[0], diff --git a/web/EDITOR_PROTOCOL.md b/web/EDITOR_PROTOCOL.md index 632472e8..dabcff17 100644 --- a/web/EDITOR_PROTOCOL.md +++ b/web/EDITOR_PROTOCOL.md @@ -35,6 +35,9 @@ ends with the item's tab on the device (index and name), after the bytes 1.0.4 s **Ratchet (1.0.5, INFO `52 01 04`):** a step gets a ratchet byte (its hits, 1..4) after its chance: one more byte at the end of the step replies, and an optional last byte of a step write (see "Ratchet" below). Nothing else changed. +**DRUM lane modes (JIANT 0.8.5, INFO `4F 01 07`):** a step gets 8 more bytes after its ratchet, each DRUM lane's mode +0..6 (see "DRUM lane modes" below). Nothing else changed. + **Parameter locks (1.1, INFO `4C 01 01`):** a motion record can be a lock: its value sounds on its step only and goes back after it. `MOTION` (64) gets ops 5..7 (set a lock, clear a step's locks, the query with the kinds); the query and ops 1..4 reply byte for byte as before (see "Parameter locks" below). A lock takes no new bytes in a @@ -208,13 +211,13 @@ at 1..3 and hides 6 5 8: what it sets still plays the right kit, and the device | cmd | Request args | Reply args | | --- | --- | --- | -| 1 INFO | — | version string, NENGINES, P_COUNT, G_COUNT, NSTEP, P_E0, then NENGINES engine-name strings, then (v3) NTRK (6 since JIANT 0.6, 4 before), then (v6) CHAIN_ROWS (16), then the tagged blocks `55 01 uiCaps`, `4D 01 64 01`, `42 01 3`, `46 01 nfactory nbank`, `53 01 3`, (1.0.3) `50 01 3` and (1.0.4) `4E 01 count` (MENU settings; 12, 1.1: 15, 1.2: 17, 1.1.5: 18) and (1.0.5) `52 01 4` (ratchet) and (1.1) `4C 01 1` (parameter locks) and (JIANT 0.6.11) `56 01 32` (FM6's voice bank) (below); older firmware ends earlier | +| 1 INFO | — | version string, NENGINES, P_COUNT, G_COUNT, NSTEP, P_E0, then NENGINES engine-name strings, then (v3) NTRK (6 since JIANT 0.6, 4 before), then (v6) CHAIN_ROWS (16), then the tagged blocks `55 01 uiCaps`, `4D 01 64 01`, `42 01 3`, `46 01 nfactory nbank`, `53 01 3`, (1.0.3) `50 01 3` and (1.0.4) `4E 01 count` (MENU settings; 12, 1.1: 15, 1.2: 17, 1.1.5: 18) and (1.0.5) `52 01 4` (ratchet) and (1.1) `4C 01 1` (parameter locks) and (JIANT 0.6.11) `56 01 32` (FM6's voice bank) and (JIANT 0.6.62) `4A 01 1` (JIANT) and (JIANT 0.8.5) `4F 01 7` (DRUM lane modes) (below); older firmware ends earlier | | 2 GET | scope, id | scope, id, v14 | | 3 SET | scope, id, v14 | scope, id, v14 (the value after clamping). Setting global `G_ENGSEL` (id from DESC label "ENG") changes the engine: its defaults, then its first preset (as on the device) | | 4 DUMP | — | engine, preset, then P_COUNT × v14 (the selected track), then G_COUNT × v14 (globals) | | 5 DESC | scope, id | scope, id, fmt, min v14, max v14, def v14, label string, unit string, then for an enum (fmt 8) one name string per value (at most 32 since 0.7.0; 24 before it, 16 before the matrix) | -| 6 STEP_GET | index 0..NSTEP−1 | index, n (0..4 notes), note0..note3, time (0 NOTE, 1 TIE, 2 REST), flags (1 accent, 2 slide), vel, then (v5) hits (3 bytes, below), then (v7) chance 0..100, then (`52 01`) ratchet 1..4 | -| 7 STEP_SET | index, n, note0..3, time, flags, vel [, hits (3 bytes, v5) [, chance 0..100 (v7) [, ratchet 1..4]]] | same as STEP_GET (after the write). Without the hits the step keeps its own; without the chance or the ratchet it keeps its own. The chance can only follow the hits, the ratchet the chance | +| 6 STEP_GET | index 0..NSTEP−1 | index, n (0..4 notes), note0..note3, time (0 NOTE, 1 TIE, 2 REST), flags (1 accent, 2 slide), vel, then (v5) hits (3 bytes, below), then (v7) chance 0..100, then (`52 01`) ratchet 1..4, then (`4F 01`) 8 lane modes 0..6 | +| 7 STEP_SET | index, n, note0..3, time, flags, vel [, hits (3 bytes, v5) [, chance 0..100 (v7) [, ratchet 1..4 [, 8 lane modes 0..6 (`4F 01`)]]]] | same as STEP_GET (after the write). Without the hits the step keeps its own; without the chance, the ratchet or the lane modes it keeps its own. The chance can only follow the hits, the ratchet the chance, the lane modes the ratchet | | 8 PRESET | engine, preset | engine, preset (applies the preset's sound to the selected track and sends; the steps and the track's own parameters stay, see "Sound loads and undo"). For another track, select it with `TRACK` first | | 9 PROJECT | op (0 load, 1 save, 2 query), slot 0..3 | op, slot, used (1/0). Save writes flash: allow ~2 s; it stops the transport first (see "Saves while playing") | | 10 NAMES | engine | engine, count, count preset-name strings, then the two edit-page titles | @@ -236,7 +239,7 @@ at 1..3 and hides 6 5 8: what it sets still plays the right kit, and the device | 27 TRACK | — (query), or track (select it) | selected track, NTRK, then per track: engine byte, preset, level v14, mute (0/1), armed (0/1, live recording) | | 28 TRACK_MIX | track (get), or track, level v14 (0..127), mute (set) | track, level v14, mute: the track's `P_LEVEL` and `P_MUTE` | | 29 TRACK_DUMP | track | track, engine byte, preset, P_COUNT × v14 (that track's parameters; no globals) | -| 30 TRACK_STEP | track, index (get), or track, index, n, note0..3, time, flags, vel [, hits (v5) [, chance (v7) [, ratchet]]] (set) | track, index, n, note0..3, time, flags, vel, then (v5) hits, then (v7) chance, then (`52 01`) ratchet | +| 30 TRACK_STEP | track, index (get), or track, index, n, note0..3, time, flags, vel [, hits (v5) [, chance (v7) [, ratchet [, 8 lane modes]]]] (set) | track, index, n, note0..3, time, flags, vel, then (v5) hits, then (v7) chance, then (`52 01`) ratchet, then (`4F 01`) 8 lane modes | | cmd (v4) | Request args | Reply args | | --- | --- | --- | @@ -607,6 +610,22 @@ ratchet byte (read every step as 1). before the ratchet refuses a project that holds one. A user preset's note pattern keeps it in its flags (8 | 16); a drum grid record has no room for it and loads x1. +## DRUM lane modes + +INFO advertises `4F 01 7` at the end of its tags (JIANT 0.8.5): each step holds a mode for each of the 8 DRUM lanes +(BD SD CP CH OH TM RS CB), 0 none, 1 x2, 2 x4, 3 x8 (that lane's hit and its notes ratcheted over the step), 4 SHORT, +5 GHOST, 6 FLAM (how it is struck). That lane only: the rest of the step plays as it is. Firmware without the tag has +none (read every lane as 0). + +- `STEP_GET` / `STEP_SET` / `TRACK_STEP`: 8 bytes after the ratchet, lane 0 first. A write without them (an older + editor) keeps the step's; a write with them must carry the chance and the ratchet before. An editor that does not + know them reads the 13 bytes it knows and ignores the rest. +- On the device: what the keys record at OCT ≠ 0 on a DRUM track (and MIDI notes outside 35..81); SEQ > STEP's grid, + KNOB 3 HIT of the selected lane: --, ON, x2, x4, x8, SHORT, GHOST, FLAM. +- Saved in projects (FUNC: bit 6 of a step's extension byte, then 3 bytes, 3 bits a lane; every older project has + none), so in backups and song rows too. Firmware before 0.8.5 refuses a project that holds one (an extension bit it + does not know). User presets' patterns have no room for them. + ## Parameter locks INFO advertises `4C 01 1` after the ratchet tag (`52 01 4`). Firmware without it has no locks. diff --git a/web/editor.html b/web/editor.html index c40f4db8..56bd8a1b 100644 --- a/web/editor.html +++ b/web/editor.html @@ -403,6 +403,10 @@ function readHits(r, o) { if (o.chance > 100) throw new Error("Invalid step chance"); o.ratchet = r.i < r.a.length ? r.b() : 1; /* RATCH (INFO 52 01): the step's hits 1..4; older firmware: 1 */ if (o.ratchet < 1 || o.ratchet > 4) throw new Error("Invalid step ratchet"); + if (r.i + 8 <= r.a.length) { /* (0.8.5, INFO 4F 01 07) each DRUM lane's mode 0..6; older firmware: none */ + o.lanes = []; + for (let l = 0; l < 8; l++) { const m = r.b(); if (m > 6) throw new Error("Invalid step lane mode"); o.lanes.push(m); } + } return o; } @@ -434,6 +438,7 @@ const parse = { o.syncCaps = 0; /* live sync: bit 0 WATCH while on keeps pending pushes, bit 1 no RELOAD */ o.ratchet = 0; /* a step's ratchet (STEP_SET's byte after the chance), 0 = none */ o.fm6Bank = 0; /* (JIANT 0.6.11) FM6's voice bank: its voices (cmds 74..77), 0 = none */ + o.laneModes = 0; /* (JIANT 0.8.5) a step's DRUM lane modes (7: none x2 x4 x8 SHORT GHOST FLAM) */ for (const p of [8, 11]) if (o.motionMax && trailer[p] === 0x46 && trailer[p + 1] === 1) { /* for the editor's */ o.fm6 = { factory: trailer[p + 2], bank: trailer[p + 3], caps: 0 }; /* PRESET / G_ENGSEL */ if (trailer[p + 4] === 0x53 && trailer[p + 5] === 1) o.syncCaps = trailer[p + 6] & 3; @@ -444,6 +449,8 @@ const parse = { if (o.syncCaps && trailer[r] === 0x52 && trailer[r + 1] === 1) { o.ratchet = trailer[r + 2]; r += 3; } /* RATCH: max hits */ if (trailer[r] === 0x4C && trailer[r + 1] === 1) r += 3; /* parameter locks (1.1) */ if (trailer[r] === 0x56 && trailer[r + 1] === 1) o.fm6Bank = trailer[r + 2]; /* (0.6.11) the voice bank's size */ + for (let k = r; k + 2 < trailer.length; k += 3) /* (0.8.5) 'O': the steps' lane modes */ + if (trailer[k] === 0x4F && trailer[k + 1] === 1) { o.laneModes = trailer[k + 2]; break; } } /* (JIANT 0.8.5) 'Y' 1 n, the last tag: LYRIC (cmd 39), a track's lyric of at most n bytes; 0 = none */ const ty = trailer.length - 3; @@ -603,14 +610,16 @@ const req = { set: (scope, id, v) => [CMD.SET, [scope, id, ...v14enc(v)]], dump: () => [CMD.DUMP, []], desc: (scope, id) => [CMD.DESC, [scope, id]], - stepGet: (i) => [CMD.STEP_GET, [i]], + stepGet: (i, lanes) => [CMD.STEP_GET, lanes ? [i, 1] : [i]], /* (0.8.5: lanes, INFO 4F 01: the lanes' modes too) */ stepSet: (i, st) => { const n = Math.max(0, Math.min(4, st.n | 0)); const notes = [0, 1, 2, 3].map((k) => (st.notes[k] | 0) & 0x7F); return [CMD.STEP_SET, [i, n, ...notes, Math.max(0, Math.min(2, st.time | 0)), st.flags & 3, (st.vel | 0) & 0x7F, ...(st.hit == null && st.chance == null ? [] : hitsEnc(st.hit | 0, st.acc | 0)), ...(st.chance == null ? [] : [Math.max(0, Math.min(100, st.chance | 0))]), - ...(st.chance == null || st.ratchet == null ? [] : [Math.max(1, Math.min(4, st.ratchet | 0))])]]; /* (only after the chance) */ + ...(st.chance == null || st.ratchet == null ? [] : [Math.max(1, Math.min(4, st.ratchet | 0))]), /* (only after the chance) */ + ...(st.chance == null || st.ratchet == null || !st.lanes ? [] : /* (0.8.5) the lanes' modes: only after the ratchet, */ + Array.from({ length: 8 }, (_, l) => Math.max(0, Math.min(6, st.lanes[l] | 0))))]]; /* read from a device that has them */ }, preset: (e, p) => [CMD.PRESET, [e & 0x7F, p & 0x7F]], project: (op, slot) => { if (![0, 1, 2].includes(op)) throw new Error("bad PROJECT op"); return [CMD.PROJECT, [op, slot & 3]]; }, /* 0 load, 1 save, 2 query */ @@ -642,7 +651,7 @@ const req = { track: (sel) => [CMD.TRACK, sel == null ? [] : [sel & 0x7F]], trackMix: (tr, level, mute) => [CMD.TRACK_MIX, level == null ? [tr & 0x7F] : [tr & 0x7F, ...v14enc(level), mute ? 1 : 0]], trackDump: (tr) => [CMD.TRACK_DUMP, [tr & 0x7F]], - trackStep: (tr, i, st) => [CMD.TRACK_STEP, st ? [tr & 0x7F, ...req.stepSet(i, st)[1]] : [tr & 0x7F, i & 0x7F]], + trackStep: (tr, i, st, lanes) => [CMD.TRACK_STEP, st ? [tr & 0x7F, ...req.stepSet(i, st)[1]] : lanes ? [tr & 0x7F, i & 0x7F, 1] : [tr & 0x7F, i & 0x7F]], /* v4: get (v == null) or set parameter id (P_*) of track tr, clamped as SET */ trackParam: (tr, id, v) => [CMD.TRACK_PARAM, v == null ? [tr & 0x7F, id & 0x7F] : [tr & 0x7F, id & 0x7F, ...v14enc(v)]], /* FM6 patches (firmware with info.fm6) */ @@ -1815,12 +1824,15 @@ function makeMockDevice(opt = {}) { : { engine: st.engine, name, p: st.p.slice(), pattern: patternFromSteps(st.step), grid: null, fm6 }; }; const ratchetOn = () => !!syncCaps() && !opt.noRatchet; /* (INFO 52 01 04, after the sync tag) */ - const stepOut = (x, b) => { b(x.n); x.notes.forEach(b); b(x.time); b(x.flags); b(x.vel); hitsEnc(x.hit, x.acc).forEach(b); if (!opt.legacy && !opt.v3 && !opt.v5) b(x.chance ?? 100); if (ratchetOn()) b(x.ratchet ?? 1); }; + const lanesOn = () => ratchetOn() && !opt.noLanes; /* (0.8.5, INFO 4F 01 07, after the voice bank) */ + const stepOut = (x, b, lanes) => { b(x.n); x.notes.forEach(b); b(x.time); b(x.flags); b(x.vel); hitsEnc(x.hit, x.acc).forEach(b); if (!opt.legacy && !opt.v3 && !opt.v5) b(x.chance ?? 100); if (ratchetOn()) b(x.ratchet ?? 1); + if (lanes && lanesOn()) for (let l = 0; l < 8; l++) b(x.lanes ? x.lanes[l] : 0); }; /* (0.8.5: asked for, editor.c) */ function stepIn(x, a) { /* editor.c ed_step_put: n, 4 notes, time, flags, vel [, hits (3) [, chance [, ratchet]]] */ x.n = Math.min(4, a[0]); x.notes = a.slice(1, 5); x.time = Math.min(2, a[5]); x.flags = a[6] & 3; x.vel = a[7]; if (a.length >= 11) { x.hit = a[8] | (a[10] & 1) << 7; x.acc = (a[9] | (a[10] & 2) << 6) & x.hit; } if (a.length >= 12) x.chance = Math.min(100, a[11]); if (a.length >= 13 && ratchetOn()) x.ratchet = Math.max(1, Math.min(4, a[12])); + if (a.length >= 21 && lanesOn()) x.lanes = a.slice(13, 21).map((m) => (m > 6 ? 0 : m)); } /* a few user presets to start with, each with its preset's suggested pattern stored (as UP_STORE would) */ [[0, 0, 0, "MY LEAD"], [1, FM6_E, 1, "GLASS BELL"], [2, 2, 3, "PHASE RESO"], [5, 3, 2, "8BIT ARP"]].forEach(([slot, e, p, name]) => { @@ -1985,7 +1997,8 @@ function makeMockDevice(opt = {}) { b(16); if (st.uiCaps) { b(0x55); b(1); b(st.uiCaps); b(0x4d); b(1); b(64); b(1); if (!opt.noFm6) { b(0x46); b(1); b(FM6.FACTORY_PK.length); b(0); } if (syncCaps()) { b(0x53); b(1); b(syncCaps()); if (!opt.noFm6) { b(0x50); b(1); b(3); } if (ratchetOn()) { b(0x52); b(1); b(4); } - if (!opt.noFm6 && !opt.noVbank && ratchetOn()) { b(0x56); b(1); b(32); } } } /* (FM6 v2: no bank, preset patches; 0.6.11: the voice bank) */ + if (!opt.noFm6 && !opt.noVbank && ratchetOn()) { b(0x56); b(1); b(32); } + if (lanesOn()) { b(0x4F); b(1); b(7); } } } /* (FM6 v2: no bank, preset patches; 0.6.11: the voice bank; 0.8.5: the lanes' modes) */ if (st.uiCaps && !opt.noLyric) { b(0x59); b(1); b(63); } /* (0.8.5) LYRIC, the last tag */ } break; @@ -2050,7 +2063,7 @@ function makeMockDevice(opt = {}) { if (a.length < 2 || a[0] >= NTRK || a[1] >= NSTEP) return null; const x = st.tracks[a[0]].step[a[1]]; if (a.length >= 10) stepIn(x, a.slice(2)); - b(a[0]); b(a[1]); stepOut(x, b); + b(a[0]); b(a[1]); stepOut(x, b, a.length === 23 || (a.length === 3 && a[2] === 1)); break; } case CMD.DESC: { @@ -2065,7 +2078,7 @@ function makeMockDevice(opt = {}) { if (a.length < 1 || a[0] >= NSTEP) return null; const x = st.step[a[0]]; if (cmd === CMD.STEP_SET && a.length >= 9) stepIn(x, a.slice(1)); - b(a[0]); stepOut(x, b); + b(a[0]); stepOut(x, b, a.length === 22 || (cmd === CMD.STEP_GET && a.length === 2 && a[1] === 1)); break; } case CMD.FM6B_BEGIN: case CMD.FM6B_WRITE: case CMD.FM6B_END: case CMD.FM6B_LIST: { /* (0.6.11) fm6_vbank.c */ @@ -2873,7 +2886,7 @@ async function sessionRequest(d, r, opt) { const rq = (r, opt) => sessionRequest(dev, r, opt); async function getDesc(scope, id, d = dev) { return parse[CMD.DESC](await sessionRequest(d, req.desc(scope, id))); } async function getDump(d = dev) { const reply = await sessionRequest(d, req.dump()); lastDump = Date.now(); return parse[CMD.DUMP](reply, d.info); } -async function getStep(i, d = dev) { return parse[CMD.STEP_GET](await sessionRequest(d, req.stepGet(i))); } +async function getStep(i, d = dev) { return parse[CMD.STEP_GET](await sessionRequest(d, req.stepGet(i, !!(d && d.info && d.info.laneModes)))); } /* the whole connect sequence */ async function load(d) { diff --git a/web/index_pkg.html b/web/index_pkg.html index 51198d43..6f59c875 100644 --- a/web/index_pkg.html +++ b/web/index_pkg.html @@ -46,6 +46,19 @@


+ +

@@ -114,6 +127,11 @@ const TEXT = { badpkg: "インストールするファイルが壊れています。ページを再読み込みしてください。", leave: "書き込み中です。ページを閉じないでください。", license: "GPL-3.0、無保証。ソース:", + n085Title: "0.8.5 をインストールする前に", + n085What: "0.8.5 の新機能 DRUM-X のオクターブ: 中央のオクターブ (OCT 0) ではキットはこれまでどおり鳴ります。上のオクターブでは同じ音がテンポに合わせたラチェットに(+1 x2、+2 x4、+3 x8)、下では別のタッチに: −1 SHORT(ディケイ半分)、−2 GHOST(短く、弱く、暗く: ゴーストノート)、−3 FLAM(約 20 ms 前に弱い装飾音)。キットの音ごとに別々: ハイハットのラチェットは同じステップのキックを繰り返しません。", + n085Risk: "既存の曲の鳴り方が変わることがあります: DRUM トラックに GM マップ (35–81) の外の MIDI ノート(例えば 24 や 84 以上)を送る設定では、これまでそのオクターブとして鳴っていた音が、これらのバリエーションで鳴ります。OCT を動かした鍵盤は音が変わる代わりにラチェット / SHORT / GHOST / FLAM になります。ステップに保存されたノートはこれまでどおり鳴ります。", + n085Keep: "以前の音を保つには、それらのノートを DAW やシーケンサーで中央のオクターブ (36–47、または GM マップ 35–81) に移してください。インストールの前に、エディターのバックアップ(または下の「公式 V15 に戻す」)でプロジェクトの完全バックアップを保存してください。", + n085Confirm: "0.8.5 では DRUM-X のオクターブが加わり、中央以外のオクターブのドラムノートはラチェット / SHORT / GHOST / FLAM で鳴ります(既存の曲が変わることがあります)。プロジェクトのバックアップは保存しましたか? OK でインストールします。", }, en: { intro: "Connect the FM-1 by USB. (Works in Chrome or Edge.)", @@ -155,6 +173,11 @@ const TEXT = { badpkg: "The file to install is damaged. Reload the page.", leave: "Writing. Do not close the page.", license: "GPL-3.0, no warranty. Source:", + n085Title: "Before you install 0.8.5", + n085What: "New in 0.8.5, DRUM-X octaves: in the centre octave (OCT 0) the kit plays as it always did. In the octaves above, the same sounds ratchet in time (+1 x2, +2 x4, +3 x8); below, they play with another touch: −1 SHORT (half the decay), −2 GHOST (short, softer, darker: ghost notes), −3 FLAM (a soft grace hit ~20 ms before the hit). Each sound of the kit keeps its own: a hi-hat ratchet does not repeat the kick on the same step.", + n085Risk: "Existing songs may sound different: MIDI notes outside the GM map (35–81) sent to a DRUM track, which played as their octave until now (for example 24, or 84 and up), now trigger those variations; keys with OCT moved no longer change the sound, they ratchet / play SHORT / GHOST / FLAM. Notes stored in the steps play as before.", + n085Keep: "To keep the old sound, move those notes to the centre octave (36–47, or the GM map 35–81) in your DAW or sequencer. Before installing, save a complete backup of your projects with the editor (Backup) or with Return to official V15 below.", + n085Confirm: "0.8.5 adds the DRUM-X octaves: drum notes outside the centre octave now play as ratchets / SHORT / GHOST / FLAM (existing songs may change). Have you saved a backup of your projects? OK installs it.", }, }; let lang = (navigator.language || "en").toLowerCase().startsWith("ja") ? "ja" : "en"; @@ -202,9 +225,17 @@ async function loadVersion(i) { $("go").disabled = writing; } catch (e) { if (epoch === loadEpoch) sayK("loadfail", e.message); } } +/* (0.8.5) a release's notice before it is written: 0.8.5 (the DRUM-X octaves change how some drum notes sound), on + * either installer (the preview's and web/STABLE's) whenever the version picked is 0.8.5; never on the landing page */ +function releaseNotice(version) { + return /^v?0\.8\.5(?![0-9])/.test(String(version)) ? "n085" : ""; +} +const noticeOf = () => releaseNotice((versions[+$("ver").value] || versions[0]).version); +const showNotice = () => { $("notice").hidden = !noticeOf(); }; fillVersions(); +showNotice(); $("lang").addEventListener("click", fillVersions); -$("ver").addEventListener("change", () => { if (!writing) loadVersion(+$("ver").value); }); +$("ver").addEventListener("change", () => { showNotice(); if (!writing) loadVersion(+$("ver").value); }); (async () => { if (!navigator.requestMIDIAccess) { sayK("nomidi"); return; } await loadVersion(0); @@ -245,6 +276,8 @@ $("first-stock").addEventListener("click", () => { $("stock").open = true; $("st $("go").addEventListener("click", async () => { if (writing) return; + const nk = noticeOf(); + if (nk && !confirm(t(nk + "Confirm"))) { $("notice").scrollIntoView({ behavior: "smooth" }); return; } lockInstaller(true); let midi; try { midi = await navigator.requestMIDIAccess({ sysex: true }); } diff --git a/web/test_web.mjs b/web/test_web.mjs index 7ad4f558..35335c8b 100644 --- a/web/test_web.mjs +++ b/web/test_web.mjs @@ -38,6 +38,18 @@ function installerCheck() { ok(isJiantInfo(info("FELUCCA v0.6.40", 6, [0x56, 1, 32])), "installer: an older JIANT (six tracks, v0.x) too"); ok(!isJiantInfo(info("FELUCCA 1.5.1", 4, [0x56, 1, 32])), "installer: Felucca 1.x (four tracks) is not"); ok(!isJiantInfo(info("BAUDGIRL 2.0", 4, [])), "installer: another firmware is not"); + /* (0.8.5) the release notice: before 0.8.5 is written, on the preview installer only, in every language it has */ + const ns = html.slice(html.indexOf("function releaseNotice"), html.indexOf("const noticeOf")); + const releaseNotice = vm.runInNewContext(`(${ns.trim()})`); + ok(releaseNotice("v0.8.5-abc1234-preview") === "n085" && releaseNotice("v0.8.5-abc1234") === "n085", + "installer: 0.8.5 picked, preview or the official one: the notice"); + ok(releaseNotice("v0.8.4-abc1234-preview") === "" && releaseNotice("v0.7.4-0123abc") === "" && + releaseNotice("v0.8.50-abc") === "", "installer: another version: none"); + const land = readFileSync(join(HERE, "landing", "index.html"), "utf8"); + ok(!/n085|DRUM-X octave/i.test(land), "installer: the landing page has no notice"); + for (const k of ["n085Title", "n085What", "n085Risk", "n085Keep", "n085Confirm"]) + ok((html.match(new RegExp(`\\b${k}: "`, "g")) || []).length === 2, `installer: ${k} in English and Japanese`); + ok(/
]*>[\s\S]*Aviso antes de instalar 0\.8\.5[\s\S]*backup completo/.test(html), "installer: the notice in Spanish"); } /* ------------------------------------------------------------ editor protocol --- */ @@ -868,6 +880,33 @@ async function editorRatchet() { o.done(); } +/* (0.8.5) the DRUM-X octaves per sound: a step's 8 lane modes (0..6) after its ratchet, INFO 4F 01 07; read, written + * back whole (TRACK_STEP too); an older firmware's replies have none and nothing is sent */ +async function editorLanes() { + const C = E.CMD; + const { rq, done } = attachMock({}); + const info = E.parse[C.INFO](await rq(E.req.info())); + const L = [0, 0, 0, 2, 0, 5, 0, 0]; /* the closed hat x4, the tom GHOST */ + let s = E.parse[C.STEP_SET](await rq(E.req.stepSet(5, { n: 0, notes: [0, 0, 0, 0], time: 0, flags: 0, vel: 100, hit: 0x29, + acc: 0, chance: 100, ratchet: 1, lanes: L }))); + ok(info.laneModes === 7 && JSON.stringify(s.lanes) === JSON.stringify(L) && s.ratchet === 1, "lanes: INFO 4F 01 07, STEP_SET the lanes' modes"); + const back = E.req.stepSet(5, s)[1]; + ok(back.length === 22 && JSON.stringify(back.slice(14)) === JSON.stringify(L), "lanes: a step read is written back whole (22 bytes)"); + s = E.parse[C.STEP_SET](await rq(E.req.stepSet(5, { n: 0, notes: [0, 0, 0, 0], time: 0, flags: 0, vel: 90, hit: 0x29, acc: 0, chance: 100, ratchet: 1 }))); + ok(s.lanes === undefined && JSON.stringify(E.parse[C.STEP_GET](await rq(E.req.stepGet(5, true))).lanes) === JSON.stringify(L), + "lanes: a STEP_SET without them (an older editor) keeps the step's, its reply as before"); + const w = E.parse[C.TRACK_STEP](await rq(E.req.trackStep(3, 7, { n: 0, notes: [0, 0, 0, 0], time: 0, flags: 0, vel: 90, hit: 1, + acc: 0, chance: 100, ratchet: 1, lanes: [3, 0, 0, 0, 0, 0, 0, 0] }))); + ok(w.lanes[0] === 3 && E.parse[C.TRACK_STEP](await rq(E.req.trackStep(3, 7, null, true))).lanes[0] === 3 && + E.parse[C.TRACK_STEP](await rq(E.req.trackStep(3, 7))).lanes === undefined, "lanes: TRACK_STEP the kick x8 on track 4 (asked for)"); + ok(E.parse[C.STEP_GET](await rq(E.req.stepGet(5, true))).lanes[3] === 2 && E.parse[C.STEP_GET](await rq(E.req.stepGet(5))).lanes === undefined, + "lanes: STEP_GET 1 replies them, STEP_GET as before replies as before"); + ok(E.parse[C.STEP_GET]([1, 1, 60, 0, 0, 0, 0, 0, 96, 0, 0, 0, 100, 1]).lanes === undefined && + E.req.stepSet(1, E.parse[C.STEP_GET]([1, 1, 60, 0, 0, 0, 0, 0, 96, 0, 0, 0, 100, 1]))[1].length === 14, + "lanes: an older firmware's step has none, none sent back"); + done(); +} + async function editorLive() { const C = E.CMD; const { m, link, rq, sent, ev, done } = attachMock({ watchMs: 250 }); @@ -1543,6 +1582,7 @@ mockTables(); await editorLibrarian(); await editorGrid(); await editorRatchet(); +await editorLanes(); await editorLive(); await preferenceReplies(); await editorTracks();