Clipper 0.8: JUNO and its chorus, VECTOR, MOD SEQ, SPICE / DICE

- JUNO engine (21): DCO saw / pulse (PWM) / both, sub, noise, the 106's four
  HPF positions, the 24 dB ladder, and the stereo BBD chorus I / II / I+II
  (fx.c juno_chorus, after the INSERT and FILTER); 16 sounds
- the JUNO chorus on any sound: INSERT types JUNO1, JUNO2, JUN12
  (WIDTH, TONE, NOISE)
- VECTOR engine (22): four band-limited waves at the corners of a square
  (16 own waves, tools/gen_vector.py), X / Y, MOVE paths (CIRC, 8, SWEEP,
  LOOP, RND, slow / fast); 16 sounds
- both new engines split across the two cores (bit for bit)
- MOD SEQ: 4 lanes x 16 steps per sound, RATE LEN SMTH START (SYNC / KEY),
  matrix sources SEQ1..SEQ4; MOD SEQ / MOD SEQ 2 pages with SHAPE fills;
  kept in UNDO, COMPARE, SWAP, user presets (note / flags + the bank's side
  record) and projects (free lock slots of tracks 3 and 4)
- SPICE / DICE: deterministic variations (rests, octaves, velocity, gate)
  of the arp's notes and the sequencer's steps
- editor protocol v13: MSEQ_GET / MSEQ_PUT; the editor's MOD SEQ card, the
  new pages, JUNO and VECTOR in the mock
- fix: UP_PUT from the editor wrote SLOOP's layout over a Clipper record
  (and past it)
- tests: synth8, mseq_ui; docs, version 0.8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RDUenQzjQ4Kk2jQVG85bwq
This commit is contained in:
isod89andClaude Opus 5.5 committed 2026-10-17 00:01:27 -04:00
1 parent 059e57b918
commit 2217b8ec47
29 files changed
+2777 -65

No files matched your search

+13 -2
View File
@@ -1,4 +1,4 @@
# Clipper — démarrage rapide (version de test 0.7)
# Clipper — démarrage rapide (version de test 0.8)
**Clipper** est un firmware de **synthétiseur** pour le M-VAVE FM-1 : un seul instrument, comme le firmware d'origine, Felucca ou Baudgirl. Ce n'est plus une groovebox : pas de pistes, pas de boîte à rythmes, pas de mode song, pas de samples intégrés. Il garde de SLOOP les 12 moteurs, les effets, l'arpégiateur, le séquenceur de pas, l'audio USB et le MIDI. Il ajoute **HYBRID**, une voix à 3 oscillateurs, 2 filtres et une matrice de modulation de 16 slots, avec 24 sons d'usine. Il ajoute aussi le pitch bend, la molette, l'aftertouch et la pédale de sustain sur tous les moteurs.
@@ -15,7 +15,7 @@ Clipper vit dans son propre dossier, **`CLIPPER`**, à côté de celui de SLOOP.
| Adresse | http://localhost:**8766** | http://localhost:**8767** |
| Écran de démarrage | voilier, « sloop » | trois-mâts, « clipper » |
Sur la FM-1, Clipper se reconnaît à son écran de démarrage et à HOME (maintenu) → SYS → ABOUT, qui affiche **CLIPPER 0.7**.
Sur la FM-1, Clipper se reconnaît à son écran de démarrage et à HOME (maintenu) → SYS → ABOUT, qui affiche **CLIPPER 0.8**.
## 1. Compiler et installer
@@ -24,6 +24,17 @@ Sur la FM-1, Clipper se reconnaît à son écran de démarrage et à HOME (maint
3. La page d'installation s'ouvre sur http://localhost:8767/webapp/installer/ (Chrome ou Edge, FM-1 en USB). Clique sur **Install**.
4. La FM-1 redémarre sur l'écran **clipper**. Tes projets, presets, samples et réglages de SLOOP sont toujours là.
## Nouveau dans la 0.8 : JUNO et son chorus, VECTOR, un séquenceur de modulation, SPICE / DICE
- **JUNO**, le polyphonique des Roland Juno-6 / 60 / 106 (l'idée, aucun code de Roland) : un DCO par voix avec une **dent de scie**, une **impulsion** dont le LFO fait varier la largeur (PWM : LFO DEST SHP, la molette, SHAPE dans la matrice) ou **les deux** (**S+P**, les deux boutons du 106), un **sub** carré une octave en dessous et du **bruit** ; le **HPF** aux quatre positions du 106 (0 un peu de basses en plus, 1 neutre, 2 et 3 plus fin), le **filtre ladder 24 dB** résonant, et le **chorus** : **I** (0,5 Hz, large), **II** (0,8 Hz, plus profond), **I+II** (8 Hz, léger, les deux boutons du 60 ensemble) : un chorus BBD stéréo, deux prises d'une même ligne balayées en sens opposés, assombries comme un BBD, gauche = son sec + l'une, droite = son sec + l'autre. Changer de mode pendant un accord tenu se fait en fondu (pas de clic). EDIT : WAVE PW SUB NOIS / HPF CUT RES CHOR. 16 sons (nappes, cuivres, cordes, basses, claviers, lead synthwave, un hoover).
- **Le chorus du JUNO sur n'importe quel son** : l'INSERT a trois types de plus, **JUNO1**, **JUNO2**, **JUN12** (A WIDTH, B TONE, C NOISE : le souffle du BBD ; MIX le chorus).
- **VECTOR**, la synthèse vectorielle du Sequential Prophet VS et du joystick du Wavestation : quatre formes d'onde aux coins d'un carré (**A B C D**, 16 formes de Clipper, chacune en trois copies sans repliement), un point dans le carré (**X**, **Y**) les mélange, et **MOVE** fait voyager le point tout seul dès le début de chaque note : CIRC, 8, SWEEP (de A jusqu'au point : l'enveloppe de mixage du VS), LOOP (A B D C), RND, chacun lent ou rapide (+). SHAPE déplace X ; la matrice déplace X et Y par leur nom. Puis un passe-bas 12 dB. EDIT : A B C D / X Y MOVE CUT. 16 sons.
- **MOD SEQ**, un séquenceur de modulation dans chaque son (LFO → **MOD SEQ**, **MOD SEQ 2**) : quatre lignes de 16 pas (-8..7) qui avancent à **RATE** (1/32 à 2 mesures, au tempo), sur **LEN** pas, chaque ligne avec son lissage (**SMTH**), à partir de chaque première touche (**START KEY**) ou sur la grille du morceau (**SYNC**). La matrice les lit comme quatre sources de plus, **SEQ1..SEQ4** : une ligne sur le cutoff, une autre sur la hauteur, un rythme sur le volume, n'importe quel réglage EDIT par son nom. Sur la FM-1 : LANE STEP VALUE et **SHAPE** (RAMP+ RAMP- TRI SINE SQR RND FLAT INVRT SHIFT : tourne pour écouter chaque forme), la ligne dessinée en grand, le pas joué allumé, les quatre lignes en petit dessous. Un son chargé apporte quatre formes de départ (une rampe, un triangle, un rythme, une ligne aléatoire). Gardé avec le son : UNDO, COMPARE, le SWAP du layer, les presets utilisateur, les projets.
- **SPICE / DICE** (ARP → **SPICE**, comme sur l'Arturia MicroFreak) : les notes de l'arpégiateur et les pas du séquenceur varient autant que SPICE le dit : certaines se taisent, d'autres sautent d'une octave, la vélocité et la durée bougent ; toujours de la même façon à chaque tour (16 notes, ou les pas du motif), jusqu'à ce qu'on tourne **DICE** (une autre variation). Ce qui est enregistré ne change jamais. SPICE à 0 : exactement comme avant.
- **L'éditeur web** (protocole 13) : une carte **MOD SEQ** (les quatre lignes en barres à tirer, les formes, LIVE), les nouvelles pages (MOD SEQ 2, SPICE, les types JUNO de l'INSERT), JUNO et VECTOR.
- **Les deux nouveaux moteurs tournent sur les deux cœurs** (au bit près, comme les autres). **392 sons, 23 moteurs.**
- **Corrigé** : un preset utilisateur envoyé depuis l'éditeur web était écrit au format de SLOOP par-dessus l'enregistrement de Clipper (LFO 2, ENV 2, matrice et INSERT perdus, et quelques octets écrits après l'enregistrement).
## Nouveau dans la 0.7 : les deux cœurs, l'historique du son, et le meilleur de SLOOP 2.7
- **Le 2e cœur de la FM-1 calcule la moitié des voix.** Le démarrage du 2e cœur vient de X0X (Charles Vestal), via SLOOP 2.7 (Andre Rezemini), avec le correctif de la 2.7.1. SLOOP partage par piste ; Clipper joue un seul son, donc il partage **les voix d'un même son** : le 1er cœur calcule les modulations, donne la 2e moitié des voix au 2e cœur, calcule la 1re moitié, attend et additionne. Le son est identique au bit près (prouvé par les tests sur ordinateur pour chaque preset). Moteurs partagés : HYBRID, FMX, WAVE, ANALOG, FM6, VPS, TERRAIN, WSEQ, MACRO, STRINGS, TRIO, PHASE, DIGITAL, LOFI. **MENU → SYS → 2ND CORE** ON / OFF ; ABOUT affiche **2 CORES** ou **1 CORE**.
+15 -4
View File
@@ -7,13 +7,24 @@ Free and open source (GPL-3.0). It grew out of <a href="https://github.com/isod8
---
> **Status: 0.7, test build.** Install it at your own risk, and keep a backup made with the editor. You can go back to SLOOP or to the official V15 from the installer page.
> **Status: 0.8, test build.** Install it at your own risk, and keep a backup made with the editor. You can go back to SLOOP or to the official V15 from the installer page.
SLOOP is a groovebox. **Clipper is a synthesizer** with 21 engines and 360 sounds, one instrument (two in MULTI) like the original FM-1 firmware, Felucca and Baudgirl's FM-1+VA. It has no tracks, no drum machine, no song mode and no built-in samples. It keeps SLOOP's 12 sound engines, effects, arpeggiator, step sequencer, USB audio and MIDI, and adds **HYBRID**: one voice built from three oscillators, two filters and a modulation matrix, with the whole patch editable in the browser.
SLOOP is a groovebox. **Clipper is a synthesizer** with 23 engines and 392 sounds, one instrument (two in MULTI) like the original FM-1 firmware, Felucca and Baudgirl's FM-1+VA. It has no tracks, no drum machine, no song mode and no built-in samples. It keeps SLOOP's 12 sound engines, effects, arpeggiator, step sequencer, USB audio and MIDI, and adds **HYBRID**: one voice built from three oscillators, two filters and a modulation matrix, with the whole patch editable in the browser.
## New in 0.8: JUNO and its chorus, VECTOR, a modulation sequencer, SPICE / DICE
- **JUNO**, the poly synth of the Roland Juno-6 / 60 / 106 (the idea, none of Roland's code): one DCO per voice with a **saw**, a **pulse** whose width the LFO sweeps (PWM: LFO DEST SHP, the wheel, the matrix's SHAPE) or both together (**S+P**, the 106's two buttons), a **sub** square an octave down and **noise**; the **HPF** in the 106's four positions (0 a little bass boost, 1 flat, 2 and 3 thinner), the **24 dB resonant ladder** (keyboard tracking, its envelope), and the **chorus**: **I** (0.5 Hz, wide), **II** (0.8 Hz, deeper), **I+II** (8 Hz, shallow, the 60's two buttons together): a stereo BBD chorus, two taps of one line swept in opposite directions, darkened like the bucket brigade, left = dry + one, right = dry + the other. A mode changed under a held chord fades (no click). EDIT: WAVE PW SUB NOIS / HPF CUT RES CHOR. 16 sounds (pads, brass, strings, bass, keys, synthwave lead, a hoover).
- **The JUNO chorus on any sound**: the INSERT has three more types, **JUNO1**, **JUNO2**, **JUN12** (A WIDTH, B TONE, C NOISE: the BBD's hiss, MIX the wet).
- **VECTOR**, vector synthesis after the Sequential Prophet VS and the Wavestation's joystick: four waves at the corners of a square (**A B C D**, 16 of Clipper's own: SINE TRI SAW SQR PLS25 PLS10 ORGAN VOX A VOX O BELL HOLLW BRASS RESO DIGI STRNG METAL, each in three band-limited copies), a point in it (**X**, **Y**) mixes them, and **MOVE** sends the point round a path by itself from each note's start: CIRC, 8, SWEEP (from A to the point: the VS's mix envelope), LOOP (A B D C), RND, each slow or fast (+). SHAPE moves X; the matrix moves X and Y by name. Then a 12 dB low-pass. EDIT: A B C D / X Y MOVE CUT. 16 sounds.
- **MOD SEQ**, a modulation sequencer in every sound (LFO → **MOD SEQ**, **MOD SEQ 2**): four lanes of 16 steps (-8..7) that step at **RATE** (1/32 .. 2 bars, the song's tempo), over **LEN** steps, each lane gliding (**SMTH**), from each first key (**START KEY**) or on the song's grid (**SYNC**). The matrix reads them as four more sources, **SEQ1..SEQ4**: a lane to the cutoff, another to the pitch, a rhythm to the level, any EDIT value by name. On the FM-1: LANE STEP VALUE and **SHAPE** (RAMP+ RAMP- TRI SINE SQR RND FLAT INVRT SHIFT: scroll it to audition), the lane drawn big, the step playing lit, the four lanes small below. A sound loaded brings four shapes to start from (a ramp, a triangle, a rhythm, a random line). Kept with the sound: UNDO, COMPARE, the layer's SWAP, user presets, projects.
- **SPICE / DICE** (ARP → **SPICE**, after the Arturia MicroFreak): the arpeggiator's notes and the sequencer's steps vary as much as SPICE says: some rest, some jump an octave, the velocities and the gates move; the same way each time round (16 notes, or the pattern's steps), until **DICE** is turned (another variation). What is recorded is never changed. SPICE 0: as before, note for note.
- **The web editor** (protocol 13): a **MOD SEQ** card (the four lanes as bars to drag, the shapes, LIVE), the new pages (MOD SEQ 2, SPICE, the INSERT's JUNO types), JUNO and VECTOR.
- **Both new engines run on both cores** (bit for bit, as the others). **392 sounds, 23 engines.**
- **Fixed**: a user preset sent from the web editor was written in SLOOP's layout over Clipper's record (its LFO 2, ENV 2, matrix and INSERT lost, and a few bytes past the record).
## New in 0.7: both cores, a history of the sound, and SLOOP 2.7's best
- **The FM-1's second processor core renders half the voices.** After SLOOP 2.7 (the second core's start-up is [X0X](https://github.com/charlesvestal/fm1-x0x)'s, Charles Vestal, after [Melodee](https://github.com/keremimo/melodee); the HAL came to SLOOP through Andre Rezemini's dualcore branch, 2.7.1's safe hold included). SLOOP splits by track; Clipper plays one sound, so it splits **a sound's voices**: this core works out every voice's modulation, hands the second half of the voices to core 1, renders the first half, waits, adds. Bit for bit the same sound whoever renders what (the host tests prove it for every preset, one core or two, a slow second core, a lost job, under ThreadSanitizer). Engines that may split: HYBRID, FMX, WAVE, ANALOG, FM6, VPS, TERRAIN, WSEQ, MACRO, STRINGS, TRIO, PHASE, DIGITAL, LOFI (the others stay on one core). MENU → SYS → **2ND CORE** ON / OFF; ABOUT says **2 CORES** or **1 CORE**. This is what should make 12 or 16 voices possible: measure with GLO → SYSTEM (CPU, LATE, PEAK).
- **The FM-1's second processor core renders half the voices.** After SLOOP 2.7 (the second core's start-up is [X0X](https://github.com/charlesvestal/fm1-x0x)'s, Charles Vestal, after [Melodee](https://github.com/keremimo/melodee); the HAL came to SLOOP through Andre Rezemini's dualcore branch, 2.7.1's safe hold included). SLOOP splits by track; Clipper plays one sound, so it splits **a sound's voices**: this core works out every voice's modulation, hands the second half of the voices to core 1, renders the first half, waits, adds. Bit for bit the same sound whoever renders what (the host tests prove it for every preset, one core or two, a slow second core, a lost job, under ThreadSanitizer). Engines that may split: HYBRID, FMX, WAVE, ANALOG, FM6, VPS, TERRAIN, WSEQ, MACRO, STRINGS, TRIO, PHASE, DIGITAL, LOFI (0.8: and ACID, JUNO, VECTOR; the others stay on one core). MENU → SYS → **2ND CORE** ON / OFF; ABOUT says **2 CORES** or **1 CORE**. This is what should make 12 or 16 voices possible: measure with GLO → SYSTEM (CPU, LATE, PEAK).
- **UNDO and COMPARE on the FM-1** (EDIT → **UNDO**): every change of the sound becomes a step once it rests (a knob sweep is one step), a sound loaded too; KNOB 1 goes back (left) and forward (right) through up to 16 steps, the page lists them ("-1 CUT RES", "-2 MOOG BASS"); FMX's patch goes with them. KNOB 2 **CMP**: ORIG plays the sound as it was loaded, EDIT your edits again. HOME says **EDITED** when the sound differs from what was loaded, and loading another sound never loses your edits: UNDO brings them back.
- **RANDOM by section**: WHAT now also offers **ENV**, **MOD** (LFOs, matrix amounts), **FX** (and the INSERT's values) and **OPS**: on FMX, the operators themselves (musical ratios, the modulators' levels, envelopes, now and then a wave, the routing's amounts), as the opsix's randomizer.
- **Favourites**: PRESETS page, KNOB 4 right puts the sound at the top of the list (up to 16), left takes it out; kept with the FM-1's settings.
@@ -127,7 +138,7 @@ The voices are a build option: 8 (the default, as SLOOP), 12 or 16 (`INSTALL-CLI
## Tests
`HOST_ONLY=1 tests/run_tests.sh` runs everything that does not need the JieLi toolchain (0.7: the voices on both cores in every mode of the host double of core 1, and under ThreadSanitizer; UNDO, COMPARE, FAV, KBD HOLD): the synth mode (HOME, presets, keys, pages, one instrument, MIDI omni), the HYBRID tests (the pitch of every oscillator, the filters, the matrix, the controllers, 300 random patches, the cost per voice), the editor's commands, golden renders of every sound, ASan and UBSan, a soak test, and the web pages.
`HOST_ONLY=1 tests/run_tests.sh` runs everything that does not need the JieLi toolchain (0.8: JUNO and its chorus, VECTOR, the MOD SEQ, SPICE / DICE, their pages; 0.7: the voices on both cores in every mode of the host double of core 1, and under ThreadSanitizer; UNDO, COMPARE, FAV, KBD HOLD): the synth mode (HOME, presets, keys, pages, one instrument, MIDI omni), the HYBRID tests (the pitch of every oscillator, the filters, the matrix, the controllers, 300 random patches, the cost per voice), the editor's commands, golden renders of every sound, ASan and UBSan, a soak test, and the web pages.
## Credits
+3 -3
View File
@@ -1,4 +1,4 @@
# Clipper 0.7: build the firmware, then open the browser installer.
# Clipper 0.8: build the firmware, then open the browser installer.
# Uses the same tools as SLOOP (WSL MinUI-Build, the JieLi toolchain) and the three AC79 SDK files in
# build\deps\ac79 (copied from the SLOOP folder the first time if they are not here yet).
# Port 8767 (SLOOP uses 8766): a SLOOP window left open does not get mixed up with this one.
@@ -6,7 +6,7 @@ param([string]$Voices = "8")
$ErrorActionPreference = 'Stop'
Set-Location $PSScriptRoot
Write-Host ""
Write-Host " C L I P P E R 0.7 ($Voices voices)" -ForegroundColor White
Write-Host " C L I P P E R 0.8 ($Voices voices)" -ForegroundColor White
Write-Host " ---- ---- ---- ----" -ForegroundColor DarkGray
if ($Voices -notin @("8", "12", "16")) { throw "Voices: 8, 12 or 16" }
$sdk = "build\deps\ac79"
@@ -29,7 +29,7 @@ Remove-Item Env:FELUCCA_SLICE -ErrorAction SilentlyContinue
python tools/build_windows.py --distro MinUI-Build --toolchain /root/fm1-codex-deps/jieli/toolchain --sdk $sdk --slice 0 --nvoice $Voices
if ($LASTEXITCODE -ne 0) { throw "The build failed" }
Write-Host "== Making the installer site" -ForegroundColor Cyan
python web/make_site.py build/felucca.fwsc 0.7 build/clipper-site
python web/make_site.py build/felucca.fwsc 0.8 build/clipper-site
if ($LASTEXITCODE -ne 0) { throw "make_site failed" }
Write-Host ""
Write-Host "Installer: http://localhost:8767/webapp/installer/ (Chrome or Edge, FM-1 on USB)" -ForegroundColor Green
+17 -2
View File
@@ -37,7 +37,7 @@ static inline int voice_poly(int m) { return m == V_POLY || m >= V_PUNI2; } /*
#if FELUCCA_SLICE
#error "SLICE is a groovebox engine (CLIPPER_SYNTH 0)"
#endif
#define CLIPPER_NENG 8 /* WAVE ACID STRINGS MACRO VPS TERRAIN FMX WSEQ */
#define CLIPPER_NENG 10 /* WAVE ACID STRINGS MACRO VPS TERRAIN FMX WSEQ JUNO VECTOR */
#define NENGINES (13 + CLIPPER_NENG)
#define ENGI_WAVE 13u /* Clipper 0.2: wavetables (eng_wave.c) */
#define ENGI_ACID 14u /* a 303-style bass line (eng_acid.c) */
@@ -47,6 +47,8 @@ static inline int voice_poly(int m) { return m == V_POLY || m >= V_PUNI2; } /*
#define ENGI_TERRAIN 18u /* wave terrain, lite (eng_terrain.c, Felucca discussion #146) */
#define ENGI_FMX 19u /* Clipper 0.6: six operators, waves, PM / FM / RING, any routing (eng_fmx.c) */
#define ENGI_WSEQ 20u /* wave sequencing (eng_wseq.c, after the Wavestation) */
#define ENGI_JUNO 21u /* Clipper 0.8: the Juno poly and its chorus (eng_juno.c, fx.c juno_chorus) */
#define ENGI_VECTOR 22u /* vector synthesis: four waves, a joystick (eng_vector.c, after the Prophet VS) */
#else
#define NENGINES (13 + FELUCCA_SLICE)
#endif
@@ -107,6 +109,10 @@ enum { /* per-track parameters */
P_M5SRC, P_M5DST, P_M5AMT,
P_M6SRC, P_M6DST, P_M6AMT,
P_ITYPE, P_IA, P_IB, P_IC, P_IMIX, /* Clipper 0.6: the sound's INSERT (SLOOP 2.6's, fx.c): TYPE, A B C, MIX */
P_MSRATE, P_MSLEN, P_MSSMTH, P_MSKEY, /* Clipper 0.8: the MOD SEQ (voice.c mseq_*): a step's length, steps, glide,
* SYNC (the song's grid) / KEY (from each first key) */
P_SPICE, P_DICE, /* .. SPICE / DICE (seq.c spice_*): how much the arp's and the sequencer's
* notes vary, and which variation */
#endif
P_E0, P_E1, P_E2, P_E3, P_E4, P_E5, P_E6, P_E7,
P_COUNT
@@ -146,7 +152,10 @@ enum { MD_OFF, MD_VIB, MD_CUT, MD_SHP, MD_WAH, MD_TREM };
enum { LY_OFF, LY_LAYER, LY_SPLIT, LY_MULTI }; /* MULTI (0.6): two parts, the layer on its own channel (bi-timbral) */
/* Clipper 0.4: the matrix's sources and destinations (P_MnSRC, P_MnDST; voice.c mod_matrix) */
#define MX_SLOTS 6u
enum { MS_OFF, MS_LFO1, MS_LFO2, MS_ENV1, MS_ENV2, MS_VEL, MS_KEY, MS_MW, MS_AT, MS_RAND, MS_SLIDE, MS_NSRC };
enum { MS_OFF, MS_LFO1, MS_LFO2, MS_ENV1, MS_ENV2, MS_VEL, MS_KEY, MS_MW, MS_AT, MS_RAND, MS_SLIDE,
MS_SEQ1, MS_SEQ2, MS_SEQ3, MS_SEQ4, MS_NSRC }; /* (0.8: the MOD SEQ's four lanes; 4 bits in the stores) */
#define MSEQ_LANES 4u /* Clipper 0.8: the MOD SEQ, per sound: 4 lanes of 16 steps, -8..7 each */
#define MSEQ_STEPS 16u
enum { MT_OFF, MT_PITCH, MT_CUT, MT_SHAPE, MT_AMP, MT_PAN, MT_L2RATE, MT_E1, MT_COUNT = MT_E1 + 8 };
enum { L2_FREE, L2_KEY };
#define CLIPPER_PROJ_MARK 0xC5u /* project_t.rsv[0]: written by Clipper (project.c: + LFO 2, ENV 2, the matrix in track 3's
@@ -322,6 +331,12 @@ typedef struct track {
uint8_t arp_walk; /* (0.7) MODE WALK: the place in the note list it stands on */
uint8_t arp_odd; /* (0.7) stopped: the next arp step is an odd one (its SWG: late) */
uint32_t arp_off; /* units to its note-off */
#if CLIPPER_SYNTH /* Clipper 0.8: the MOD SEQ (voice.c mseq_*), part of the sound */
int8_t ms[MSEQ_LANES][MSEQ_STEPS]; /* the steps, -8..7 */
uint8_t ms_step, ms_held; /* the step playing; keys held last block (KEY: the first one restarts it) */
uint32_t ms_pos; /* units into the step (free running: stopped, or KEY) */
int32_t ms_cur[MSEQ_LANES]; /* each lane's value now (Q15, glided: SMTH) */
#endif
/* sequencer: synth parts step[], the drum track dstep[] (16 lanes) */
union {
step_t step[NSTEP];
+7 -2
View File
@@ -30,7 +30,8 @@ enum { ED_INFO = 1, ED_GET, ED_SET, ED_DUMP, ED_DESC, ED_STEP_GET, ED_STEP_SET,
ED_FM6_GET = 68, ED_FM6_PUT, ED_FM6_LIST, ED_FM6_ERASE }; /* v9: FM6 patches (Felucca's numbers) */
/* v10 (SLOOP 2.5): DSYN_LIST .. DSYN_PLAY = 72..76, editor_dsyn.c; backup object 9 = the SYN kits */
/* v11 (Clipper): HY_GET, HY_PUT = 77, 78, editor_hybrid.c */
#define ED_PROTO (CLIPPER_SYNTH ? 12u : 11u) /* the protocol version INFO ends with (12: Clipper's FMX) */
#define ED_PROTO (CLIPPER_SYNTH ? 13u : 11u) /* the protocol version INFO ends with (12: Clipper's FMX, 13: its
* MOD SEQ, JUNO, VECTOR) */
static uint8_t ed_out[600];
static uint32_t ed_n;
@@ -664,7 +665,7 @@ static void ed_handle(const uint8_t *f, uint32_t n) /* f: the bytes between F0
return;
}
#if CLIPPER_SYNTH
if (ed_fmx_handle(cmd, a, na)) { /* v12: the FMX patches */
if (ed_fmx_handle(cmd, a, na) || ed_mseq_handle(cmd, a, na)) { /* v12: the FMX patches; v13: the MOD SEQ */
ed_send();
return;
}
@@ -894,8 +895,12 @@ static void ed_handle(const uint8_t *f, uint32_t n) /* f: the bytes between F0
if (!rc) {
int16_t v[P_COUNT];
up_values(&r, v); /* each value inside its range */
#if CLIPPER_SYNTH
up_rec_set(&r, v); /* (0.8: the record's own layout; P_COUNT > its p[]) */
#else
for (i = 0; i < P_COUNT; i++)
r.p[i] = v[i];
#endif
rc = ed_flash_busy() ? 3u : up_put(slot, &r) ? 2u : 0u;
}
ed_b(a[0]);
+31
View File
@@ -67,3 +67,34 @@ static int ed_fmx_handle(uint32_t cmd, const uint8_t *a, uint32_t n)
}
return 0;
}
/* v13 (Clipper 0.8): the MOD SEQ's steps of a part (its RATE LEN SMTH START, SPICE, DICE: parameters as any other)
* MSEQ_GET part -> part, rc, 64 bytes (lane 1's 16 steps, then lane 2's ..: each value + 8, 0..15)
* MSEQ_PUT part, 64 bytes -> part, rc the part's steps at once (each clamped to -8..7)
* rc: 0 ok, 1 bad request */
enum { ED_MSEQ_GET = 93, ED_MSEQ_PUT };
static int ed_mseq_handle(uint32_t cmd, const uint8_t *a, uint32_t n)
{
uint32_t i, rc;
switch (cmd) {
case ED_MSEQ_GET:
rc = n != 1u || a[0] >= NPART;
ed_b(n ? a[0] : 127u);
ed_b(rc);
if (!rc)
for (i = 0; i < MSEQ_LANES * MSEQ_STEPS; i++)
ed_b((uint32_t)(trk[a[0]].ms[i / MSEQ_STEPS][i % MSEQ_STEPS] + 8));
return 1;
case ED_MSEQ_PUT:
rc = n != 1u + MSEQ_LANES * MSEQ_STEPS || a[0] >= NPART;
if (!rc) {
for (i = 0; i < MSEQ_LANES * MSEQ_STEPS; i++)
trk[a[0]].ms[i / MSEQ_STEPS][i % MSEQ_STEPS] = (int8_t)clamp((int32_t)a[1u + i] - 8, -8, 7);
ui.force = 1;
}
ed_b(n ? a[0] : 127u);
ed_b(rc);
return 1;
}
return 0;
}
+128
View File
@@ -0,0 +1,128 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 3dSam (Clipper) */
/* JUNO (Clipper 0.8): the poly synth of the Roland Juno-6 / 60 / 106, one of the most loved sounds there is (its
* idea: one DCO with a saw, a pulse whose width the LFO moves, a sub oscillator an octave down and noise; a high-pass
* in four positions; a 24 dB resonant low-pass; and the BBD chorus, I, II or both). No code or sample of Roland's.
* EDIT 1 WAVE PW SUB NOIS EDIT 2 HPF CUT RES CHOR
* WAVE SAW, PLS (the pulse), S+P (both, as the 106's two buttons)
* PW the pulse's width, 50 % (square) .. 5 %; SHAPE (LFO DEST SHP: the PWM, MW / AT SHP, the matrix) moves it
* SUB the square an octave down; NOIS white noise
* HPF 0 a little bass boost, 1 flat, 2 and 3 a high-pass at ~240 and ~720 Hz (the 106's four positions)
* CUT RES the 24 dB ladder (dsp.c, Zavalishin's), keyboard tracking half; ENV DEST FLT its envelope
* CHOR OFF, I (0.5 Hz, wide), II (0.8 Hz, deeper), I+II (8 Hz, shallow: the 60's both buttons): stereo, after the
* sound's INSERT and FILTER (fx.c juno_chorus: one per part; the INSERT's JUNO types give it to any sound)
* The oscillators are band-limited (polyBLEP: dsp.c osc_saw / osc_pulse).
* Voice state: ph[0] the DCO, ph[1] the sub, ph[2] the noise; s[0..3] the ladder, s[4] the HPF's low-pass, s[5] the
* bass boost's */
enum { JW_SAW, JW_PLS, JW_SP };
static const char *const N_JWAVE[] = {"SAW", "PLS", "S+P"};
static const char *const N_JHPF[] = {"0", "1", "2", "3"};
static const char *const N_JCHOR[] = {"OFF", "I", "II", "I+II"};
static void juno_note_on(track_t *t, voice_t *v)
{
(void)t;
if (!v->env && !v->env_out) { /* from silence: the filter clear (a DCO: its phase runs on) */
v->s[0] = v->s[1] = v->s[2] = v->s[3] = v->s[4] = v->s[5] = 0;
if (!v->ph[2])
v->ph[2] = 0x2545F491u + v->note * 2654435761u;
}
}
static void juno_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const vmod_t *m)
{
const int16_t *p = t->p;
uint32_t i, ph = v->ph[0], phs = v->ph[1], nz = v->ph[2], inc = m->inc, incs = inc >> 1;
uint32_t wave = (uint32_t)clamp(p[P_E0], 0, 2), hpf = (uint32_t)clamp(p[P_E4], 0, 3);
int32_t w = clamp(p[P_E1] * 256 + (m->shape - (64 << 8)) * 2, 0, 127 * 256); /* 0 square .. 127 * 256 narrow */
uint32_t pw = 0x80000000u - (uint32_t)w * 59000u; /* 50 % .. ~5 % */
int32_t sub = p[P_E2] * 200, nois = p[P_E3] * 160, hp = v->s[4], bb = v->s[5];
int32_t cut = (p[P_E5] << 8) + m->cutoff + ((v->pitch16 - 60 * 16) << 3);
int32_t ls[4] = {v->s[0], v->s[1], v->s[2], v->s[3]};
ladder_t lad;
ladder_coef(&lad, cut, p[P_E6]);
for (i = 0; i < n; i++) {
int32_t s, y, a;
if (wave == JW_SAW)
s = osc_saw(ph, inc);
else if (wave == JW_PLS)
s = osc_pulse(ph, inc, pw);
else
s = (osc_saw(ph, inc) + osc_pulse(ph, inc, pw)) * 5 >> 3;
if (sub)
s += mulq15(osc_pulse(phs, incs, 0x80000000u), sub);
if (nois) {
nz = nz * 1664525u + 1013904223u;
s += mulq15((int32_t)(nz >> 16) - 32768, nois);
}
ph += inc;
phs += incs;
s = s * 5 >> 3; /* (four sources: headroom) */
if (hpf != 1u) { /* 0: bass boost (a low shelf ~120 Hz); 2, 3: a one-pole high-pass */
if (!hpf) {
bb += ((s - bb) * 560) >> 15;
s += bb >> 1;
} else {
hp += ((s - hp) * (hpf == 2u ? 1120 : 3360)) >> 15;
s -= hp;
}
}
y = ladder_tick(&lad, s, ls) >> 1;
a = y < 0 ? -y : y;
if (a > 16000) {
a = 16000 + (softclip((a - 16000) * 2) >> 1);
y = y < 0 ? -a : a;
}
out[i] += mulq15(mulq15(y << 1, amp_at(m, i)), VOICE_FS) << 1;
}
v->ph[0] = ph;
v->ph[1] = phs;
v->ph[2] = nz;
v->s[0] = ls[0], v->s[1] = ls[1], v->s[2] = ls[2], v->s[3] = ls[3];
v->s[4] = hp;
v->s[5] = bb;
}
static const preset_t JUNO_PRESETS[] = {
/* {WAVE, PW, SUB, NOIS, HPF, CUT, RES, CHOR}, {A D S R}, ENV -> FILTER, mono; extras: the LFO on the PW */
{"JUNO 106 PAD", {JW_SP, 40, 40, 0, 1, 88, 20, 1}, {70, 100, 115, 95}, 10, 0, FX(0, 0, 10, 40),
XP(P_LRATE + 1, 28, P_LD_SHP + 1, 40)},
{"JUNO BRASS", {JW_SAW, 0, 30, 0, 1, 62, 30, 0}, {14, 82, 100, 50}, 40, 0, FX(0, 0, 10, 30)},
{"JUNO BASS", {JW_PLS, 50, 110, 0, 0, 58, 40, 0}, {0, 70, 70, 26}, 36, 1, FX(0, 0, 0, 8), XP(P_GLIDE + 1, 10)},
{"JUNO STRINGS", {JW_SAW, 0, 0, 0, 2, 96, 10, 2}, {80, 100, 120, 96}, 0, 0, FX(0, 0, 10, 50),
XP(P_LRATE + 1, 34, P_LD_SHP + 1, 30)},
{"POLY KEYS", {JW_SP, 30, 20, 0, 1, 70, 24, 1}, {0, 88, 60, 60}, 30, 0, FX(0, 0, 14, 30)},
{"SYNTHWAVE LD", {JW_SAW, 0, 60, 0, 1, 90, 30, 1}, {2, 80, 110, 50}, 10, 1, FX(0, 0, 30, 30),
XP(P_GLIDE + 1, 24, P_LRATE + 1, 70, P_LD_PIT + 1, 3)},
{"80S HITS", {JW_SP, 20, 50, 0, 1, 56, 50, 1}, {0, 64, 0, 40}, 50, 0, FX(0, 0, 20, 30)},
{"JUNO PIANO", {JW_PLS, 60, 30, 0, 2, 50, 20, 1}, {0, 90, 0, 70}, 50, 0, FX(0, 0, 10, 30)},
{"DREAM PAD", {JW_SP, 50, 30, 10, 2, 92, 30, 3}, {90, 100, 120, 110}, 0, 0, FX(0, 0, 20, 70),
XP(P_LRATE + 1, 20, P_LD_SHP + 1, 50)},
{"SUB BASS 106", {JW_PLS, 0, 127, 0, 0, 40, 10, 0}, {0, 80, 110, 20}, 10, 1, FX(0, 0, 0, 4)},
{"SYNTH BRASS 2", {JW_SP, 10, 40, 0, 1, 54, 36, 2}, {20, 86, 96, 56}, 46, 0, FX(0, 0, 12, 34)},
{"ARP PLUCK", {JW_SAW, 0, 40, 0, 2, 44, 50, 1}, {0, 60, 0, 40}, 56, 0, FX(0, 0, 30, 30),
ARP(1, 2, 2, 70)},
{"NOISE SWEEP", {JW_SAW, 0, 0, 127, 3, 40, 90, 3}, {60, 110, 100, 100}, 50, 0, FX(0, 0, 30, 60),
XP(P_LRATE + 1, 10, P_LD_FLT + 1, 50)},
{"JUNO ORGAN", {JW_PLS, 100, 90, 0, 1, 100, 0, 2}, {0, 30, 127, 20}, 0, 0, FX(0, 0, 0, 30)},
{"SAW LEAD 106", {JW_SAW, 0, 30, 0, 1, 82, 44, 0}, {0, 80, 100, 40}, 24, 1, FX(10, 0, 26, 24),
XP(P_GLIDE + 1, 20)},
{"HOOVER JUNO", {JW_PLS, 80, 60, 0, 1, 76, 20, 3}, {0, 90, 110, 50}, 0, 1, FX(10, 0, 10, 30),
XP(P_LRATE + 1, 60, P_LD_SHP + 1, 63, P_GLIDE + 1, 40)},
};
static const engine_t ENG_JUNO = {
"JUNO", {"DCO", "VCF"},
{
{"WAVE", F_ENUM, 0, 2, JW_SP, N_JWAVE, 0},
{"PW", F_PCT, 0, 127, 30, 0, 0},
{"SUB", F_PCT, 0, 127, 40, 0, 0},
{"NOIS", F_PCT, 0, 127, 0, 0, 0},
{"HPF", F_ENUM, 0, 3, 1, N_JHPF, 0},
{"CUT", F_CUTOFF, 0, 127, 90, 0, 0},
{"RES", F_PCT, 0, 127, 20, 0, 0},
{"CHOR", F_ENUM, 0, 3, 1, N_JCHOR, 0},
},
JUNO_PRESETS, sizeof(JUNO_PRESETS) / sizeof(JUNO_PRESETS[0]), 1, juno_note_on, juno_render,
0x4D7F, {P_E5, P_E6, P_E1, P_E7}, 0, 0, 0, 0,
};
+163
View File
@@ -0,0 +1,163 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 3dSam (Clipper) */
/* VECTOR (Clipper 0.8): vector synthesis, after the Sequential Prophet VS and the Korg Wavestation's joystick (the
* idea, not any code or wave of theirs). Four single-cycle waves sit at the corners of a square, A top left, B top
* right, C bottom left, D bottom right; a point in it (X, Y) mixes them, each by its nearness (bilinear: the centre
* an equal mix, a corner its wave alone); MOVE sends the point round a path by itself, from each note's start.
* EDIT 1 A B C D the corners' waves (16 of Clipper's: vector_tables.h, tools/gen_vector.py)
* EDIT 2 X Y MOVE CUT
* X Y the point, -64 (A's side) .. 63; SHAPE (LFO DEST SHP, MW / AT SHP, the matrix's SHP) moves X; the matrix
* moves X or Y themselves (DEST E5, E6: X, Y)
* MOVE OFF; CIRC (a circle round the point); 8 (a figure eight); SWEEP (from A to the point, over the note: the
* VS's mix envelope); LOOP (the square's edge, A B D C, round the point); RND (a smooth random walk). Each slow
* and fast (+): 0.25 Hz / 2 Hz, a sweep of 4 s / 0.5 s
* CUT a 12 dB low-pass (keyboard half), its envelope ENV DEST FLT
* The waves: three band-limited copies each (512 points to the 96th harmonic, 128 to the 24th, 32 to the 6th), the
* voice reading the copy that stays under ~20 kHz at its pitch.
* Voice state: ph[0] the oscillator, ph[1] MOVE's phase (from the note's start), ph[2] RND's generator; s[0..1] the
* SVF, s[2..3] RND's point now, s[4..5] its target, s[6..7] the point at the last block's end (Q15; s[6] < 0: none) */
#include "vector_tables.h"
enum { VM_OFF, VM_CIRC, VM_CIRCF, VM_EIGHT, VM_EIGHTF, VM_SWEEP, VM_SWEEPF, VM_LOOP, VM_LOOPF, VM_RND, VM_RNDF, VM_N };
static const char *const N_VMOVE[VM_N] = {"OFF", "CIRC", "CIRC+", "8", "8+", "SWEEP", "SWP+", "LOOP", "LOOP+", "RND",
"RND+"};
static const uint16_t VEC_OFF[3] = {0, 512, 640};
#define VEC_RADIUS 13107 /* CIRC 8 RND: 0.4 of the square */
static void vector_note_on(track_t *t, voice_t *v)
{
(void)t;
v->ph[1] = 0;
v->s[2] = v->s[3] = v->s[4] = v->s[5] = 0;
v->s[6] = -1;
if (!v->ph[2])
v->ph[2] = 0x2545F491u ^ ((uint32_t)v->note * 2654435761u);
if (!v->env && !v->env_out)
v->s[0] = v->s[1] = 0;
}
/* the point (Q15, 0..32767 each) at this block's end: X Y, SHAPE, MOVE */
static void vector_point(const track_t *t, voice_t *v, const vmod_t *m, uint32_t n, int32_t *px, int32_t *py)
{
const int16_t *p = t->p;
uint32_t mv = (uint32_t)clamp(p[P_E6], 0, VM_N - 1), fast = mv && !(mv & 1u);
uint32_t inc = ((fast ? 6233054u : 779132u) >> CTL_LOG2) * n, ph = v->ph[1];
int32_t x = (clamp(p[P_E4], -64, 63) + 64) * 258 + (m->shape - (64 << 8)), y = (clamp(p[P_E5], -64, 63) + 64) * 258;
int32_t dx = 0, dy = 0;
switch (mv) {
case VM_CIRC: case VM_CIRCF:
dx = mulq15(osc_sine(ph + 0x40000000u), VEC_RADIUS), dy = mulq15(osc_sine(ph), VEC_RADIUS);
break;
case VM_EIGHT: case VM_EIGHTF:
dx = mulq15(osc_sine(ph), VEC_RADIUS), dy = mulq15(osc_sine(ph << 1), VEC_RADIUS * 3 / 4);
break;
case VM_SWEEP: case VM_SWEEPF: { /* from A (0, 0) to the point, eased (1 - (1 - q)^2) */
int32_t q = (int32_t)(ph >> 17), e = 32767 - ((int32_t)(32767 - q) * (32767 - q) >> 15);
x = mulq15(clamp(x, 0, 32767), e), y = mulq15(clamp(y, 0, 32767), e);
if (ph + inc < ph)
inc = 0xFFFFFFFFu - ph; /* (held at its end) */
break;
}
case VM_LOOP: case VM_LOOPF: { /* the square's edge round the point, A B D C, half-side 0.5 */
uint32_t side = ph >> 30;
int32_t f = (int32_t)((ph >> 15) & 0x7FFFu) - 16384; /* -0.5 .. 0.5 along the side */
dx = side == 0 ? f : side == 1 ? 16384 : side == 2 ? -f : -16384;
dy = side == 0 ? -16384 : side == 1 ? f : side == 2 ? 16384 : -f;
break;
}
case VM_RND: case VM_RNDF:
if (ph + inc < ph || v->s[6] < 0) { /* a new target each period */
uint32_t r = v->ph[2] = v->ph[2] * 1664525u + 1013904223u;
v->s[4] = mulq15((int32_t)(r >> 16) - 32768, VEC_RADIUS);
v->s[5] = mulq15((int32_t)(r & 0xFFFFu) - 32768, VEC_RADIUS);
}
v->s[2] += (v->s[4] - v->s[2]) >> (fast ? 2 : 5);
v->s[3] += (v->s[5] - v->s[3]) >> (fast ? 2 : 5);
dx = v->s[2], dy = v->s[3];
break;
default:
break;
}
v->ph[1] = ph + inc;
*px = clamp(x + dx, 0, 32767);
*py = clamp(y + dy, 0, 32767);
}
static void vector_render(track_t *t, voice_t *v, int32_t *out, uint32_t n, const vmod_t *m)
{
const int16_t *p = t->p;
uint32_t i, ph = v->ph[0], inc = m->inc, lv = inc < 20270000u ? 0u : inc < 81100000u ? 1u : 2u;
uint32_t sh = 23u + 2u * lv, mask = (512u >> (2u * lv)) - 1u, fsh = sh - 15u;
const int16_t *wa = VEC_WAVE[(uint32_t)clamp(p[P_E0], 0, VEC_NW - 1)] + VEC_OFF[lv];
const int16_t *wb = VEC_WAVE[(uint32_t)clamp(p[P_E1], 0, VEC_NW - 1)] + VEC_OFF[lv];
const int16_t *wc = VEC_WAVE[(uint32_t)clamp(p[P_E2], 0, VEC_NW - 1)] + VEC_OFF[lv];
const int16_t *wd = VEC_WAVE[(uint32_t)clamp(p[P_E3], 0, VEC_NW - 1)] + VEC_OFF[lv];
int32_t x1, y1, x0, y0, ic1 = v->s[0], ic2 = v->s[1];
int32_t a0, b0, c0, d0, a1, b1, c1, d1, da, db, dc, dd;
tsvf_t flt;
vector_point(t, v, m, n, &x1, &y1);
x0 = v->s[6] < 0 ? x1 : v->s[6], y0 = v->s[6] < 0 ? y1 : v->s[7];
/* the corners' weights at the block's start and end, Q14 (their sum 16384): ramped over the block */
a0 = ((32767 - x0) * (32767 - y0)) >> 16, b0 = (x0 * (32767 - y0)) >> 16, c0 = ((32767 - x0) * y0) >> 16;
d0 = 16383 - a0 - b0 - c0;
a1 = ((32767 - x1) * (32767 - y1)) >> 16, b1 = (x1 * (32767 - y1)) >> 16, c1 = ((32767 - x1) * y1) >> 16;
d1 = 16383 - a1 - b1 - c1;
da = (a1 - a0) / (int32_t)n, db = (b1 - b0) / (int32_t)n, dc = (c1 - c0) / (int32_t)n, dd = (d1 - d0) / (int32_t)n;
tsvf_coef(&flt, (p[P_E7] << 8) + m->cutoff + ((v->pitch16 - 60 * 16) << 3), 24);
for (i = 0; i < n; i++, ph += inc) {
uint32_t k = ph >> sh, k1 = (k + 1u) & mask;
int32_t fr = (int32_t)((ph >> fsh) & 0x7FFFu), s, y;
s = (wa[k] + (((wa[k1] - wa[k]) * fr) >> 15)) * a0;
s += (wb[k] + (((wb[k1] - wb[k]) * fr) >> 15)) * b0;
s += (wc[k] + (((wc[k1] - wc[k]) * fr) >> 15)) * c0;
s += (wd[k] + (((wd[k1] - wd[k]) * fr) >> 15)) * d0;
a0 += da, b0 += db, c0 += dc, d0 += dd;
y = tsvf_lp(&flt, (s >> 14) * 3 >> 2, &ic1, &ic2);
if (y > 16000 || y < -16000)
y = soft_knee(y, 16000);
out[i] += mulq15(mulq15(y << 1, amp_at(m, i)), VOICE_FS) << 1;
}
v->ph[0] = ph;
v->s[0] = ic1;
v->s[1] = ic2;
v->s[6] = x1;
v->s[7] = y1;
}
/* waves: 0 SINE 1 TRI 2 SAW 3 SQR 4 PLS25 5 PLS10 6 ORGAN 7 VOX A 8 VOX O 9 BELL 10 HOLLW 11 BRASS 12 RESO 13 DIGI
* 14 STRNG 15 METAL */
static const preset_t VECTOR_PRESETS[] = {
/* {A, B, C, D, X, Y, MOVE, CUT}, {A D S R}, ENV -> FILTER, mono */
{"VS PAD", {2, 7, 14, 9, 0, 0, VM_CIRC, 100}, {70, 100, 115, 95}, 0, 0, FX(0, 30, 20, 60)},
{"VECTOR SWEEP", {0, 11, 13, 12, 30, 30, VM_SWEEP, 110}, {40, 100, 115, 90}, 0, 0, FX(0, 20, 30, 50)},
{"VS BRASS", {11, 2, 3, 12, -40, -20, VM_OFF, 84}, {16, 84, 100, 50}, 30, 0, FX(0, 0, 10, 30)},
{"GLASS VS", {9, 15, 0, 6, -20, 10, VM_EIGHT, 118}, {10, 100, 90, 80}, 0, 0, FX(0, 40, 30, 60)},
{"VOX MORPH", {7, 8, 10, 1, 0, -10, VM_LOOP, 104}, {50, 100, 115, 90}, 0, 0, FX(0, 30, 20, 60)},
{"DIGI BELLS", {13, 9, 15, 0, 20, 20, VM_RND, 120}, {0, 96, 50, 80}, 0, 0, FX(0, 30, 40, 60)},
{"VS BASS", {2, 3, 4, 0, -50, -50, VM_SWEEPF, 70}, {0, 76, 100, 24}, 30, 1, FX(10, 0, 0, 10)},
{"WAVE LOOP", {3, 13, 12, 5, 0, 0, VM_LOOPF, 108}, {10, 90, 110, 60}, 0, 0, FX(0, 20, 40, 40)},
{"ORGAN DRIFT", {6, 10, 1, 0, -30, 20, VM_RND, 112}, {6, 60, 127, 40}, 0, 0, FX(0, 20, 0, 40)},
{"STRING VS", {14, 2, 7, 10, 10, -10, VM_CIRC, 96}, {80, 100, 120, 100}, 0, 0, FX(0, 40, 20, 70)},
{"METAL HIT", {15, 9, 13, 12, 40, -30, VM_SWEEPF, 120}, {0, 80, 0, 70}, 0, 0, FX(0, 20, 30, 60)},
{"HOLLOW KEYS", {10, 1, 6, 4, -20, -20, VM_OFF, 98}, {0, 88, 60, 60}, 20, 0, FX(0, 20, 20, 40)},
{"RESO VECTOR", {12, 2, 5, 11, 0, 0, VM_EIGHTF, 100}, {0, 90, 110, 50}, 10, 0, FX(0, 0, 30, 40)},
{"SPACE DRONE", {9, 13, 7, 15, 0, 0, VM_RND, 110}, {110, 100, 127, 120}, 0, 0, FX(0, 50, 30, 90)},
{"VS LEAD", {2, 11, 4, 12, -10, -40, VM_CIRCF, 104}, {0, 80, 110, 40}, 10, 1, FX(10, 0, 30, 30),
XP(P_GLIDE + 1, 16)},
{"CHOIR VS", {7, 8, 0, 10, 0, 20, VM_SWEEP, 100}, {90, 100, 120, 100}, 0, 0, FX(0, 40, 20, 80)},
};
static const engine_t ENG_VECTOR = {
"VECTOR", {"WAVES", "JOYSTICK"},
{
{"A", F_ENUM, 0, VEC_NW - 1, 2, N_VEC_WAVE, 0},
{"B", F_ENUM, 0, VEC_NW - 1, 7, N_VEC_WAVE, 0},
{"C", F_ENUM, 0, VEC_NW - 1, 14, N_VEC_WAVE, 0},
{"D", F_ENUM, 0, VEC_NW - 1, 9, N_VEC_WAVE, 0},
{"X", F_BIPCT, -64, 63, 0, 0, 0},
{"Y", F_BIPCT, -64, 63, 0, 0, 0},
{"MOVE", F_ENUM, 0, VM_N - 1, VM_CIRC, N_VMOVE, 0},
{"CUT", F_CUTOFF, 0, 127, 100, 0, 0},
},
VECTOR_PRESETS, sizeof(VECTOR_PRESETS) / sizeof(VECTOR_PRESETS[0]), 1, vector_note_on, vector_render,
0x6B3F, {P_E4, P_E5, P_E7, P_E6}, 0, 0, 0, 0,
};
+5 -1
View File
@@ -42,6 +42,8 @@ static int32_t vs_buf[CTL] __attribute__((aligned(8)));
#include "eng_terrain.c" /* TERRAIN: wave terrain, lite (Clipper 0.5) */
#include "eng_fmx.c" /* FMX: six operators, waves, PM / FM / RING, any routing (Clipper 0.6) */
#include "eng_wseq.c" /* WSEQ: wave sequencing (Clipper 0.6) */
#include "eng_juno.c" /* JUNO: the Juno poly, its chorus in fx.c (Clipper 0.8) */
#include "eng_vector.c" /* VECTOR: vector synthesis (Clipper 0.8) */
#endif
typedef union {
@@ -92,11 +94,13 @@ static const engine_t *const ENGINES[NENGINES] = {&ENG_ANALOG, &ENG_DIGITAL, &EN
&ENG_ACID, &ENG_STRINGS, &ENG_MACRO, /* 14, 15, 16 */
&ENG_VPS, &ENG_TERRAIN, /* 17, 18 */
&ENG_FMX, &ENG_WSEQ, /* 19, 20 */
&ENG_JUNO, &ENG_VECTOR, /* 21, 22 */
#endif
};
#if CLIPPER_SYNTH
_Static_assert(ENGI_WAVE == 13u && ENGI_ACID == 14u && ENGI_STRINGS == 15u && ENGI_MACRO == 16u && ENGI_VPS == 17u &&
ENGI_TERRAIN == 18u && ENGI_FMX == 19u && ENGI_WSEQ == 20u, "ENGINES[] order (Clipper)");
ENGI_TERRAIN == 18u && ENGI_FMX == 19u && ENGI_WSEQ == 20u && ENGI_JUNO == 21u && ENGI_VECTOR == 22u,
"ENGINES[] order (Clipper)");
/* (eng_wave.c) the table of the instrument: track 1's, else its layer's (one table in RAM: two WAVE sounds share
* track 1's); while a sound fades out after a change (voice.c sound_fade_begin) its table stays */
static int32_t wt_wanted(void)
+127 -2
View File
@@ -578,7 +578,8 @@ static void tflt_run(djf_t *f, const tsvf_t *c, int32_t *b, uint32_t n, uint32_t
* as before (nothing runs). MIX glides (2.9 ms, SL_SLOPE); a TYPE change fades the old one out, clears the state,
* fades the new one in; so does a start from MIX 0 (no stale line or filter).
* State in RAM (.bss): 580 B a sound; noinline, its own loops */
enum { IT_OFF, IT_SOFT, IT_HARD, IT_FOLD, IT_FUZZ, IT_CRUSH, IT_PHASER, IT_FLANGER, IT_CHORUS, IT_N };
enum { IT_OFF, IT_SOFT, IT_HARD, IT_FOLD, IT_FUZZ, IT_CRUSH, IT_PHASER, IT_FLANGER, IT_CHORUS,
IT_JUNO1, IT_JUNO2, IT_JUNO12, IT_N }; /* (0.8: the JUNO chorus, juno_chorus below: the INSERT passes them) */
_Static_assert(IT_N == sizeof N_ITYPE / sizeof N_ITYPE[0], "the INSERT's types as params.c names them");
_Static_assert(P_IA == P_ITYPE + 1 && P_IC == P_ITYPE + 3 && P_IMIX == P_ITYPE + 4, "the INSERT's values in order");
#define IL_LEN 256u /* FLANG / CHOR: the line, samples (a power of 2: masked) */
@@ -756,6 +757,8 @@ static __attribute__((noinline)) void ins_swept(ins_t *s, const int16_t *p, int3
static __attribute__((noinline)) int ins_run(ins_t *s, const int16_t *p, int32_t *b, uint32_t n)
{
int32_t ty = clamp(p[P_ITYPE], 0, IT_N - 1), tw;
if (ty >= IT_JUNO1)
ty = IT_OFF; /* the JUNO chorus: not here (juno_chorus, after the FILTER) */
if (s->type != ty && !s->w) /* faded out: the new type from rest */
s->type = (uint8_t)ty;
tw = s->type == ty && ty ? ins_mixq(p[P_IMIX]) : 0;
@@ -782,6 +785,109 @@ static __attribute__((noinline)) void ins_rest(track_t *t)
memset(&ins[(uint32_t)(t - trk) % NPART], 0, sizeof(ins_t));
t->ins_run = 0;
}
/* ---- the JUNO chorus (Clipper 0.8): the stereo BBD chorus of the Juno-60 / 106, its idea and its published
* measurements (no code of anyone's): one line, two taps whose delays a triangle LFO sweeps in opposite directions,
* each tap low-passed as a BBD's, left = dry + tap 1, right = dry + tap 2.
* I 0.513 Hz, 1.66 .. 5.35 ms II 0.863 Hz, the same range I+II 9.75 Hz, 3.3 .. 3.7 ms
* Its mode: the JUNO engine's CHOR, else the INSERT's types JUNO1 JUNO2 JUN12 (any sound; then MIX the wet, A WIDTH,
* B TONE, C NOISE: the BBD's hiss). Mode changes fade out (2.9 ms), clear the line, fill it (5.8 ms), fade in. 532 B a
* part (.bss);
* the stereo half (left - right) in jc_side for mix_part1's level loop; off: nothing runs */
#define JC_LEN 256u /* the line: 5.8 ms (a power of 2: masked), at a quarter (headroom) */
typedef struct {
int32_t w; /* the wet now, Q15 */
uint32_t ph, nz; /* the LFO's phase; the hiss */
int32_t l1, l2; /* each tap's low-pass */
uint16_t wp; /* the line's next write */
uint8_t mode; /* running: 1 I, 2 II, 3 I+II */
uint16_t fill; /* samples left before it fades in (the line full of the sound first) */
uint8_t idle; /* the part was silent (mix_part1 did not run it): a new mode at once */
int16_t line[JC_LEN];
} jc_t;
static jc_t jc[NPART];
static int32_t jc_side[CTL];
static const uint32_t JC_INC[3] = {49962u, 84048u, 949577u}; /* 0.513, 0.863, 9.75 Hz at 44.1 kHz */
static int32_t jc_mode(const track_t *t, int32_t *wet, int32_t *width, int32_t *tone, int32_t *hiss)
{
const int16_t *p = t->p;
int32_t m = t->engine == ENGI_JUNO ? clamp(p[P_E7], 0, 3) : 0;
*wet = 32768, *width = 127, *tone = 100, *hiss = 0;
if (!m && p[P_ITYPE] >= IT_JUNO1 && p[P_ITYPE] <= IT_JUNO12) {
m = p[P_ITYPE] - IT_JUNO1 + 1;
*wet = ins_mixq(p[P_IMIX]);
*width = clamp(p[P_IA], 0, 127), *tone = clamp(p[P_IB], 0, 127), *hiss = clamp(p[P_IC], 0, 127);
}
return *wet ? m : 0;
}
/* the part silent: a chorus whose mode is no longer asked for stops at once (nothing to fade: the next note dry) */
static void jc_idle(const track_t *t)
{
jc_t *c = &jc[(uint32_t)(t - trk) % NPART];
int32_t a, b, d, e;
c->idle = 1;
if (c->mode && jc_mode(t, &a, &b, &d, &e) != c->mode)
c->w = 0, c->mode = 0;
}
/* the chorus on the part's block b (mono in, its mid back in b, its side in jc_side): 1 when it ran */
static __attribute__((noinline)) int juno_chorus(track_t *t, int32_t *b, uint32_t n)
{
jc_t *c = &jc[(uint32_t)(t - trk) % NPART];
int32_t wet, width, tone, hiss, m = jc_mode(t, &wet, &width, &tone, &hiss), tw, w, l1, l2, k;
uint32_t i, ph, wp, inc, base, span;
int16_t *line = c->line;
if (c->mode != m && (!c->w || c->idle)) { /* faded out (or silent): the new mode from rest */
memset(c, 0, sizeof *c);
c->mode = (uint8_t)m;
c->nz = 0x2545F491u;
c->fill = JC_LEN; /* (an empty line read back: a step when the sound reaches it) */
}
c->idle = 0;
if (!c->mode)
return 0;
tw = c->mode == m ? wet : 0;
k = ins_lpk(tone) >> 1; /* Q15 */
inc = JC_INC[c->mode - 1u];
if (c->mode == 3u)
base = 9535488u, span = 18u; /* 145.5 + 0 .. 17.7 samples (Q16) */
else
base = 4797235u, span = 163u; /* 73.2 + 0 .. 163 samples */
w = c->w, ph = c->ph, wp = c->wp, l1 = c->l1, l2 = c->l2;
width = width * 258;
hiss = hiss * hiss / 96; /* (a gentle curve: 96 a faint hiss, 127 the BBD's) */
for (i = 0; i < n; i++, ph += inc) {
int32_t x = b[i], tr = (int32_t)ins_tri(ph), v1, v2, r0, fr, g, md, sd;
uint32_t d1 = base + span * (uint32_t)tr, d2 = base + span * (uint32_t)(65535 - tr);
if (c->fill)
c->fill--;
else
w += clamp(tw - w, -SL_SLOPE, SL_SLOPE);
r0 = (int32_t)(wp - (d1 >> 16)) & (int32_t)(JC_LEN - 1u), fr = (int32_t)((d1 >> 1) & 0x7FFFu);
v1 = line[r0] + (((line[(r0 - 1) & (int32_t)(JC_LEN - 1u)] - line[r0]) * fr) >> 15);
r0 = (int32_t)(wp - (d2 >> 16)) & (int32_t)(JC_LEN - 1u), fr = (int32_t)((d2 >> 1) & 0x7FFFu);
v2 = line[r0] + (((line[(r0 - 1) & (int32_t)(JC_LEN - 1u)] - line[r0]) * fr) >> 15);
l1 += ((v1 - l1) * k) >> 15; /* the BBD's dark */
l2 += ((v2 - l2) * k) >> 15;
{
int32_t in = clamp(x >> 2, -32767, 32767);
if (hiss) {
c->nz = c->nz * 1664525u + 1013904223u;
in += (((int32_t)(c->nz >> 16) - 32768) * hiss) >> 15;
}
line[wp] = (int16_t)clamp(in, -32767, 32767);
}
wp = (wp + 1u) & (JC_LEN - 1u);
g = 32768 - ((w * 9830) >> 15); /* 1 dry .. 0.7 at full wet */
md = x + mulq15((l1 + l2) << 1, w); /* dry + (tap 1 + tap 2) / 2 (the taps at a quarter) */
sd = mulq15(mulq15((l1 - l2) << 1, w), width); /* (tap 1 - tap 2) / 2 */
b[i] = mulq15(md, g);
jc_side[i] = mulq15(sd, g);
}
c->w = w, c->ph = ph, c->wp = (uint16_t)wp, c->l1 = l1, c->l2 = l2;
if (!w && c->mode != m)
c->mode = 0; /* (faded out: the next block takes the new one) */
return 1;
}
#endif
/* (0.7, SLOOP 2.7's, after JIANT FM 0.6.8, github.com/juanjiant-bit/JIANT) LEVEL and PAN glide: a knob's detent (or a
@@ -804,11 +910,13 @@ static void mix_part1(track_t *t, uint32_t n)
if (track_render(t, b, n))
t->tail = t->p[P_ITYPE] ? 64 : 16, t->ins_xt = 0; /* blocks of DIST / INSERT state to run out after the last
* voice (the INSERT's: 46 ms, a flanger's feedback) */
else if ((!t->tail || !(t->p[P_DIST] | t->p[P_ITYPE]) || !--t->tail) && !slicer_busy(t) &&
else if ((!t->tail || !(t->p[P_DIST] | t->p[P_ITYPE] | jc[(uint32_t)(t - trk) % NPART].w) || !--t->tail) &&
!slicer_busy(t) &&
!(t->ins_run && t->ins_res > 16u && t->ins_xt < 255u && ++t->ins_xt)) { /* (the INSERT's DC blocker
* run out first, up to 255 blocks more: no step) */
if (t->ins_run && !t->p[P_ITYPE])
ins_rest(t); /* TYPE OFF while silent: no fade-out left for the next note */
jc_idle(t); /* (0.8: the JUNO chorus the same) */
slicer_track(t, 0, n);
return;
}
@@ -849,6 +957,9 @@ static void mix_part1(track_t *t, uint32_t n)
if (djf_block(f, t->p[P_TFLT], &fc))
tflt_run(f, &fc, b, n, 0);
}
#if CLIPPER_SYNTH
const int32_t *side = juno_chorus(t, b, n) ? jc_side : 0; /* (0.8) the JUNO chorus: stereo */
#endif
int32_t lvl0, dl, gl0, dgl, gr0, dgr; /* (0.7, after SLOOP 2.7) LEVEL (and a new sound's trim) and PAN
* glide (mix_glide), ramped sample by sample inside the block */
if (!t->mix_on)
@@ -876,6 +987,20 @@ static void mix_part1(track_t *t, uint32_t n)
if (r)
send_r[i] += mulq15(xs, r);
gl = gl0 + ((dgl * (int32_t)i) >> CTL_LOG2), gr = gr0 + ((dgr * (int32_t)i) >> CTL_LOG2); /* (0.7) */
#if CLIPPER_SYNTH
if (side) { /* the chorus's left - right, through the same level */
#if NVOICE > 8
int32_t sd = ((side[i] >> 3) * (lvl0 + dl * (int32_t)i)) >> 9;
#else
int32_t sd = ((side[i] >> 2) * (lvl0 + dl * (int32_t)i)) >> 10;
#endif
if (g < 32767)
sd = (sd >> 4) * (g >> 3) >> 8;
mix_l[i] += (((x + sd) >> 4) * gl) >> 8;
mix_r[i] += (((x - sd) >> 4) * gr) >> 8;
continue;
}
#endif
mix_l[i] += ((x >> 4) * gl) >> 8; /* (x may pass 2^19: >> 4 first) */
mix_r[i] += ((x >> 4) * gr) >> 8;
}
+24 -5
View File
@@ -36,7 +36,8 @@ static const char *const N_MODDST[] = {"OFF", "VIB", "CUT", "SHP", "WAH", "TREM"
#if CLIPPER_SYNTH
/* Clipper 0.6: the INSERT's types (fx.c IT_*; SLOOP 2.6's, same order: a SLOOP 2.6 sound keeps its INSERT). Its three
* values A B C mean what the type says (ins_desc) */
static const char *const N_ITYPE[] = {"OFF", "SOFT", "HARD", "FOLD", "FUZZ", "CRUSH", "PHASR", "FLANG", "CHOR"};
static const char *const N_ITYPE[] = {"OFF", "SOFT", "HARD", "FOLD", "FUZZ", "CRUSH", "PHASR", "FLANG", "CHOR",
"JUNO1", "JUNO2", "JUN12"}; /* (0.8: the JUNO chorus, I II I+II, on any sound) */
/* CRUSH: BITS 1..16 and RATE (the held sample's rate) over the range in 16 even parts (0-terminated) */
static const char *const N_IBITS[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
"16", 0};
@@ -45,7 +46,10 @@ static const char *const N_IRATE[] = {"689", "919", "1.1k", "1.4k", "1.8k", "2.2
#endif
static const char *const N_LYMODE[] = {"OFF", "LAYER", "SPLIT", "MULTI"}; /* LY_OFF .. LY_MULTI */
static const char *const N_L2MODE[] = {"FREE", "KEY"}; /* L2_FREE, L2_KEY */
static const char *const N_MSRC[] = {"OFF", "LFO1", "LFO2", "ENV1", "ENV2", "VEL", "KEY", "MW", "AT", "RAND", "SLIDE"};
static const char *const N_MSRC[] = {"OFF", "LFO1", "LFO2", "ENV1", "ENV2", "VEL", "KEY", "MW", "AT", "RAND", "SLIDE",
"SEQ1", "SEQ2", "SEQ3", "SEQ4"}; /* (0.8: the MOD SEQ's lanes) */
static const char *const N_MSRATE[] = {"1/32", "16T", "1/16", "8T", "1/8", "1/4", "1/2", "BAR", "2 BAR"};
static const char *const N_MSKEY[] = {"SYNC", "KEY"};
static const char *const N_MDST[] = {"OFF", "PITCH", "CUT", "SHAPE", "AMP", "PAN", "LFO2",
"E1", "E2", "E3", "E4", "E5", "E6", "E7", "E8"}; /* (track_desc: the engine's names) */ /* G_RTYPE: RT_ROOM, RT_PLATE */
static const char *const N_ROLL[] = {"1/8", "1/16", "1/32", "32T", "1/64"}; /* seq.c ROLL_DEN */
@@ -56,6 +60,7 @@ static const char *const N_ENGNAME[] = {"ANALOG", "DIGITAL", "PHASE", "LOFI", "S
#endif
#if CLIPPER_SYNTH
"WAVE", "ACID", "STRINGS", "MACRO", "VPS", "TERRAIN", "FMX", "WSEQ",
"JUNO", "VECTOR",
#endif
};
@@ -142,6 +147,13 @@ static const param_desc_t TP[P_COUNT] = {
[P_IB] = PD("INS B", F_PCT, 0, 127, 96),
[P_IC] = PD("INS C", F_PCT, 0, 127, 96),
[P_IMIX] = PD("MIX", F_PCT, 0, 127, 127),
/* Clipper 0.8: the MOD SEQ (seq.c mseq_tick: the steps; the matrix's SEQ1..SEQ4 read them) and SPICE / DICE */
[P_MSRATE] = PE("RATE", N_MSRATE, 2),
[P_MSLEN] = PD("LEN", F_INT, 1, 16, 16),
[P_MSSMTH] = PD("SMTH", F_PCT, 0, 127, 0),
[P_MSKEY] = PE("START", N_MSKEY, 1),
[P_SPICE] = PD("SPICE", F_PCT, 0, 127, 0),
[P_DICE] = PD("DICE", F_INT, 0, 127, 0),
#endif
};
#if CLIPPER_SYNTH
@@ -233,17 +245,19 @@ static const param_desc_t DRUM_KIT_DESC = PE("KIT", DRUM_KIT_NAMES, 0);
/* the INSERT's A B C as its TYPE means them (TP's ranges and defaults): the drives DRIVE TONE LEVEL, CRUSH BITS RATE
* LPF, the swept ones RATE DEPTH FDBK; OFF TP's own (as SLOOP 2.6) */
#define PU(l, f, df, n, u) {l, f, 0, 127, df, n, u}
static const param_desc_t INS_DESC[3][3] = {
static const param_desc_t INS_DESC[4][3] = {
{PU("DRIVE", F_PCT, 64, 0, 0), PU("TONE", F_CUTOFF, 96, 0, 0), PU("LEVEL", F_DB, 96, 0, 0)},
{PU("BITS", F_INT, 64, N_IBITS, 0), PU("RATE", F_INT, 96, N_IRATE, "Hz"), PU("LPF", F_CUTOFF, 96, 0, 0)},
{PU("RATE", F_LFOHZ, 64, 0, 0), PU("DEPTH", F_PCT, 96, 0, 0), PU("FDBK", F_PCT, 96, 0, 0)},
{PU("WIDTH", F_PCT, 127, 0, 0), PU("TONE", F_CUTOFF, 100, 0, 0), PU("NOISE", F_PCT, 0, 0, 0)}, /* JUNO1 .. JUN12 */
};
#undef PU
static const param_desc_t *ins_desc(int32_t type, uint32_t k)
{
if (type <= 0 || type >= (int32_t)(sizeof N_ITYPE / sizeof N_ITYPE[0]))
return &TP[P_IA + k];
return &INS_DESC[type < 5 ? 0 : type == 5 ? 1 : 2][k % 3u]; /* (SOFT .. FUZZ, CRUSH, the swept ones) */
return &INS_DESC[type < 5 ? 0 : type == 5 ? 1 : type < 9 ? 2 : 3][k % 3u]; /* (SOFT .. FUZZ, CRUSH, the swept
* ones, the JUNO chorus) */
}
#endif
static const param_desc_t *track_desc(const track_t *t, uint32_t id)
@@ -436,7 +450,7 @@ enum { FAM_HOME, FAM_ENV, FAM_LFO, FAM_FX, FAM_SCL, FAM_EDIT, FAM_GLO, FAM_SAVE,
FAM_COUNT };
enum { SC_TRACK, SC_GLOBAL, SC_ENGINE, SC_STEP, SC_TRK, SC_SONG, SC_DRUM, SC_SYN }; /* SC_SYN: ui_synth.c */
enum { GR_NONE, GR_ADSR, GR_LFO, GR_STEPS, GR_ARP, GR_SCALE, GR_FX, GR_ROLL, GR_BROWSE, GR_SLOTS, GR_USER, GR_TRK,
GR_SLCR, GR_LAYER, GR_MORPH, GR_MATRIX, GR_FMX, GR_HIST };
GR_SLCR, GR_LAYER, GR_MORPH, GR_MATRIX, GR_FMX, GR_HIST, GR_MSEQ };
typedef struct {
const char *title;
@@ -456,6 +470,8 @@ static const page_t PAGES[] = {
{"MOD", FAM_LFO, SC_TRACK, GR_NONE, {P_VELF, P_MWDST, P_ATDST, 0xFF}},
{"LFO 2", FAM_LFO, SC_TRACK, GR_NONE, {P_L2RATE, P_L2WAVE, P_L2MODE, 0xFF}},
{"MATRIX", FAM_LFO, SC_SYN, GR_MATRIX, {15, 16, 17, 18}}, /* X_MSLOT X_MSRC X_MDST X_MAMT (ui_synth.c) */
{"MOD SEQ", FAM_LFO, SC_SYN, GR_MSEQ, {43, 44, 45, 46}}, /* (0.8) X_QLANE X_QSTEP X_QVAL X_QFILL */
{"MOD SEQ 2", FAM_LFO, SC_TRACK, GR_MSEQ, {P_MSRATE, P_MSLEN, P_MSSMTH, P_MSKEY}},
#endif
{"FX", FAM_FX, SC_TRACK, GR_FX, {P_DIST, P_CHOR, P_DLY, P_REV}},
#if CLIPPER_SYNTH /* (the sound's filter model too) */
@@ -514,6 +530,9 @@ static const page_t PAGES[] = {
{"TOOLS", FAM_SAVE, SC_GLOBAL, GR_NONE, {G_CLRSEQ, G_INITSND, 0xFF, G_NEWPRJ}},
{"ARP", FAM_ARP, SC_TRACK, GR_ARP, {P_AMODE, P_ARATE, P_AOCT, P_AGATE}},
{"ARP 2", FAM_ARP, SC_TRACK, GR_NONE, {P_ASWING, P_APROB, P_AHOLD, P_AORDER}},
#if CLIPPER_SYNTH
{"SPICE", FAM_ARP, SC_TRACK, GR_NONE, {P_SPICE, P_DICE, 0xFF, 0xFF}}, /* (0.8) the arp's and the steps' notes vary */
#endif
{"STEP", FAM_SEQ, SC_STEP, GR_ROLL, {0, 1, 2, 3}},
{"PATTERN", FAM_SEQ, SC_TRACK, GR_STEPS, {P_SLEN, P_SDIV, P_SSWING, P_SGATE}},
{"SONG", CLIPPER_SYNTH ? FAM_TRK : FAM_SEQ, SC_SONG, GR_NONE, {0xFF, 0xFF, 0xFF, 0xFF}}, /* (Clipper: out of reach) */
+3 -1
View File
@@ -1,7 +1,7 @@
/* generated by tools/level_presets.py (a CLIPPER_SYNTH build): the level trims of Clipper's own engines, 1/2 dB */
#pragma once
#define PTC_FIRST 0u
#define PTC_ENGINES 21u
#define PTC_ENGINES 23u
#define PTC_MAX 32u
static const int8_t PRESET_TRIM_CL[PTC_ENGINES][PTC_MAX] = {
{/* 0.0 808 BOOM */ -9, /* 0.1 808 DIRTY */ -3, /* 0.2 SUB BASS */ -10, /* 0.3 808 SLIDE */ -4, /* 0.4 ACID 303 */ 23, /* 0.5 PLUGG BASS */ -6, /* 0.6 REESE */ 3, /* 0.7 WOBBLE */ 7, /* 0.8 FUNK BASS */ 16, /* 0.9 G-FUNK LD */ -10, /* 0.10 TRAP PLUCK */ 23, /* 0.11 SYN BRASS */ 23, /* 0.12 SUPERSAW */ -18, /* 0.13 WARM PAD */ -7, /* 0.14 DARK STR */ -4, /* 0.15 ATMOS PAD */ -9, /* 0.16 PAN FLUTE */ -7, /* 0.17 FAT LEAD */ -5, /* 0.18 MONO BASS */ 14, /* 0.19 PWM LEAD */ -6, /* 0.20 SAW BASS */ 17, /* 0.21 SINE PAD */ -23, /* 0.22 MINI BASS */ 21, /* 0.23 MINI LEAD */ -3, /* 0.24 JUNO PAD */ -14, /* 0.25 OBX BRASS */ 15, /* 0.26 TAURUS */ 5, /* 0.27 PROPH LEAD */ 2, /* 0.28 UNI STAB */ 23, /* 0.29 SQR PLUCK */ 23, /* 0.30 DYN BASS */ 13, /* 0.31 WAH LEAD */ -2},
@@ -25,4 +25,6 @@ static const int8_t PRESET_TRIM_CL[PTC_ENGINES][PTC_MAX] = {
{/* 18.0 TERRAIN */ -10, /* 18.1 RIPPLE PAD */ -10, /* 18.2 CRYSTAL */ 9, /* 18.3 BUMPY BASS */ 19, /* 18.4 SADDLE LEAD */ -10, /* 18.5 FOLD DRONE */ -5, /* 18.6 TWISTER */ -18, /* 18.7 CHAOS FX */ -8, /* 18.8 ORBIT KEYS */ 23, /* 18.9 TERRA PLUCK */ 19},
{/* 19.0 FMX EP */ 3, /* 19.1 FMX BELL */ -2, /* 19.2 SAW FM BASS */ 16, /* 19.3 FMX BRASS */ 2, /* 19.4 FMX ORGAN */ -6, /* 19.5 RING BELLS */ 18, /* 19.6 TRUE FM GRWL */ 4, /* 19.7 CHIP FM LEAD */ 1, /* 19.8 OPL KEYS */ 11, /* 19.9 FMX PAD */ -2, /* 19.10 FM KICK */ 10, /* 19.11 METAL HIT */ 11, /* 19.12 FM SYNC LEAD */ 10, /* 19.13 FMX PLUCK */ 15, /* 19.14 FM WOBBLE */ 8, /* 19.15 CASCADE */ -4},
{/* 20.0 WAVE STEPS */ -6, /* 20.1 RHYTHM SEQ */ -4, /* 20.2 SWEEP PAD */ -2, /* 20.3 FIFTH STAB */ -1, /* 20.4 MINOR SEQ */ -4, /* 20.5 MAJOR SEQ */ -6, /* 20.6 OCTAVE BASS */ -3, /* 20.7 TRANCE GATE */ 0, /* 20.8 BELL STEPS */ -4, /* 20.9 8BIT SEQ */ -9, /* 20.10 MORPH PAD */ -2, /* 20.11 VOX STEPS */ -1, /* 20.12 NOISY SEQ */ -3, /* 20.13 DUB STEPS */ -8, /* 20.14 DORIAN RUN */ -4, /* 20.15 PING PONG */ -2},
{/* 21.0 JUNO 106 PAD */ 1, /* 21.1 JUNO BRASS */ 5, /* 21.2 JUNO BASS */ 11, /* 21.3 JUNO STRINGS */ 2, /* 21.4 POLY KEYS */ 7, /* 21.5 SYNTHWAVE LD */ 3, /* 21.6 80S HITS */ 23, /* 21.7 JUNO PIANO */ 16, /* 21.8 DREAM PAD */ 1, /* 21.9 SUB BASS 106 */ 3, /* 21.10 SYNTH BRASS 2 */ 7, /* 21.11 ARP PLUCK */ 23, /* 21.12 NOISE SWEEP */ 3, /* 21.13 JUNO ORGAN */ 3, /* 21.14 SAW LEAD 106 */ 5, /* 21.15 HOOVER JUNO */ 17},
{/* 22.0 VS PAD */ -3, /* 22.1 VECTOR SWEEP */ -17, /* 22.2 VS BRASS */ 9, /* 22.3 GLASS VS */ -11, /* 22.4 VOX MORPH */ 0, /* 22.5 DIGI BELLS */ -8, /* 22.6 VS BASS */ -1, /* 22.7 WAVE LOOP */ -8, /* 22.8 ORGAN DRIFT */ -9, /* 22.9 STRING VS */ -3, /* 22.10 METAL HIT */ 23, /* 22.11 HOLLOW KEYS */ 8, /* 22.12 RESO VECTOR */ -3, /* 22.13 SPACE DRONE */ 3, /* 22.14 VS LEAD */ -6, /* 22.15 CHOIR VS */ -3},
};
+91 -12
View File
@@ -41,18 +41,67 @@ _Static_assert(G_DRDLY == PROJ_NG && G_COUNT == PROJ_NG + 1u, "the globals a pro
#define PROJ_NP 61u
#define PROJ_E0 53u
#define PROJ_NX (P_E0 - PROJ_E0)
_Static_assert(P_COUNT == PROJ_NP || (CLIPPER_SYNTH && P_COUNT == PROJ_NP + PROJ_NX && PROJ_NX <= PROJ_E0 && NTRK == 4 &&
2u * PROJ_NX + 1u <= 3u * NLOCK), "a track's parameters as stored (Clipper: track 3's lock slots hold the rest)");
_Static_assert(P_COUNT == PROJ_NP || (CLIPPER_SYNTH && P_COUNT == PROJ_NP + PROJ_NX && PROJ_NX <= PROJ_E0 && NTRK == 4),
"a track's parameters as stored (Clipper: track 3's lock slots hold the rest: PROJ_XM3 below)");
#if CLIPPER_SYNTH
/* tracks 1 and 2's LFO 2, ENV 2 and matrix (0.4: PROJ_XA values each) and INSERT (0.6: PROJ_XI each) <-> bytes in the
* free lock slots of track 3 (lk): 3 bytes a slot (param, val low, val high), value - its minimum (every range fits a
* byte). The 0.4 part first, as 0.4 / 0.5 wrote it (2 x PROJ_XA bytes, then CLIPPER_PROJ_MARK), then 0.6's (2 x PROJ_XI
* bytes, then CLIPPER_PROJ_MARK_06): a project of 0.4 / 0.5 loads its matrix, its INSERT off */
#define PROJ_XA ((uint32_t)(P_ITYPE - PROJ_E0)) /* P_L2RATE .. P_M6AMT */
#define PROJ_XI ((uint32_t)(P_E0 - P_ITYPE)) /* P_ITYPE .. P_IMIX */
#define PROJ_XI ((uint32_t)(P_IMIX + 1 - P_ITYPE)) /* P_ITYPE .. P_IMIX */
#define PROJ_XM1 (2u * PROJ_XA) /* the byte of CLIPPER_PROJ_MARK */
#define PROJ_XM2 (PROJ_XM1 + 1u + 2u * PROJ_XI) /* the byte of CLIPPER_PROJ_MARK_06 */
_Static_assert(PROJ_XA == 25u && PROJ_XI == 5u && PROJ_XM2 < 3u * NLOCK, "the project's Clipper bytes in track 3's lock slots");
/* 0.8: the MOD SEQ's RATE LEN SMTH START, SPICE, DICE (PROJ_XS) of both, 4 bytes each (proj_xs_word), after 0.6's,
* then CLIPPER_PROJ_MARK_08; their steps in track 4's free lock slots (two a byte, + 8; then the mark) */
#define PROJ_XS ((uint32_t)(P_E0 - P_MSRATE))
#define PROJ_XM3 (PROJ_XM2 + 1u + 8u) /* the byte of CLIPPER_PROJ_MARK_08 */
#define CLIPPER_PROJ_MARK_08 0xC8u
#define PROJ_MS_MARK 64u /* track 4: the byte after the steps */
_Static_assert(PROJ_XA == 25u && PROJ_XI == 5u && PROJ_XS == 6u && P_MSRATE == P_IMIX + 1 && PROJ_XM3 < 3u * NLOCK &&
PROJ_MS_MARK < 3u * NLOCK, "the project's Clipper bytes in tracks 3 and 4's lock slots");
static uint32_t proj_xs_word(const int16_t *p) /* RATE (4 bits) START (1) LEN - 1 (4) SMTH (7) SPICE (7) DICE (7) */
{
return (uint32_t)clamp(p[P_MSRATE], 0, 15) | (uint32_t)clamp(p[P_MSKEY], 0, 1) << 4 |
(uint32_t)clamp(p[P_MSLEN] - 1, 0, 15) << 5 | (uint32_t)clamp(p[P_MSSMTH], 0, 127) << 9 |
(uint32_t)clamp(p[P_SPICE], 0, 127) << 16 | (uint32_t)clamp(p[P_DICE], 0, 127) << 23;
}
static int32_t proj_xs_val(uint32_t w, uint32_t i) /* value P_MSRATE + i of a word */
{
switch (i) {
case 0: return (int32_t)(w & 15u);
case 1: return (int32_t)((w >> 5) & 15u) + 1;
case 2: return (int32_t)((w >> 9) & 127u);
case 3: return (int32_t)((w >> 4) & 1u);
case 4: return (int32_t)((w >> 16) & 127u);
default: return (int32_t)((w >> 23) & 127u);
}
}
_Static_assert(P_MSLEN == P_MSRATE + 1 && P_MSSMTH == P_MSRATE + 2 && P_MSKEY == P_MSRATE + 3 && P_SPICE == P_MSRATE + 4 &&
P_DICE == P_MSRATE + 5, "proj_xs_val's order");
static void proj_bytes_put(plock_t *lk, const uint8_t *b)
{
uint32_t k;
for (k = 0; k < NLOCK; k++) {
lk[k].step = LOCK_FREE;
lk[k].param = b[3u * k];
lk[k].val = (int16_t)(b[3u * k + 1u] | b[3u * k + 2u] << 8);
}
}
static void proj_ms_put(plock_t *lk) /* track 4's lock slots: both sounds' steps */
{
uint8_t b[3u * NLOCK];
uint32_t j, n;
memset(b, 0, sizeof b);
for (j = 0; j < 2u; j++)
for (n = 0; n < 32u; n++) {
uint32_t a = 2u * n, c = a + 1u;
b[32u * j + n] = (uint8_t)((uint32_t)clamp(trk[j].ms[a / MSEQ_STEPS][a % MSEQ_STEPS] + 8, 0, 15) |
(uint32_t)clamp(trk[j].ms[c / MSEQ_STEPS][c % MSEQ_STEPS] + 8, 0, 15) << 4);
}
b[PROJ_MS_MARK] = CLIPPER_PROJ_MARK_08;
proj_bytes_put(lk, b);
}
static uint32_t proj_ext_at(uint32_t j, uint32_t k) /* the byte of track j's value k (P_E0 - PROJ_E0 of them) */
{
return k < PROJ_XA ? j * PROJ_XA + k : PROJ_XM1 + 1u + j * PROJ_XI + (k - PROJ_XA);
@@ -62,16 +111,17 @@ static void proj_ext_put(plock_t *lk)
uint8_t b[3u * NLOCK];
uint32_t j, k;
memset(b, 0, sizeof b);
for (j = 0; j < 2u; j++)
for (k = 0; k < PROJ_NX; k++)
for (j = 0; j < 2u; j++) {
uint32_t w = proj_xs_word(trk[j].p);
for (k = 0; k < PROJ_XA + PROJ_XI; k++)
b[proj_ext_at(j, k)] = (uint8_t)clamp(trk[j].p[PROJ_E0 + k] - TP[PROJ_E0 + k].min, 0, 255);
for (k = 0; k < 4u; k++)
b[PROJ_XM2 + 1u + 4u * j + k] = (uint8_t)(w >> (8u * k));
}
b[PROJ_XM1] = CLIPPER_PROJ_MARK;
b[PROJ_XM2] = CLIPPER_PROJ_MARK_06;
for (k = 0; k < NLOCK; k++) {
lk[k].step = LOCK_FREE;
lk[k].param = b[3u * k];
lk[k].val = (int16_t)(b[3u * k + 1u] | b[3u * k + 2u] << 8);
}
b[PROJ_XM3] = CLIPPER_PROJ_MARK_08;
proj_bytes_put(lk, b);
}
static uint32_t proj_ext_byte(const plock_t *lk, uint32_t n)
{
@@ -87,8 +137,31 @@ static int proj_ext_get(const plock_t *lk, uint32_t j, uint32_t k) /* track j'
return -1;
if (k >= PROJ_XA && proj_ext_byte(lk, PROJ_XM2) != CLIPPER_PROJ_MARK_06)
return -1; /* (0.4 / 0.5: no INSERT) */
if (k >= PROJ_XA + PROJ_XI) { /* (0.8) the MOD SEQ's, SPICE's: none before 0.8 */
uint32_t w = 0, i;
if (proj_ext_byte(lk, PROJ_XM3) != CLIPPER_PROJ_MARK_08)
return -1;
for (i = 0; i < 4u; i++)
w |= proj_ext_byte(lk, PROJ_XM2 + 1u + 4u * j + i) << (8u * i);
return (int)(proj_xs_val(w, k - PROJ_XA - PROJ_XI) - TP[P_MSRATE + k - PROJ_XA - PROJ_XI].min);
}
return (int)proj_ext_byte(lk, proj_ext_at(j, k));
}
static int proj_ms_get(const plock_t *lk, uint32_t j, track_t *t) /* track j's steps from track 4's: 0, -1 none */
{
uint32_t i, n;
for (i = 0; i < NLOCK; i++)
if (lk[i].step != LOCK_FREE)
return -1;
if (proj_ext_byte(lk, PROJ_MS_MARK) != CLIPPER_PROJ_MARK_08)
return -1;
for (n = 0; n < 32u; n++) {
uint32_t b = proj_ext_byte(lk, 32u * j + n), a = 2u * n, c = a + 1u;
t->ms[a / MSEQ_STEPS][a % MSEQ_STEPS] = (int8_t)((int32_t)(b & 15u) - 8);
t->ms[c / MSEQ_STEPS][c % MSEQ_STEPS] = (int8_t)((int32_t)(b >> 4) - 8);
}
return 0;
}
#endif
typedef struct { /* one track; the drum track ignores engine / preset */
int16_t p[PROJ_NP];
@@ -470,6 +543,8 @@ static void proj_capture(project_t *p) /* what is playing now, as a proje
p->t[i].lock[k].param = (uint8_t)(trk[i].lock[k].param - PROJ_NX);
if (i == 2u) /* (Clipper 0.4: tracks 1 and 2's LFO 2, ENV 2, matrix) */
proj_ext_put(p->t[2].lock);
if (i == 3u) /* (0.8: their MOD SEQ's steps) */
proj_ms_put(p->t[3].lock);
#endif
p->t[i].engine = trk[i].eng_req;
p->t[i].preset = trk[i].preset;
@@ -511,7 +586,7 @@ static void proj_apply(const project_t *p, int all)
v = p->t[k + 2u].p[i - PROJ_E0]; /* (0.4's first build: in tracks 3 and 4's p[]) */
} else if (i >= P_ITYPE && i < P_E0 && k == 0u && p->rsv[0] != CLIPPER_PROJ_MARK && proj_v6_ins_ok[proj_v6_at(p)]) {
v = proj_v6_ins[proj_v6_at(p)][i - P_ITYPE]; /* (a SLOOP 2.6 project: its track 1's INSERT) */
} else if (i < PROJ_NX && k >= 2u && p->rsv[0] == CLIPPER_PROJ_MARK_04) {
} else if (i < PROJ_XA + PROJ_XI && k >= 2u && p->rsv[0] == CLIPPER_PROJ_MARK_04) {
v = d->def; /* (there, theirs were not stored) */
}
#endif
@@ -554,6 +629,10 @@ static void proj_apply(const project_t *p, int all)
for (j = 0; j < 4u; j++)
st->note[j] &= 127u;
}
#if CLIPPER_SYNTH
if (k < 2u && (p->rsv[0] != CLIPPER_PROJ_MARK || proj_ms_get(p->t[3].lock, k, t)))
mseq_init(t); /* (0.8) its MOD SEQ, or the shapes to start from */
#endif
fm6_track_loaded(t); /* FM6: the project keeps PTCH, not the patch: its slot's */
}
#if CLIPPER_SYNTH
+104 -9
View File
@@ -1266,15 +1266,79 @@ static void arp_end(track_t *t)
}
}
/* an arp note starts (recorded while recording: what you hear) */
static void arp_play(track_t *t, uint32_t n)
/* an arp note starts at velocity vel (recorded while recording: what you hear) */
static void arp_play(track_t *t, uint32_t n, uint32_t vel)
{
trk_note_on(t, n, 100);
seq_out_on(t, n, 100);
trk_note_on(t, n, vel);
seq_out_on(t, n, vel);
if (((song.rec >> trk_index(t)) & 1u) && song.playing)
rec_note(t, n, 100, 0, 0);
rec_note(t, n, vel, 0, 0);
}
/* Clipper 0.8, SPICE / DICE (after the MicroFreak's): the arp's notes and the sequencer's steps vary, as much as
* SPICE says (0: as written), the same way each time round (the k-th note of 16, the pattern's step k) until DICE is
* turned (another variation). A note may rest (up to 1 in 6), jump an octave (up to 1 in 4, mostly up), and its
* velocity and gate move (up to +-63, x 0.05 .. 1.95). What is stored is never changed */
typedef struct { uint8_t skip; int8_t oct; uint8_t vel, gate; } spice_t; /* gate: x / 64 */
static uint32_t spice_gate = 64u; /* (the arp's last note: arp_tick's gate) */
static int spice_of(const track_t *t, uint32_t k, uint32_t vel, spice_t *o)
{
#if CLIPPER_SYNTH
uint32_t sp = (uint32_t)clamp(t->p[P_SPICE], 0, 127), h;
int32_t v;
o->skip = 0, o->oct = 0, o->vel = (uint8_t)vel, o->gate = 64;
if (!sp)
return 0;
h = (k + 1u) * 0x9E3779B1u ^ ((uint32_t)clamp(t->p[P_DICE], 0, 127) + 1u) * 0x85EBCA77u;
h ^= h >> 15, h *= 0x2C1B3C6Du, h ^= h >> 12, h *= 0x297A2D39u, h ^= h >> 15;
if ((h & 255u) < sp / 3u)
o->skip = 1;
else if (((h >> 8) & 255u) < sp / 2u)
o->oct = (int8_t)((h >> 16) & 3u ? 12 : -12);
v = (int32_t)vel + ((((int32_t)((h >> 18) & 127u) - 64) * (int32_t)sp) >> 7);
o->vel = (uint8_t)clamp(v, 1, 127);
o->gate = (uint8_t)clamp(64 + ((((int32_t)((h >> 25) & 63u) - 32) * (int32_t)sp) >> 6), 3, 125);
return 1;
#else
(void)t, (void)k;
o->skip = 0, o->oct = 0, o->vel = (uint8_t)vel, o->gate = 64;
return 0;
#endif
}
#if CLIPPER_SYNTH
/* Clipper 0.8: the MOD SEQ's clock and glide, once a block for each part (voice.c reads ms_cur: the matrix's SEQ1..4) */
static const uint8_t MSEQ_DIV[9] = {3, 5, 2, 4, 1, 0, 6, 7, 8}; /* N_MSRATE -> div_units's order */
static void mseq_tick(track_t *t, uint32_t adv)
{
const int16_t *p = t->p;
uint32_t div = MSEQ_DIV[clamp(p[P_MSRATE], 0, 8)], u = div_units(div), len = (uint32_t)clamp(p[P_MSLEN], 1, 16);
uint32_t i, on = 0, restart = 0;
int32_t k = (128 - clamp(p[P_MSSMTH], 0, 127)) * (128 - clamp(p[P_MSSMTH], 0, 127)); /* Q14 a block */
for (i = 0; i < NVOICE && !on; i++)
on = t->v[i].active && t->v[i].gate;
if (on && !t->ms_held && (p[P_MSKEY] || !song.playing))
restart = 1, t->ms_step = 0, t->ms_pos = 0; /* KEY (and stopped): from each first key */
t->ms_held = (uint8_t)on;
if (!p[P_MSKEY] && song.playing) { /* SYNC: the song's grid */
uint32_t into, slen;
t->ms_step = (uint8_t)(grid_at(div, 0u, &into, &slen) % len);
} else if (!restart) {
t->ms_pos += adv;
if (t->ms_pos >= u) {
t->ms_pos = t->ms_pos - u < u ? t->ms_pos - u : 0u;
t->ms_step = (uint8_t)((t->ms_step + 1u) % len);
}
}
if (t->ms_step >= len)
t->ms_step = 0;
for (i = 0; i < MSEQ_LANES; i++) {
int32_t tg = mseq_q15(t->ms[i][t->ms_step % MSEQ_STEPS]);
t->ms_cur[i] = restart || k >= 16384 ? tg : t->ms_cur[i] + (((tg - t->ms_cur[i]) * k) >> 14);
}
}
#endif
/* an arp step: the next note of the list by MODE, or (CHORD) the first 4 notes together, OCT octaves in turn. 1: it
* plays (arp_note set), 0: nothing to play */
static int arp_step(track_t *t)
@@ -1282,12 +1346,20 @@ static int arp_step(track_t *t)
uint32_t list[65], cnt, len = arp_list(t, list, &cnt), i, o, top = 0;
if (!len)
return 0;
spice_t sp;
t->arp_idx++;
spice_of(t, t->arp_idx % 16u, 100u, &sp); /* (0.8) SPICE: this note's variation */
spice_gate = sp.gate;
if (t->p[P_AMODE] != AM_CHORD) {
t->arp_note = (uint8_t)list[arp_pick(t, list, len)];
arp_play(t, t->arp_note);
uint32_t nt = list[arp_pick(t, list, len)];
if (sp.skip)
return 0; /* (a rest: the walk goes on) */
t->arp_note = (uint8_t)clamp((int32_t)nt + sp.oct, 1, 127);
arp_play(t, t->arp_note, sp.vel);
return 1;
}
if (sp.skip)
return 0;
o = t->arp_idx % (uint32_t)(t->p[P_AOCT] > 0 ? t->p[P_AOCT] : 1);
for (i = 0; i < cnt && i < 4u; i++) { /* the held notes (sorted or as played), o octaves up */
uint32_t nt = (uint32_t)clamp((int32_t)list[i] + 12 * (int32_t)o, 0, 127);
@@ -1297,7 +1369,7 @@ static int arp_step(track_t *t)
t->arp_note = (uint8_t)nt;
else
t->arp_ch[i - 1u] = (uint8_t)nt;
arp_play(t, nt);
arp_play(t, nt, sp.vel);
}
return 1;
}
@@ -1355,7 +1427,7 @@ static void arp_tick(track_t *t, uint32_t adv)
return;
arp_end(t);
if ((uint32_t)(rng() & 127u) <= (uint32_t)t->p[P_APROB] && arp_step(t))
t->arp_off = slen * (uint32_t)t->p[P_AGATE] / 128u;
t->arp_off = slen * (uint32_t)t->p[P_AGATE] / 128u * spice_gate / 64u; /* (0.8: SPICE's gate, x 1 off) */
}
/* ------------------------------------------------------- note input --- */
@@ -2130,6 +2202,25 @@ static void seq_step(track_t *t, const step_t *s, uint32_t slen, uint32_t skip)
const step_t *nx = &t->step[(t->seq_idx + 1u) % trk_len(t)];
uint32_t next_tie = nx->time == ST_TIE || (nx->time == ST_NOTE && (nx->flags & SF_CONT_ALL)); /* (2.7: notes going on
* into the next step: held to it, it says which end) */
#if CLIPPER_SYNTH
step_t vs; /* (0.8) SPICE: this step's variation, on a copy */
if (t->p[P_SPICE] && s->time == ST_NOTE && s->n && !s->rat && !(s->flags & SF_CONT_ALL)) {
spice_t sp;
int32_t base = (s->flags & SF_ACCENT) ? 127 : (s->vel ? s->vel : 96);
spice_of(t, t->seq_idx, 100u, &sp);
if (sp.skip) {
seq_release(t);
return;
}
vs = *s;
for (i = 0; i < vs.n; i++)
vs.note[i] = (uint8_t)clamp((int32_t)vs.note[i] + sp.oct, 1, 127);
vs.vel = (uint8_t)clamp(base + (int32_t)sp.vel - 100, 1, 127);
vs.flags &= (uint8_t)~SF_ACCENT;
gate = gate * sp.gate / 64u;
s = &vs;
}
#endif
if (s->time == ST_TIE) {
if (t->seq_n) {
t->seq_off = gate + slen / 2u;
@@ -2856,6 +2947,10 @@ static void events_block(uint32_t n)
roll_block(adv);
for (i = 0; i < (CLIPPER_SYNTH ? 1u : NPART); i++)
arp_tick(&trk[i], adv);
#if CLIPPER_SYNTH
for (i = 0; i < NPART; i++)
mseq_tick(&trk[i], adv); /* (0.8) the MOD SEQ of both sounds */
#endif
if (song.playing) {
song.tick++;
clk_pos += adv;
+19 -1
View File
@@ -3,7 +3,7 @@
/* Felucca user interface. Four columns map to KNOB 1..4. Rendering is lazy:
* every element remembers what it last drew and is redrawn only on change. */
#ifndef FELUCCA_VERSION
#define FELUCCA_VERSION "CLIPPER 0.7" /* the synthesizer firmware for the FM-1 (from SLOOP 2.5, based on Felucca) */
#define FELUCCA_VERSION "CLIPPER 0.8" /* the synthesizer firmware for the FM-1 (from SLOOP 2.5, based on Felucca) */
#endif
static void project_save(uint32_t slot);
static void arrangement_save(void);
@@ -331,6 +331,9 @@ static void apply_preset_to(track_t *t, uint32_t pi)
else if (kbd_hold)
t->p[P_AHOLD] = 1; /* (0.7) KBD HOLD stays on */
}
#if CLIPPER_SYNTH
mseq_init(t); /* (0.8) the MOD SEQ: the shapes to start from */
#endif
fm6_track_loaded(t); /* FM6: the preset's patch (its PTCH) */
}
@@ -525,6 +528,21 @@ static const struct { uint8_t kind, e; const char *name; } BANK[] = {
{BK_FX, ENGI_SLICE, "BREAK 16"}, {BK_FX, ENGI_SLICE, "CHOP 8"}, {BK_FX, ENGI_SLICE, "REVERSE"},
{BK_FX, ENGI_SLICE, "USR SLICE"},
#endif
#if CLIPPER_SYNTH /* (appended: the favourites keep their entries' places) */
/* Clipper 0.8: JUNO, VECTOR */
{BK_PAD, ENGI_JUNO, "JUNO 106 PAD"}, {BK_STAB, ENGI_JUNO, "JUNO BRASS"}, {BK_BASS, ENGI_JUNO, "JUNO BASS"},
{BK_PAD, ENGI_JUNO, "JUNO STRINGS"}, {BK_KEYS, ENGI_JUNO, "POLY KEYS"}, {BK_LEAD, ENGI_JUNO, "SYNTHWAVE LD"},
{BK_STAB, ENGI_JUNO, "80S HITS"}, {BK_KEYS, ENGI_JUNO, "JUNO PIANO"}, {BK_PAD, ENGI_JUNO, "DREAM PAD"},
{BK_BASS, ENGI_JUNO, "SUB BASS 106"}, {BK_STAB, ENGI_JUNO, "SYNTH BRASS 2"}, {BK_PLUCK, ENGI_JUNO, "ARP PLUCK"},
{BK_FX, ENGI_JUNO, "NOISE SWEEP"}, {BK_ORGAN, ENGI_JUNO, "JUNO ORGAN"}, {BK_LEAD, ENGI_JUNO, "SAW LEAD 106"},
{BK_LEAD, ENGI_JUNO, "HOOVER JUNO"},
{BK_PAD, ENGI_VECTOR, "VS PAD"}, {BK_PAD, ENGI_VECTOR, "VECTOR SWEEP"}, {BK_STAB, ENGI_VECTOR, "VS BRASS"},
{BK_KEYS, ENGI_VECTOR, "GLASS VS"}, {BK_PAD, ENGI_VECTOR, "VOX MORPH"}, {BK_PLUCK, ENGI_VECTOR, "DIGI BELLS"},
{BK_BASS, ENGI_VECTOR, "VS BASS"}, {BK_LEAD, ENGI_VECTOR, "WAVE LOOP"}, {BK_ORGAN, ENGI_VECTOR, "ORGAN DRIFT"},
{BK_PAD, ENGI_VECTOR, "STRING VS"}, {BK_FX, ENGI_VECTOR, "METAL HIT"}, {BK_KEYS, ENGI_VECTOR, "HOLLOW KEYS"},
{BK_LEAD, ENGI_VECTOR, "RESO VECTOR"}, {BK_FX, ENGI_VECTOR, "SPACE DRONE"}, {BK_LEAD, ENGI_VECTOR, "VS LEAD"},
{BK_PAD, ENGI_VECTOR, "CHOIR VS"},
#endif
};
#define NBANK (sizeof BANK / sizeof BANK[0])
static uint8_t bank_pi[NBANK]; /* the preset index of each entry in its engine */
+3
View File
@@ -811,6 +811,9 @@ static void draw_graph(void)
case GR_HIST:
graph_hist();
break;
case GR_MSEQ:
graph_mseq();
break;
#endif
default:
if (big_page(pg)) {
+92 -3
View File
@@ -17,17 +17,22 @@ enum { X_LYMODE, X_LYSOUND, X_LYSPLIT, X_LYLEVEL, X_LYOCT, X_LYPAN, X_LYFILT, X_
X_FOP, X_FWAVE, X_FMODE, X_FRATIO, X_FFINE, X_FLEVEL, X_FVEL, X_FKSC, X_FATK, X_FDEC, X_FSUS, X_FREL,
X_FTO, X_FFROM, X_FAMT, X_FOUT, X_FDTN, X_FFIX, X_FPEG, X_FPTIM, X_FSLOT, X_FSTORE,
X_HPOS, X_HCMP, /* 0.7: UNDO (the place in the sound's history), COMPARE */
X_QLANE, X_QSTEP, X_QVAL, X_QFILL, /* 0.8: the MOD SEQ: the lane, the step, its value, a SHAPE */
X_COUNT };
static void mseq_fill(struct track *t, uint32_t l, uint32_t f);
static const char *const N_QFILL[] = {"--", "RAMP+", "RAMP-", "TRI", "SINE", "SQR", "RND", "FLAT", "INVRT", "SHIFT"};
enum { QF_NONE, QF_UP, QF_DOWN, QF_TRI, QF_SINE, QF_SQR, QF_RND, QF_FLAT, QF_INV, QF_SHIFT, QF_N };
static const char *const N_RNDWHAT[] = {"EDIT", "+ENV", "ALL", "ENV", "MOD", "FX", "OPS"}; /* (0.7: one section, as the
* Hydrasynth's; OPS: FMX's operators, opsix style) */
static const char *const N_OCTS[] = {"-2", "-1", "0", "+1", "+2"};
static int16_t xv[X_COUNT] = {[X_RNDAMT] = 40, [X_RNDWHAT] = 1, [X_MSLOT] = 1, [X_FOP] = 1, [X_FTO] = 1, [X_FFROM] = 2,
[X_FSLOT] = 1};
[X_FSLOT] = 1, [X_QLANE] = 1, [X_QSTEP] = 1};
static const char *const N_FRATIO[32] = {"0.5", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
"27", "28", "29", "30", "31"};
static const char *const N_FFIXC[4] = {"1Hz", "10Hz", "100Hz", "1kHz"};
_Static_assert(X_FOP == 19 && X_FSTORE == 40 && X_HPOS == 41, "params.c PAGES: FMX's ids, UNDO's");
_Static_assert(X_FOP == 19 && X_FSTORE == 40 && X_HPOS == 41 && X_QLANE == 43 && QF_N == NELEM(N_QFILL),
"params.c PAGES: FMX's ids, UNDO's, MOD SEQ's");
static const char *const N_CMP[] = {"EDIT", "ORIG"};
static param_desc_t xd_sound = {"SOUND", F_INT, 0, 0, 0, 0, 0}; /* (its range: the list's length, syn_desc) */
static const param_desc_t XD[X_COUNT] = {
@@ -67,6 +72,10 @@ static const param_desc_t XD[X_COUNT] = {
[X_FPEG] = PD("PEG", F_BIPCT, -64, 63, 0),
[X_FPTIM] = PD("PTIM", F_TIME, 0, 127, 40),
[X_FSLOT] = PD("SLOT", F_INT, 1, FM6_BANK_N, 1),
[X_QLANE] = PD("LANE", F_INT, 1, 4, 1),
[X_QSTEP] = PD("STEP", F_INT, 1, 16, 1),
[X_QVAL] = PD("VALUE", F_INT, -8, 7, 0),
[X_QFILL] = PE("SHAPE", N_QFILL, 0),
[X_FSTORE] = PE("STORE", N_GO, 0),
[X_HPOS] = PD("UNDO", F_INT, -16, 0, 0),
[X_HCMP] = PE("CMP", N_CMP, 0),
@@ -76,6 +85,7 @@ static const param_desc_t XD[X_COUNT] = {
typedef struct {
uint8_t ok, eng, preset, user;
int16_t p[P_COUNT];
int8_t ms[MSEQ_LANES][MSEQ_STEPS]; /* (0.8) the MOD SEQ's steps */
} syn_snap_t;
static syn_snap_t syn_a, syn_b, syn_back;
@@ -86,6 +96,7 @@ static void snap_take(syn_snap_t *s, const track_t *t)
s->preset = t->preset;
s->user = t->user;
memcpy(s->p, t->p, sizeof s->p);
memcpy(s->ms, t->ms, sizeof s->ms);
}
/* a snapshot's sound into t (its mix and pattern parameters stay: param_kept) */
static void snap_put(track_t *t, const syn_snap_t *s)
@@ -101,6 +112,7 @@ static void snap_put(track_t *t, const syn_snap_t *s)
t->p[i] = s->p[i];
t->preset = s->preset;
t->user = s->user;
memcpy(t->ms, s->ms, sizeof t->ms);
fm1_irq_on();
fm6_track_loaded(t);
ui.force = 1;
@@ -136,6 +148,8 @@ static int hist_same(const hist_t *a, const hist_t *b) /* the same sound (its m
for (i = 0; i < P_COUNT; i++)
if ((i >= P_E0 || !param_kept(i)) && i != P_ED_FX && a->s.p[i] != b->s.p[i])
return 0;
if (memcmp(a->s.ms, b->s.ms, sizeof a->s.ms))
return 0; /* (0.8: a MOD SEQ step) */
return a->s.eng != ENGI_FMX || !memcmp(&a->fx, &b->fx, sizeof a->fx);
}
static void hist_put(const hist_t *h)
@@ -295,7 +309,9 @@ static void hist_label(const hist_t *a, const hist_t *b, char *out, uint32_t cap
}
n++;
}
if (!n && b->s.eng == ENGI_FMX)
if (!n && memcmp(a->s.ms, b->s.ms, sizeof a->s.ms))
str_cpy(out, "MOD SEQ", cap);
else if (!n && b->s.eng == ENGI_FMX)
str_cpy(out, "FMX PATCH", cap);
else if (n > 2u) {
char k[8] = " +";
@@ -512,6 +528,8 @@ static void layer_swap(void)
}
a->preset = sb.preset, b->preset = sa.preset;
a->user = sb.user, b->user = sa.user;
memcpy(a->ms, sb.ms, sizeof a->ms); /* (0.8) the MOD SEQs trade places too */
memcpy(b->ms, sa.ms, sizeof b->ms);
hy_slot_seen[0] = hy_slot_seen[1] = 0; /* HYBRID: each part its patch again */
fm1_irq_on();
fm6_track_loaded(a);
@@ -545,6 +563,10 @@ static const param_desc_t *syn_desc(uint32_t id, int16_t **valp)
return &hd;
}
case X_HCMP: xv[X_HCMP] = hist_cmp_on; *valp = &xv[X_HCMP]; break;
case X_QVAL: /* (0.8) the selected step of the selected lane */
xv[X_QVAL] = TSEL->ms[clamp(xv[X_QLANE], 1, 4) - 1][clamp(xv[X_QSTEP], 1, 16) - 1];
*valp = &xv[X_QVAL];
break;
case X_LYSPLIT:
if (layer_multi()) { /* 0.6, MULTI: no split; the knob is the layer's channel */
static const param_desc_t ch = {"CH", F_INT, 1, 16, 2, 0, 0};
@@ -659,6 +681,16 @@ static void syn_changed(uint32_t id, int16_t *vp)
case X_FOP:
case X_FTO:
case X_FFROM:
case X_QLANE:
case X_QSTEP:
ui.force = 1;
break;
case X_QVAL:
TSEL->ms[clamp(xv[X_QLANE], 1, 4) - 1][clamp(xv[X_QSTEP], 1, 16) - 1] = (int8_t)clamp(*vp, -8, 7);
ui.force = 1;
break;
case X_QFILL:
mseq_fill(TSEL, (uint32_t)clamp(xv[X_QLANE], 1, 4) - 1u, (uint32_t)clamp(*vp, 0, QF_N - 1));
ui.force = 1;
break;
case X_FWAVE: case X_FMODE: case X_FRATIO: case X_FFINE: case X_FLEVEL: case X_FVEL: case X_FKSC: case X_FATK:
@@ -872,6 +904,63 @@ static void graph_hist(void)
}
/* the graph of the MATRIX page: the six slots, source > destination and amount, the one turned lit */
/* 0.8: a SHAPE into lane l of the MOD SEQ, over its LEN steps (SHIFT: one step to the left, INVRT: upside down) */
static void mseq_fill(track_t *t, uint32_t l, uint32_t f)
{
uint32_t i, len = (uint32_t)clamp(t->p[P_MSLEN], 1, 16);
int8_t *q = t->ms[l % MSEQ_LANES], first = q[0];
for (i = 0; i < len; i++) {
int32_t v = q[i];
switch (f) {
case QF_UP: v = len > 1u ? -8 + (int32_t)(i * 15u / (len - 1u)) : 0; break;
case QF_DOWN: v = len > 1u ? 7 - (int32_t)(i * 15u / (len - 1u)) : 0; break;
case QF_TRI: {
uint32_t h = (i * 2u * 15u + len / 2u) / len; /* 0 .. 30 and back */
v = (int32_t)(h <= 15u ? h : 30u - h) - 8;
break;
}
case QF_SINE: v = (osc_sine(i * (0xFFFFFFFFu / len)) * 7 + 16383) / 32767; break;
case QF_SQR: v = i < len / 2u ? 7 : -8; break;
case QF_RND: v = (int32_t)(rng() >> 28) - 8; break;
case QF_FLAT: v = 0; break;
case QF_INV: v = clamp(-v, -8, 7); break;
case QF_SHIFT: v = i + 1u < len ? q[i + 1u] : first; break;
default: break;
}
q[i] = (int8_t)clamp(v, -8, 7);
}
}
/* the MOD SEQ's pages: the selected lane large (the step being edited white, the one playing lit, past LEN dim), the
* four lanes small below it */
static void graph_mseq(void)
{
const track_t *t = TSEL;
uint32_t i, l, lane = (uint32_t)clamp(xv[X_QLANE], 1, 4) - 1u, st = (uint32_t)clamp(xv[X_QSTEP], 1, 16) - 1u;
uint32_t len = (uint32_t)clamp(t->p[P_MSLEN], 1, 16), play = t->ms_step;
int edit = cur_page()->id[0] == X_QLANE;
cv_rect(6, 30, 228, 1, C_LINE);
for (i = 0; i < MSEQ_STEPS; i++) {
int32_t v = t->ms[lane][i], x = 8 + (int32_t)i * 14, h = v * 3;
uint16_t c = i >= len ? C_DIM : i == play ? C_HI : C_GRAY;
if (edit && i == st)
c = C_WHITE;
if (h >= 0)
cv_rect(x, 30 - h, 11, h ? h : 1, c);
else
cv_rect(x, 31, 11, -h, c);
if (edit && i == st)
cv_rect(x, 56, 11, 2, C_WHITE);
}
for (l = 0; l < MSEQ_LANES; l++) {
int32_t x0 = 6 + (int32_t)l * 58;
char b[3] = {'S', (char)('1' + l), 0};
cv_text(x0, 62, &FONT_S, b, l == lane ? C_HI : C_DIM);
for (i = 0; i < MSEQ_STEPS; i++) {
int32_t v = t->ms[l][i], x = x0 + 16 + (int32_t)i * 2;
cv_rect(x, v >= 0 ? 70 - v : 71, 1, v >= 0 ? (v ? v : 1) : -v, i >= len ? C_DIM : l == lane ? C_HI : C_GRAY);
}
}
}
static void graph_matrix(void)
{
const track_t *t = TSEL;
+103 -5
View File
@@ -43,7 +43,7 @@ _Static_assert(P_COUNT < 128, "user preset record: P_COUNT");
* Clipper 0.4's own bank (232-byte records, np 86) is read and made this one (up_bank_check) */
#define UP_E0V 53u /* P_E0 of SLOOP 2.4 / 2.5 and of the stored layout */
#define UP_NP (UP_E0V + 8u)
#define UP_NX ((uint32_t)P_E0 - UP_E0V) /* the Clipper parameters packed */
#define UP_NX ((uint32_t)P_IMIX + 1u - UP_E0V) /* the Clipper parameters packed (0.8's MOD SEQ and SPICE: up_side) */
#define UP_NX4 25u /* .. by 0.4 / 0.5 (LFO 2, ENV 2, the matrix) */
#define UP_XMAGIC 0x434C /* "CL": a 0.4 / 0.5 record (p[71]) */
#define UP_XMAGIC6 0x4Du /* 0.6: p[71]'s low byte; its high byte the stream's bits 160..167 */
@@ -53,8 +53,9 @@ _Static_assert(P_COUNT < 128, "user preset record: P_COUNT");
#define UP_E004 78u /* SLOOP 2.6's records: its INSERT at p[53..57] */
static const uint8_t UP_XW[UP_NX] = {7, 3, 1, 7, 7, 7, 7, 4, 4, 7, 4, 4, 7, 4, 4, 7, 4, 4, 7, 4, 4, 7, 4, 4, 7,
4, 7, 7, 7, 7}; /* bits (0.6: + the INSERT's TYPE, A, B, C, MIX) */
_Static_assert(UP_NX == 30u && P_L2RATE == UP_E0V && P_ITYPE == UP_E0V + UP_NX4 && P_IMIX == P_E0 - 1,
"the packed parameters, in order");
_Static_assert(UP_NX == 30u && P_L2RATE == UP_E0V && P_ITYPE == UP_E0V + UP_NX4 && P_IMIX + 1 == P_MSRATE &&
P_DICE == P_E0 - 1, "the packed parameters, in order");
#define UP_XMS 161u /* (0.8) a bit of the stream: note / flags hold the MOD SEQ's steps */
/* bit k of the packed stream: the record's p[UP_NP + k / 16] for k < 160, then p[71]'s high byte */
static int16_t *up_xword(int16_t *p, uint32_t k, uint32_t *sh)
{
@@ -104,6 +105,57 @@ static int up_xrec(const up_rec_t *r)
}
static uint8_t up_ld[8u + UP_PER_BANK * UP_RSIZE_04] __attribute__((section(".pool"))); /* (a 0.4 bank, loading) */
static up_bank_t up_bank[UP_SLOTS / UP_PER_BANK] __attribute__((section(".pool")));
/* 0.8: what the record has no room for (the MOD SEQ's RATE LEN SMTH START, SPICE, DICE: UP_NS values) rides in the
* bank's side record (storage.c st_side: SLOOP never sees it), a slot's bytes v[0] = 1 (set), then each value - its
* minimum; a slot without them (an older save, SLOOP's) loads their defaults. The steps: the record's note / flags
* (16 + 16 bytes, two steps a byte, + 8: SLOOP stores its pattern there and loads none of it), marked by UP_XMS */
#define UP_NS ((uint32_t)P_E0 - P_MSRATE)
#define UP_SIDE_MAGIC 0x38535055u /* "UPS8" */
typedef struct {
uint32_t magic;
uint8_t v[UP_PER_BANK][8];
uint32_t crc;
} up_side_t;
_Static_assert(UP_NS == 6u && sizeof(up_side_t) == 136u, "the user presets' side record");
static up_side_t up_side[UP_SLOTS / UP_PER_BANK];
static uint8_t up_xs[8]; /* the side bytes of the record up_rec_set made last (up_put's) */
static const uint8_t *up_side_of(const up_rec_t *r) /* a record's side bytes, 0 = none */
{
uint32_t b;
for (b = 0; b < UP_SLOTS / UP_PER_BANK; b++)
if (r >= up_bank[b].r && r < up_bank[b].r + UP_PER_BANK)
return up_side[b].magic == UP_SIDE_MAGIC ? up_side[b].v[r - up_bank[b].r] : 0;
return up_xs;
}
static int up_has_ms(const up_rec_t *r) /* note / flags hold the MOD SEQ */
{
uint32_t sh;
const int16_t *w;
if (up_xrec(r) != 6)
return 0;
w = up_xword((int16_t *)r->p, UP_XMS, &sh);
return ((uint16_t)*w >> sh) & 1u;
}
static void up_ms_put(up_rec_t *r, int8_t (*ms)[MSEQ_STEPS]) /* (after up_rec_set) */
{
uint32_t n, sh;
int16_t *w = up_xword(r->p, UP_XMS, &sh);
for (n = 0; n < 32u; n++) {
uint32_t lo = (uint32_t)clamp(ms[(2u * n) / MSEQ_STEPS][(2u * n) % MSEQ_STEPS] + 8, 0, 15);
uint32_t hi = (uint32_t)clamp(ms[(2u * n + 1u) / MSEQ_STEPS][(2u * n + 1u) % MSEQ_STEPS] + 8, 0, 15);
(n < 16u ? r->note : r->flags)[n % 16u] = (uint8_t)(lo | hi << 4);
}
*w = (int16_t)((uint16_t)*w | (uint16_t)(1u << sh));
}
static void up_ms_get(const up_rec_t *r, int8_t (*ms)[MSEQ_STEPS])
{
uint32_t n;
for (n = 0; n < 32u; n++) {
uint32_t b = (n < 16u ? r->note : r->flags)[n % 16u];
ms[(2u * n) / MSEQ_STEPS][(2u * n) % MSEQ_STEPS] = (int8_t)((int32_t)(b & 15u) - 8);
ms[(2u * n + 1u) / MSEQ_STEPS][(2u * n + 1u) % MSEQ_STEPS] = (int8_t)((int32_t)(b >> 4) - 8);
}
}
#else
#define UP_E0V ((uint32_t)P_E0)
static up_bank_t up_bank[UP_SLOTS / UP_PER_BANK];
@@ -130,6 +182,9 @@ static void up_rec_set(up_rec_t *r, const int16_t *v)
for (i = 0; i < 8u; i++)
r->p[UP_E0V + i] = v[P_E0 + i];
up_xpack(r->p, &v[UP_E0V]);
up_xs[0] = 1;
for (i = 0; i < UP_NS; i++)
up_xs[1u + i] = (uint8_t)clamp(v[P_MSRATE + i] - TP[P_MSRATE + i].min, 0, 255);
#else
r->np = P_COUNT;
for (i = 0; i < P_COUNT; i++)
@@ -151,6 +206,11 @@ static void up_params(const up_rec_t *r, int16_t *out, const int16_t *def)
else if (r->np == UP_NP_V26) /* SLOOP 2.6's: its INSERT, the same types and values */
for (i = 0; i < 5u; i++)
out[P_ITYPE + i] = r->p[UP_E0V + i];
{
const uint8_t *sd = up_xrec(r) ? up_side_of(r) : 0; /* (0.8) the MOD SEQ's and SPICE's: the side's */
for (i = 0; i < UP_NS; i++)
out[P_MSRATE + i] = sd && sd[0] == 1u ? (int16_t)(sd[1u + i] + TP[P_MSRATE + i].min) : def[P_MSRATE + i];
}
#endif
}
@@ -307,8 +367,15 @@ static void up_boot(void) /* persist_boot: the banks from f
uint32_t b;
for (b = 0; b < UP_SLOTS / UP_PER_BANK; b++)
#if CLIPPER_SYNTH
{
memset(&up_side[b], 0, sizeof up_side[b]);
if (up_bank_import(b, up_ld, flash_ok ? st_load(OBJ_UPRESET0 + b, up_ld, sizeof up_ld) : -1))
st_save(OBJ_UPRESET0 + b, &up_bank[b], sizeof up_bank[b]); /* (a 0.4 bank: written back as SLOOP reads it) */
else if (flash_ok && (st_side_load(OBJ_UPRESET0 + b, &up_side[b], sizeof up_side[b]) ||
up_side[b].magic != UP_SIDE_MAGIC ||
up_side[b].crc != st_crc32(&up_side[b], sizeof up_side[b] - 4u)))
memset(&up_side[b], 0, sizeof up_side[b]); /* (0.8: none, or another firmware's) */
}
#else
up_bank_check(b, flash_ok ? st_load(OBJ_UPRESET0 + b, &up_bank[b], sizeof up_bank[b]) : -1);
#endif
@@ -326,6 +393,19 @@ static int up_put(uint32_t k, const up_rec_t *r)
*up_rec(k) = *r;
else
memset(up_rec(k), 0, sizeof(up_rec_t));
#if CLIPPER_SYNTH
{ /* (0.8) its side bytes: up_rec_set's (made just before), none when erased */
up_side_t *sd = &up_side[k / UP_PER_BANK];
if (sd->magic != UP_SIDE_MAGIC)
memset(sd, 0, sizeof *sd);
sd->magic = UP_SIDE_MAGIC;
if (r)
memcpy(sd->v[k % UP_PER_BANK], up_xs, sizeof up_xs);
else
memset(sd->v[k % UP_PER_BANK], 0, sizeof sd->v[0]);
sd->crc = st_crc32(sd, sizeof *sd - 4u);
}
#endif
if (!r) {
uint32_t i;
for (i = 0; i < NTRK; i++)
@@ -334,8 +414,16 @@ static int up_put(uint32_t k, const up_rec_t *r)
}
up_gen++;
#if FELUCCA_FLASH
if (flash_ok)
return st_save(OBJ_UPRESET0 + k / UP_PER_BANK, bk, sizeof *bk) ? 2 : 0;
if (flash_ok) {
int rc;
#if CLIPPER_SYNTH
st_side = &up_side[k / UP_PER_BANK];
st_side_len = sizeof(up_side_t);
#endif
rc = st_save(OBJ_UPRESET0 + k / UP_PER_BANK, bk, sizeof *bk);
st_side = 0;
return rc ? 2 : 0;
}
#endif
return 3;
}
@@ -373,7 +461,11 @@ static int up_store(uint32_t k, const char *name)
r.name[i] = b[i];
}
up_rec_set(&r, TSEL->p);
#if CLIPPER_SYNTH
up_ms_put(&r, TSEL->ms); /* (0.8) the MOD SEQ's steps where the pattern was */
#else
up_pat_from(&r, TSEL->step);
#endif
return up_put(k, &r);
}
@@ -409,6 +501,12 @@ static int up_load_to(track_t *t, uint32_t k)
t->eng_req = r->engine;
for (i = 0; i < P_COUNT; i++)
t->p[i] = v[i];
#if CLIPPER_SYNTH
if (up_has_ms(r)) /* (0.8) its MOD SEQ, or the shapes to start from */
up_ms_get(r, t->ms);
else
mseq_init(t);
#endif
t->preset = 0;
fm1_irq_on();
fm6_track_loaded(t); /* FM6: a user preset holds the PTCH and the macros */
+711
View File
@@ -0,0 +1,711 @@
/* generated by tools/gen_vector.py: VECTOR's waves, 16 x (512 + 128 + 32) int16 (eng_vector.c) */
#pragma once
#define VEC_NW 16u
#define VEC_PTS (512u + 128u + 32u)
static const char *const N_VEC_WAVE[VEC_NW] = {"SINE", "TRI", "SAW", "SQR", "PLS25", "PLS10", "ORGAN", "VOX A", "VOX O", "BELL", "HOLLW", "BRASS", "RESO", "DIGI", "STRNG", "METAL"};
static const int16_t VEC_WAVE[VEC_NW][VEC_PTS] = {
{ /* SINE */
0, 362, 724, 1085, 1447, 1808, 2169, 2530, 2890, 3250, 3609, 3968, 4326, 4684, 5040, 5396,
5752, 6106, 6460, 6812, 7164, 7514, 7863, 8211, 8558, 8904, 9248, 9591, 9932, 10272, 10611, 10947,
11282, 11616, 11948, 12277, 12605, 12932, 13256, 13578, 13898, 14216, 14532, 14846, 15157, 15466, 15773, 16078,
16380, 16679, 16976, 17271, 17563, 17852, 18139, 18422, 18704, 18982, 19257, 19530, 19799, 20066, 20329, 20590,
20847, 21102, 21353, 21601, 21845, 22086, 22324, 22559, 22790, 23018, 23242, 23463, 23681, 23894, 24104, 24311,
24514, 24713, 24908, 25100, 25288, 25472, 25652, 25829, 26001, 26170, 26335, 26495, 26652, 26805, 26953, 27098,
27238, 27375, 27507, 27635, 27759, 27879, 27995, 28106, 28213, 28316, 28415, 28509, 28599, 28685, 28766, 28843,
28916, 28984, 29049, 29108, 29163, 29214, 29261, 29303, 29341, 29374, 29403, 29427, 29447, 29463, 29474, 29480,
29483, 29480, 29474, 29463, 29447, 29427, 29403, 29374, 29341, 29303, 29261, 29214, 29163, 29108, 29049, 28984,
28916, 28843, 28766, 28685, 28599, 28509, 28415, 28316, 28213, 28106, 27995, 27879, 27759, 27635, 27507, 27375,
27238, 27098, 26953, 26805, 26652, 26495, 26335, 26170, 26001, 25829, 25652, 25472, 25288, 25100, 24908, 24713,
24514, 24311, 24104, 23894, 23681, 23463, 23242, 23018, 22790, 22559, 22324, 22086, 21845, 21601, 21353, 21102,
20847, 20590, 20329, 20066, 19799, 19530, 19257, 18982, 18704, 18422, 18139, 17852, 17563, 17271, 16976, 16679,
16380, 16078, 15773, 15466, 15157, 14846, 14532, 14216, 13898, 13578, 13256, 12932, 12605, 12277, 11948, 11616,
11282, 10947, 10611, 10272, 9932, 9591, 9248, 8904, 8558, 8211, 7863, 7514, 7164, 6812, 6460, 6106,
5752, 5396, 5040, 4684, 4326, 3968, 3609, 3250, 2890, 2530, 2169, 1808, 1447, 1085, 724, 362,
0, -362, -724, -1085, -1447, -1808, -2169, -2530, -2890, -3250, -3609, -3968, -4326, -4684, -5040, -5396,
-5752, -6106, -6460, -6812, -7164, -7514, -7863, -8211, -8558, -8904, -9248, -9591, -9932, -10272, -10611, -10947,
-11282, -11616, -11948, -12277, -12605, -12932, -13256, -13578, -13898, -14216, -14532, -14846, -15157, -15466, -15773, -16078,
-16380, -16679, -16976, -17271, -17563, -17852, -18139, -18422, -18704, -18982, -19257, -19530, -19799, -20066, -20329, -20590,
-20847, -21102, -21353, -21601, -21845, -22086, -22324, -22559, -22790, -23018, -23242, -23463, -23681, -23894, -24104, -24311,
-24514, -24713, -24908, -25100, -25288, -25472, -25652, -25829, -26001, -26170, -26335, -26495, -26652, -26805, -26953, -27098,
-27238, -27375, -27507, -27635, -27759, -27879, -27995, -28106, -28213, -28316, -28415, -28509, -28599, -28685, -28766, -28843,
-28916, -28984, -29049, -29108, -29163, -29214, -29261, -29303, -29341, -29374, -29403, -29427, -29447, -29463, -29474, -29480,
-29483, -29480, -29474, -29463, -29447, -29427, -29403, -29374, -29341, -29303, -29261, -29214, -29163, -29108, -29049, -28984,
-28916, -28843, -28766, -28685, -28599, -28509, -28415, -28316, -28213, -28106, -27995, -27879, -27759, -27635, -27507, -27375,
-27238, -27098, -26953, -26805, -26652, -26495, -26335, -26170, -26001, -25829, -25652, -25472, -25288, -25100, -24908, -24713,
-24514, -24311, -24104, -23894, -23681, -23463, -23242, -23018, -22790, -22559, -22324, -22086, -21845, -21601, -21353, -21102,
-20847, -20590, -20329, -20066, -19799, -19530, -19257, -18982, -18704, -18422, -18139, -17852, -17563, -17271, -16976, -16679,
-16380, -16078, -15773, -15466, -15157, -14846, -14532, -14216, -13898, -13578, -13256, -12932, -12605, -12277, -11948, -11616,
-11282, -10947, -10611, -10272, -9932, -9591, -9248, -8904, -8558, -8211, -7863, -7514, -7164, -6812, -6460, -6106,
-5752, -5396, -5040, -4684, -4326, -3968, -3609, -3250, -2890, -2530, -2169, -1808, -1447, -1085, -724, -362,
0, 1441, 2879, 4310, 5731, 7137, 8527, 9896, 11241, 12559, 13847, 15101, 16319, 17498, 18635, 19726,
20771, 21765, 22706, 23593, 24424, 25195, 25906, 26554, 27138, 27657, 28109, 28494, 28810, 29056, 29233, 29339,
29374, 29339, 29233, 29056, 28810, 28494, 28109, 27657, 27138, 26554, 25906, 25195, 24424, 23593, 22706, 21765,
20771, 19726, 18635, 17498, 16319, 15101, 13847, 12559, 11241, 9896, 8527, 7137, 5731, 4310, 2879, 1441,
0, -1441, -2879, -4310, -5731, -7137, -8527, -9896, -11241, -12559, -13847, -15101, -16319, -17498, -18635, -19726,
-20771, -21765, -22706, -23593, -24424, -25195, -25906, -26554, -27138, -27657, -28109, -28494, -28810, -29056, -29233, -29339,
-29374, -29339, -29233, -29056, -28810, -28494, -28109, -27657, -27138, -26554, -25906, -25195, -24424, -23593, -22706, -21765,
-20771, -19726, -18635, -17498, -16319, -15101, -13847, -12559, -11241, -9896, -8527, -7137, -5731, -4310, -2879, -1441,
0, 5753, 11285, 16384, 20853, 24520, 27245, 28924, 29490, 28924, 27245, 24520, 20853, 16384, 11285, 5753,
0, -5753, -11285, -16384, -20853, -24520, -27245, -28924, -29490, -28924, -27245, -24520, -20853, -16384, -11285, -5753,
},
{ /* TRI */
0, 233, 466, 700, 933, 1166, 1399, 1633, 1866, 2099, 2332, 2566, 2799, 3032, 3265, 3498,
3732, 3965, 4198, 4431, 4665, 4898, 5131, 5364, 5597, 5831, 6064, 6297, 6530, 6764, 6997, 7230,
7463, 7697, 7930, 8163, 8396, 8629, 8863, 9096, 9329, 9562, 9796, 10029, 10262, 10495, 10728, 10962,
11195, 11428, 11661, 11895, 12128, 12361, 12594, 12828, 13061, 13294, 13527, 13760, 13994, 14227, 14460, 14693,
14927, 15160, 15393, 15626, 15859, 16093, 16326, 16559, 16792, 17026, 17259, 17492, 17725, 17959, 18192, 18425,
18658, 18891, 19125, 19358, 19591, 19824, 20058, 20291, 20524, 20757, 20990, 21224, 21457, 21690, 21923, 22157,
22390, 22623, 22856, 23090, 23323, 23556, 23789, 24022, 24256, 24489, 24722, 24955, 25189, 25422, 25655, 25888,
26122, 26355, 26588, 26821, 27054, 27288, 27521, 27754, 27987, 28220, 28454, 28690, 28923, 29141, 29324, 29447,
29490, 29447, 29324, 29141, 28923, 28690, 28454, 28220, 27987, 27754, 27521, 27288, 27054, 26821, 26588, 26355,
26122, 25888, 25655, 25422, 25189, 24955, 24722, 24489, 24256, 24022, 23789, 23556, 23323, 23090, 22856, 22623,
22390, 22157, 21923, 21690, 21457, 21224, 20990, 20757, 20524, 20291, 20058, 19824, 19591, 19358, 19125, 18891,
18658, 18425, 18192, 17959, 17725, 17492, 17259, 17026, 16792, 16559, 16326, 16093, 15859, 15626, 15393, 15160,
14927, 14693, 14460, 14227, 13994, 13760, 13527, 13294, 13061, 12828, 12594, 12361, 12128, 11895, 11661, 11428,
11195, 10962, 10728, 10495, 10262, 10029, 9796, 9562, 9329, 9096, 8863, 8629, 8396, 8163, 7930, 7697,
7463, 7230, 6997, 6764, 6530, 6297, 6064, 5831, 5597, 5364, 5131, 4898, 4665, 4431, 4198, 3965,
3732, 3498, 3265, 3032, 2799, 2566, 2332, 2099, 1866, 1633, 1399, 1166, 933, 700, 466, 233,
0, -233, -466, -700, -933, -1166, -1399, -1633, -1866, -2099, -2332, -2566, -2799, -3032, -3265, -3498,
-3732, -3965, -4198, -4431, -4665, -4898, -5131, -5364, -5597, -5831, -6064, -6297, -6530, -6764, -6997, -7230,
-7463, -7697, -7930, -8163, -8396, -8629, -8863, -9096, -9329, -9562, -9796, -10029, -10262, -10495, -10728, -10962,
-11195, -11428, -11661, -11895, -12128, -12361, -12594, -12828, -13061, -13294, -13527, -13760, -13994, -14227, -14460, -14693,
-14927, -15160, -15393, -15626, -15859, -16093, -16326, -16559, -16792, -17026, -17259, -17492, -17725, -17959, -18192, -18425,
-18658, -18891, -19125, -19358, -19591, -19824, -20058, -20291, -20524, -20757, -20990, -21224, -21457, -21690, -21923, -22157,
-22390, -22623, -22856, -23090, -23323, -23556, -23789, -24022, -24256, -24489, -24722, -24955, -25189, -25422, -25655, -25888,
-26122, -26355, -26588, -26821, -27054, -27288, -27521, -27754, -27987, -28220, -28454, -28690, -28923, -29141, -29324, -29447,
-29490, -29447, -29324, -29141, -28923, -28690, -28454, -28220, -27987, -27754, -27521, -27288, -27054, -26821, -26588, -26355,
-26122, -25888, -25655, -25422, -25189, -24955, -24722, -24489, -24256, -24022, -23789, -23556, -23323, -23090, -22856, -22623,
-22390, -22157, -21923, -21690, -21457, -21224, -20990, -20757, -20524, -20291, -20058, -19824, -19591, -19358, -19125, -18891,
-18658, -18425, -18192, -17959, -17725, -17492, -17259, -17026, -16792, -16559, -16326, -16093, -15859, -15626, -15393, -15160,
-14927, -14693, -14460, -14227, -13994, -13760, -13527, -13294, -13061, -12828, -12594, -12361, -12128, -11895, -11661, -11428,
-11195, -10962, -10728, -10495, -10262, -10029, -9796, -9562, -9329, -9096, -8863, -8629, -8396, -8163, -7930, -7697,
-7463, -7230, -6997, -6764, -6530, -6297, -6064, -5831, -5597, -5364, -5131, -4898, -4665, -4431, -4198, -3965,
-3732, -3498, -3265, -3032, -2799, -2566, -2332, -2099, -1866, -1633, -1399, -1166, -933, -700, -466, -233,
0, 933, 1866, 2799, 3732, 4665, 5597, 6530, 7463, 8396, 9329, 10262, 11195, 12128, 13061, 13993,
14926, 15860, 16793, 17725, 18658, 19591, 20525, 21458, 22389, 23319, 24254, 25197, 26133, 27016, 27761, 28266,
28445, 28266, 27761, 27016, 26133, 25197, 24254, 23319, 22389, 21458, 20525, 19591, 18658, 17725, 16793, 15860,
14926, 13993, 13061, 12128, 11195, 10262, 9329, 8396, 7463, 6530, 5597, 4665, 3732, 2799, 1866, 933,
0, -933, -1866, -2799, -3732, -4665, -5597, -6530, -7463, -8396, -9329, -10262, -11195, -12128, -13061, -13993,
-14926, -15860, -16793, -17725, -18658, -19591, -20525, -21458, -22389, -23319, -24254, -25197, -26133, -27016, -27761, -28266,
-28445, -28266, -27761, -27016, -26133, -25197, -24254, -23319, -22389, -21458, -20525, -19591, -18658, -17725, -16793, -15860,
-14926, -13993, -13061, -12128, -11195, -10262, -9329, -8396, -7463, -6530, -5597, -4665, -3732, -2799, -1866, -933,
0, 4032, 7670, 10996, 14525, 18646, 23015, 26506, 27855, 26506, 23015, 18646, 14525, 10996, 7670, 4032,
0, -4032, -7670, -10996, -14525, -18646, -23015, -26506, -27855, -26506, -23015, -18646, -14525, -10996, -7670, -4032,
},
{ /* SAW */
0, 10547, 19271, 25090, 27986, 28781, 28573, 28195, 27996, 27950, 27910, 27803, 27652, 27514, 27409, 27316,
27210, 27087, 26963, 26850, 26744, 26636, 26520, 26401, 26286, 26176, 26066, 25952, 25836, 25721, 25609, 25498,
25385, 25270, 25156, 25043, 24931, 24818, 24704, 24590, 24476, 24364, 24251, 24137, 24023, 23910, 23797, 23684,
23571, 23457, 23343, 23230, 23117, 23004, 22890, 22777, 22664, 22551, 22437, 22324, 22210, 22097, 21984, 21871,
21757, 21644, 21530, 21417, 21304, 21191, 21077, 20964, 20851, 20737, 20624, 20511, 20397, 20284, 20171, 20058,
19944, 19831, 19717, 19604, 19491, 19378, 19264, 19151, 19038, 18924, 18811, 18698, 18584, 18471, 18358, 18244,
18131, 18018, 17904, 17791, 17678, 17564, 17451, 17338, 17224, 17111, 16998, 16885, 16771, 16658, 16545, 16431,
16318, 16205, 16091, 15978, 15865, 15751, 15638, 15525, 15411, 15298, 15185, 15071, 14958, 14845, 14731, 14618,
14505, 14391, 14278, 14165, 14052, 13938, 13825, 13712, 13598, 13485, 13372, 13258, 13145, 13032, 12918, 12805,
12692, 12578, 12465, 12352, 12238, 12125, 12012, 11898, 11785, 11672, 11559, 11445, 11332, 11219, 11105, 10992,
10879, 10765, 10652, 10539, 10425, 10312, 10199, 10085, 9972, 9859, 9745, 9632, 9519, 9405, 9292, 9179,
9066, 8952, 8839, 8726, 8612, 8499, 8386, 8272, 8159, 8046, 7932, 7819, 7706, 7592, 7479, 7366,
7252, 7139, 7026, 6912, 6799, 6686, 6572, 6459, 6346, 6233, 6119, 6006, 5893, 5779, 5666, 5553,
5439, 5326, 5213, 5099, 4986, 4873, 4759, 4646, 4533, 4419, 4306, 4193, 4079, 3966, 3853, 3740,
3626, 3513, 3400, 3286, 3173, 3060, 2946, 2833, 2720, 2606, 2493, 2380, 2266, 2153, 2040, 1926,
1813, 1700, 1586, 1473, 1360, 1247, 1133, 1020, 907, 793, 680, 567, 453, 340, 227, 113,
0, -113, -227, -340, -453, -567, -680, -793, -907, -1020, -1133, -1247, -1360, -1473, -1586, -1700,
-1813, -1926, -2040, -2153, -2266, -2380, -2493, -2606, -2720, -2833, -2946, -3060, -3173, -3286, -3400, -3513,
-3626, -3740, -3853, -3966, -4079, -4193, -4306, -4419, -4533, -4646, -4759, -4873, -4986, -5099, -5213, -5326,
-5439, -5553, -5666, -5779, -5893, -6006, -6119, -6233, -6346, -6459, -6572, -6686, -6799, -6912, -7026, -7139,
-7252, -7366, -7479, -7592, -7706, -7819, -7932, -8046, -8159, -8272, -8386, -8499, -8612, -8726, -8839, -8952,
-9066, -9179, -9292, -9405, -9519, -9632, -9745, -9859, -9972, -10085, -10199, -10312, -10425, -10539, -10652, -10765,
-10879, -10992, -11105, -11219, -11332, -11445, -11559, -11672, -11785, -11898, -12012, -12125, -12238, -12352, -12465, -12578,
-12692, -12805, -12918, -13032, -13145, -13258, -13372, -13485, -13598, -13712, -13825, -13938, -14052, -14165, -14278, -14391,
-14505, -14618, -14731, -14845, -14958, -15071, -15185, -15298, -15411, -15525, -15638, -15751, -15865, -15978, -16091, -16205,
-16318, -16431, -16545, -16658, -16771, -16885, -16998, -17111, -17224, -17338, -17451, -17564, -17678, -17791, -17904, -18018,
-18131, -18244, -18358, -18471, -18584, -18698, -18811, -18924, -19038, -19151, -19264, -19378, -19491, -19604, -19717, -19831,
-19944, -20058, -20171, -20284, -20397, -20511, -20624, -20737, -20851, -20964, -21077, -21191, -21304, -21417, -21530, -21644,
-21757, -21871, -21984, -22097, -22210, -22324, -22437, -22551, -22664, -22777, -22890, -23004, -23117, -23230, -23343, -23457,
-23571, -23684, -23797, -23910, -24023, -24137, -24251, -24364, -24476, -24590, -24704, -24818, -24931, -25043, -25156, -25270,
-25385, -25498, -25609, -25721, -25836, -25952, -26066, -26176, -26286, -26401, -26520, -26636, -26744, -26850, -26963, -27087,
-27210, -27316, -27409, -27514, -27652, -27803, -27910, -27950, -27996, -28195, -28573, -28781, -27986, -25090, -19271, -10547,
0, 10516, 19048, 24465, 26830, 27106, 26479, 25778, 25284, 24915, 24520, 24052, 23559, 23094, 22659, 22223,
21767, 21301, 20842, 20395, 19949, 19495, 19037, 18580, 18129, 17680, 17227, 16771, 16316, 15863, 15412, 14960,
14505, 14050, 13597, 13145, 12693, 12239, 11784, 11331, 10879, 10426, 9972, 9518, 9065, 8612, 8159, 7706,
7252, 6799, 6346, 5893, 5439, 4986, 4533, 4079, 3626, 3173, 2720, 2266, 1813, 1360, 907, 453,
0, -453, -907, -1360, -1813, -2266, -2720, -3173, -3626, -4079, -4533, -4986, -5439, -5893, -6346, -6799,
-7252, -7706, -8159, -8612, -9065, -9518, -9972, -10426, -10879, -11331, -11784, -12239, -12693, -13145, -13597, -14050,
-14505, -14960, -15412, -15863, -16316, -16771, -17227, -17680, -18129, -18580, -19037, -19495, -19949, -20395, -20842, -21301,
-21767, -22223, -22659, -23094, -23559, -24052, -24520, -24915, -25284, -25778, -26479, -27106, -26830, -24465, -19048, -10516,
0, 19736, 29490, 27637, 20956, 17023, 17382, 18159, 16006, 11934, 9204, 8845, 8644, 6401, 2844, 452,
0, -452, -2844, -6401, -8644, -8845, -9204, -11934, -16006, -18159, -17382, -17023, -20956, -27637, -29490, -19736,
},
{ /* SQR */
0, 9236, 16893, 22033, 24640, 25427, 25345, 25115, 25041, 25099, 25164, 25168, 25136, 25115, 25122, 25140,
25146, 25137, 25128, 25128, 25135, 25139, 25137, 25132, 25131, 25134, 25137, 25136, 25134, 25132, 25133, 25135,
25136, 25134, 25133, 25133, 25135, 25135, 25135, 25134, 25134, 25134, 25135, 25135, 25134, 25134, 25134, 25135,
25135, 25134, 25134, 25134, 25134, 25135, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134,
25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25134, 25135, 25134, 25134, 25134, 25134,
25135, 25135, 25134, 25134, 25134, 25135, 25135, 25134, 25134, 25134, 25135, 25135, 25135, 25133, 25133, 25134,
25136, 25135, 25133, 25132, 25134, 25136, 25137, 25134, 25131, 25132, 25137, 25139, 25135, 25128, 25128, 25137,
25146, 25140, 25122, 25115, 25136, 25168, 25164, 25099, 25041, 25115, 25345, 25427, 24640, 22033, 16893, 9236,
0, -9236, -16893, -22033, -24640, -25427, -25345, -25115, -25041, -25099, -25164, -25168, -25136, -25115, -25122, -25140,
-25146, -25137, -25128, -25128, -25135, -25139, -25137, -25132, -25131, -25134, -25137, -25136, -25134, -25132, -25133, -25135,
-25136, -25134, -25133, -25133, -25135, -25135, -25135, -25134, -25134, -25134, -25135, -25135, -25134, -25134, -25134, -25135,
-25135, -25134, -25134, -25134, -25134, -25135, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134,
-25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25134, -25135, -25134, -25134, -25134, -25134,
-25135, -25135, -25134, -25134, -25134, -25135, -25135, -25134, -25134, -25134, -25135, -25135, -25135, -25133, -25133, -25134,
-25136, -25135, -25133, -25132, -25134, -25136, -25137, -25134, -25131, -25132, -25137, -25139, -25135, -25128, -25128, -25137,
-25146, -25140, -25122, -25115, -25136, -25168, -25164, -25099, -25041, -25115, -25345, -25427, -24640, -22033, -16893, -9236,
0, 9504, 17289, 22375, 24817, 25449, 25298, 25084, 25048, 25121, 25172, 25159, 25125, 25115, 25130, 25144,
25142, 25132, 25127, 25132, 25138, 25138, 25134, 25131, 25133, 25136, 25136, 25134, 25133, 25134, 25134, 25135,
25134, 25135, 25134, 25134, 25133, 25134, 25136, 25136, 25133, 25131, 25134, 25138, 25138, 25132, 25127, 25132,
25142, 25144, 25130, 25115, 25125, 25159, 25172, 25121, 25048, 25084, 25298, 25449, 24817, 22375, 17289, 9504,
0, -9504, -17289, -22375, -24817, -25449, -25298, -25084, -25048, -25121, -25172, -25159, -25125, -25115, -25130, -25144,
-25142, -25132, -25127, -25132, -25138, -25138, -25134, -25131, -25133, -25136, -25136, -25134, -25133, -25134, -25134, -25135,
-25134, -25135, -25134, -25134, -25133, -25134, -25136, -25136, -25133, -25131, -25134, -25138, -25138, -25132, -25127, -25132,
-25142, -25144, -25130, -25115, -25125, -25159, -25172, -25121, -25048, -25084, -25298, -25449, -24817, -22375, -17289, -9504,
0, 17491, 28015, 29490, 25646, 22412, 23034, 26073, 27735, 26073, 23034, 22412, 25646, 29490, 28015, 17491,
0, -17491, -28015, -29490, -25646, -22412, -23034, -26073, -27735, -26073, -23034, -22412, -25646, -29490, -28015, -17491,
},
{ /* PLS25 */
-27378, -27378, -27378, -27378, -27378, -27378, -27378, -27378, -27377, -27378, -27378, -27378, -27378, -27377, -27377, -27378,
-27378, -27378, -27378, -27377, -27378, -27378, -27378, -27378, -27377, -27377, -27378, -27378, -27378, -27377, -27377, -27378,
-27379, -27378, -27377, -27376, -27377, -27379, -27379, -27377, -27375, -27376, -27380, -27381, -27378, -27373, -27373, -27380,
-27386, -27382, -27369, -27363, -27379, -27403, -27399, -27352, -27310, -27364, -27531, -27590, -27019, -25126, -21393, -15833,
-9126, -2419, 3142, 6874, 8767, 9339, 9279, 9112, 9058, 9101, 9147, 9151, 9127, 9112, 9117, 9130,
9134, 9128, 9121, 9122, 9126, 9129, 9128, 9124, 9123, 9125, 9128, 9127, 9126, 9125, 9125, 9127,
9127, 9126, 9125, 9125, 9126, 9127, 9126, 9125, 9125, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9125, 9125, 9126, 9127, 9126, 9125, 9125, 9126,
9127, 9127, 9125, 9125, 9126, 9127, 9128, 9125, 9123, 9124, 9128, 9129, 9126, 9122, 9121, 9128,
9134, 9130, 9117, 9112, 9127, 9151, 9147, 9101, 9058, 9112, 9279, 9339, 8767, 6874, 3142, -2419,
-9126, -15833, -21393, -25126, -27019, -27590, -27531, -27364, -27310, -27352, -27399, -27403, -27379, -27363, -27369, -27382,
-27386, -27380, -27373, -27373, -27378, -27381, -27380, -27376, -27375, -27377, -27379, -27379, -27377, -27376, -27377, -27378,
-27379, -27378, -27377, -27377, -27378, -27378, -27378, -27377, -27377, -27378, -27378, -27378, -27378, -27377, -27378, -27378,
-27378, -27378, -27377, -27377, -27378, -27378, -27378, -27378, -27377, -27378, -27378, -27378, -27378, -27378, -27378, -27378,
-27390, -27383, -27369, -27362, -27374, -27398, -27404, -27366, -27314, -27342, -27499, -27606, -27146, -25373, -21681, -16028,
-9126, -2224, 3429, 7122, 8895, 9354, 9246, 9089, 9063, 9116, 9153, 9144, 9119, 9112, 9123, 9133,
9132, 9124, 9121, 9124, 9129, 9129, 9125, 9123, 9125, 9127, 9128, 9126, 9125, 9125, 9127, 9127,
9126, 9125, 9125, 9126, 9127, 9126, 9125, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126,
9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9126, 9125, 9126, 9127, 9126, 9125, 9125,
9126, 9127, 9127, 9125, 9125, 9126, 9128, 9127, 9125, 9123, 9125, 9129, 9129, 9124, 9121, 9124,
9132, 9133, 9123, 9112, 9119, 9144, 9153, 9116, 9063, 9089, 9246, 9354, 8895, 7122, 3429, -2224,
-9126, -16028, -21681, -25373, -27146, -27606, -27499, -27342, -27314, -27366, -27404, -27398, -27374, -27362, -27369, -27383,
-26370, -28098, -29490, -23843, -10070, 4909, 12763, 11823, 7746, 6683, 9147, 11141, 10070, 7793, 7580, 9592,
10877, 9592, 7580, 7793, 10070, 11141, 9147, 6683, 7746, 11823, 12763, 4909, -10070, -23843, -29490, -28098,
},
{ /* PLS10 */
-28385, -28384, -28381, -28382, -28385, -28386, -28383, -28379, -28381, -28387, -28390, -28383, -28372, -28374, -28393, -28408,
-28390, -28342, -28330, -28422, -28567, -28468, -27588, -25351, -21460, -16160, -10237, -4735, -524, 2035, 3145, 3351,
3223, 3109, 3105, 3151, 3178, 3168, 3147, 3141, 3151, 3160, 3159, 3153, 3149, 3151, 3156, 3157,
3154, 3152, 3152, 3154, 3155, 3154, 3153, 3153, 3154, 3155, 3154, 3153, 3153, 3154, 3154, 3154,
3154, 3153, 3153, 3154, 3154, 3154, 3153, 3153, 3154, 3154, 3154, 3154, 3153, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3153, 3154, 3154, 3154, 3154, 3153, 3153, 3154, 3154, 3154, 3153, 3153,
3154, 3154, 3154, 3154, 3153, 3153, 3154, 3155, 3154, 3153, 3153, 3154, 3155, 3154, 3152, 3152,
3154, 3157, 3156, 3151, 3149, 3153, 3159, 3160, 3151, 3141, 3147, 3168, 3178, 3151, 3105, 3109,
3223, 3351, 3145, 2035, -524, -4735, -10237, -16160, -21460, -25351, -27588, -28468, -28567, -28422, -28330, -28342,
-28390, -28408, -28393, -28374, -28372, -28383, -28390, -28387, -28381, -28379, -28383, -28386, -28385, -28382, -28381, -28384,
-28461, -28516, -28403, -27451, -24978, -20715, -15055, -8953, -3541, 354, 2512, 3289, 3322, 3164, 3092, 3124,
3171, 3178, 3156, 3140, 3145, 3158, 3162, 3155, 3149, 3150, 3155, 3157, 3155, 3151, 3152, 3154,
3156, 3154, 3153, 3152, 3154, 3155, 3154, 3153, 3153, 3154, 3154, 3154, 3153, 3153, 3154, 3154,
3154, 3154, 3153, 3154, 3154, 3154, 3154, 3153, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154,
3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3154, 3153, 3154, 3154, 3154, 3154, 3153, 3154,
3154, 3154, 3154, 3153, 3153, 3154, 3154, 3154, 3153, 3153, 3154, 3155, 3154, 3152, 3153, 3154,
3156, 3154, 3152, 3151, 3155, 3157, 3155, 3150, 3149, 3155, 3162, 3158, 3145, 3140, 3156, 3178,
3171, 3124, 3092, 3164, 3322, 3289, 2512, 354, -3541, -8953, -15055, -20715, -24978, -27451, -28403, -28516,
-29490, -22862, -8189, 3894, 7054, 3773, 840, 1753, 4309, 4835, 3004, 1613, 2493, 4222, 4345, 2773,
1777, 2773, 4345, 4222, 2493, 1613, 3004, 4835, 4309, 1753, 840, 3773, 7054, 3894, -8189, -22862,
},
{ /* ORGAN */
0, 1665, 3324, 4971, 6600, 8205, 9779, 11319, 12818, 14271, 15674, 17023, 18313, 19540, 20702, 21796,
22819, 23770, 24647, 25449, 26175, 26827, 27403, 27904, 28333, 28690, 28978, 29200, 29357, 29452, 29490, 29474,
29407, 29294, 29138, 28944, 28716, 28458, 28175, 27870, 27549, 27214, 26870, 26521, 26170, 25820, 25475, 25137,
24808, 24492, 24189, 23902, 23632, 23379, 23144, 22927, 22730, 22550, 22387, 22242, 22111, 21995, 21891, 21798,
21714, 21637, 21564, 21494, 21423, 21351, 21273, 21189, 21096, 20992, 20875, 20743, 20595, 20428, 20242, 20035,
19807, 19557, 19285, 18990, 18673, 18333, 17972, 17591, 17190, 16771, 16335, 15884, 15420, 14945, 14461, 13970,
13475, 12978, 12482, 11989, 11502, 11023, 10554, 10098, 9657, 9234, 8829, 8446, 8085, 7748, 7436, 7150,
6891, 6660, 6456, 6279, 6131, 6009, 5914, 5844, 5799, 5777, 5777, 5797, 5836, 5890, 5960, 6041,
6133, 6233, 6339, 6448, 6559, 6670, 6778, 6881, 6978, 7068, 7148, 7217, 7274, 7318, 7349, 7365,
7367, 7355, 7328, 7287, 7232, 7164, 7085, 6994, 6894, 6785, 6670, 6549, 6426, 6300, 6175, 6052,
5933, 5820, 5714, 5618, 5532, 5459, 5399, 5354, 5325, 5313, 5318, 5340, 5380, 5437, 5512, 5603,
5710, 5832, 5967, 6114, 6270, 6435, 6606, 6780, 6955, 7128, 7297, 7459, 7611, 7750, 7874, 7979,
8063, 8122, 8155, 8160, 8133, 8073, 7978, 7847, 7679, 7472, 7225, 6940, 6615, 6250, 5848, 5408,
4932, 4423, 3881, 3310, 2712, 2091, 1449, 790, 118, -562, -1248, -1934, -2616, -3290, -3951, -4595,
-5216, -5812, -6376, -6906, -7398, -7847, -8250, -8604, -8906, -9153, -9344, -9476, -9548, -9559, -9509, -9398,
-9225, -8991, -8699, -8349, -7943, -7484, -6976, -6420, -5821, -5183, -4510, -3806, -3076, -2326, -1559, -782,
0, 782, 1559, 2326, 3076, 3806, 4510, 5183, 5821, 6420, 6976, 7484, 7943, 8349, 8699, 8991,
9225, 9398, 9509, 9559, 9548, 9476, 9344, 9153, 8906, 8604, 8250, 7847, 7398, 6906, 6376, 5812,
5216, 4595, 3951, 3290, 2616, 1934, 1248, 562, -118, -790, -1449, -2091, -2712, -3310, -3881, -4423,
-4932, -5408, -5848, -6250, -6615, -6940, -7225, -7472, -7679, -7847, -7978, -8073, -8133, -8160, -8155, -8122,
-8063, -7979, -7874, -7750, -7611, -7459, -7297, -7128, -6955, -6780, -6606, -6435, -6270, -6114, -5967, -5832,
-5710, -5603, -5512, -5437, -5380, -5340, -5318, -5313, -5325, -5354, -5399, -5459, -5532, -5618, -5714, -5820,
-5933, -6052, -6175, -6300, -6426, -6549, -6670, -6785, -6894, -6994, -7085, -7164, -7232, -7287, -7328, -7355,
-7367, -7365, -7349, -7318, -7274, -7217, -7148, -7068, -6978, -6881, -6778, -6670, -6559, -6448, -6339, -6233,
-6133, -6041, -5960, -5890, -5836, -5797, -5777, -5777, -5799, -5844, -5914, -6009, -6131, -6279, -6456, -6660,
-6891, -7150, -7436, -7748, -8085, -8446, -8829, -9234, -9657, -10098, -10554, -11023, -11502, -11989, -12482, -12978,
-13475, -13970, -14461, -14945, -15420, -15884, -16335, -16771, -17190, -17591, -17972, -18333, -18673, -18990, -19285, -19557,
-19807, -20035, -20242, -20428, -20595, -20743, -20875, -20992, -21096, -21189, -21273, -21351, -21423, -21494, -21564, -21637,
-21714, -21798, -21891, -21995, -22111, -22242, -22387, -22550, -22730, -22927, -23144, -23379, -23632, -23902, -24189, -24492,
-24808, -25137, -25475, -25820, -26170, -26521, -26870, -27214, -27549, -27870, -28175, -28458, -28716, -28944, -29138, -29294,
-29407, -29474, -29490, -29452, -29357, -29200, -28978, -28690, -28333, -27904, -27403, -26827, -26175, -25449, -24647, -23770,
-22819, -21796, -20702, -19540, -18313, -17023, -15674, -14271, -12818, -11319, -9779, -8205, -6600, -4971, -3324, -1665,
0, 6040, 11757, 16862, 21128, 24409, 26656, 27910, 28293, 27987, 27204, 26160, 25045, 24004, 23121, 22418,
21861, 21370, 20846, 20187, 19312, 18177, 16781, 15173, 13438, 11691, 10052, 8633, 7519, 6753, 6335, 6220,
6328, 6560, 6812, 6995, 7049, 6950, 6714, 6395, 6065, 5808, 5694, 5766, 6026, 6433, 6897, 7299,
7499, 7365, 6792, 5722, 4160, 2182, -72, -2405, -4593, -6405, -7636, -8135, -7825, -6717, -4913, -2593,
0, 2593, 4913, 6717, 7825, 8135, 7636, 6405, 4593, 2405, 72, -2182, -4160, -5722, -6792, -7365,
-7499, -7299, -6897, -6433, -6026, -5766, -5694, -5808, -6065, -6395, -6714, -6950, -7049, -6995, -6812, -6560,
-6328, -6220, -6335, -6753, -7519, -8633, -10052, -11691, -13438, -15173, -16781, -18177, -19312, -20187, -20846, -21370,
-21861, -22418, -23121, -24004, -25045, -26160, -27204, -27987, -28293, -27910, -26656, -24409, -21128, -16862, -11757, -6040,
0, 19547, 29489, 28186, 21702, 16447, 13478, 10242, 6119, 3994, 5923, 9084, 8104, 1593, -5262, -5931,
0, 5931, 5262, -1593, -8104, -9084, -5923, -3994, -6119, -10242, -13478, -16447, -21702, -28186, -29489, -19547,
},
{ /* VOX A */
0, 3851, 7632, 11276, 14718, 17899, 20765, 23273, 25385, 27074, 28324, 29128, 29490, 29423, 28949, 28098,
26908, 25422, 23689, 21759, 19685, 17518, 15309, 13107, 10956, 8894, 6956, 5167, 3549, 2113, 868, -188,
-1061, -1762, -2307, -2717, -3013, -3221, -3365, -3471, -3562, -3659, -3782, -3947, -4166, -4446, -4792, -5204,
-5677, -6205, -6776, -7378, -7995, -8610, -9205, -9762, -10263, -10693, -11037, -11281, -11414, -11430, -11323, -11091,
-10735, -10259, -9669, -8974, -8186, -7316, -6379, -5391, -4367, -3323, -2275, -1239, -228, 743, 1663, 2522,
3311, 4022, 4651, 5193, 5648, 6015, 6295, 6491, 6606, 6646, 6615, 6519, 6366, 6161, 5912, 5625,
5308, 4965, 4604, 4229, 3847, 3461, 3077, 2696, 2323, 1961, 1611, 1276, 957, 655, 371, 106,
-139, -366, -573, -760, -928, -1077, -1207, -1318, -1412, -1489, -1549, -1593, -1622, -1636, -1637, -1625,
-1600, -1565, -1520, -1465, -1403, -1334, -1258, -1178, -1093, -1006, -917, -826, -736, -646, -557, -471,
-388, -307, -231, -159, -91, -29, 29, 81, 128, 170, 206, 238, 264, 285, 302, 314,
323, 327, 328, 326, 320, 313, 303, 291, 277, 262, 246, 229, 212, 194, 177, 159,
141, 124, 108, 92, 77, 62, 49, 36, 25, 14, 5, -4, -11, -18, -24, -29,
-33, -36, -39, -41, -42, -42, -43, -42, -41, -40, -39, -37, -36, -34, -31, -29,
-27, -25, -22, -20, -18, -16, -14, -12, -10, -8, -7, -5, -4, -3, -1, -1,
0, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 3,
3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -3, -3, -3, -3,
-3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -2, -2, -1,
0, 1, 1, 3, 4, 5, 7, 8, 10, 12, 14, 16, 18, 20, 22, 25,
27, 29, 31, 34, 36, 37, 39, 40, 41, 42, 43, 42, 42, 41, 39, 36,
33, 29, 24, 18, 11, 4, -5, -14, -25, -36, -49, -62, -77, -92, -108, -124,
-141, -159, -177, -194, -212, -229, -246, -262, -277, -291, -303, -313, -320, -326, -328, -327,
-323, -314, -302, -285, -264, -238, -206, -170, -128, -81, -29, 29, 91, 159, 231, 307,
388, 471, 557, 646, 736, 826, 917, 1006, 1093, 1178, 1258, 1334, 1403, 1465, 1520, 1565,
1600, 1625, 1637, 1636, 1622, 1593, 1549, 1489, 1412, 1318, 1207, 1077, 928, 760, 573, 366,
139, -106, -371, -655, -957, -1276, -1611, -1961, -2323, -2696, -3077, -3461, -3847, -4229, -4604, -4965,
-5308, -5625, -5912, -6161, -6366, -6519, -6615, -6646, -6606, -6491, -6295, -6015, -5648, -5193, -4651, -4022,
-3311, -2522, -1663, -743, 228, 1239, 2275, 3323, 4367, 5391, 6379, 7316, 8186, 8974, 9669, 10259,
10735, 11091, 11323, 11430, 11414, 11281, 11037, 10693, 10263, 9762, 9205, 8610, 7995, 7378, 6776, 6205,
5677, 5204, 4792, 4446, 4166, 3947, 3782, 3659, 3562, 3471, 3365, 3221, 3013, 2717, 2307, 1762,
1061, 188, -868, -2113, -3549, -5167, -6956, -8894, -10956, -13107, -15309, -17518, -19685, -21759, -23689, -25422,
-26908, -28098, -28949, -29423, -29490, -29128, -28324, -27074, -25385, -23273, -20765, -17899, -14718, -11276, -7632, -3851,
0, 9436, 16763, 20552, 20457, 17201, 12177, 6869, 2342, -990, -3288, -4989, -6462, -7793, -8764, -9014,
-8255, -6452, -3861, -957, 1725, 3752, 4892, 5136, 4647, 3680, 2500, 1325, 306, -478, -1001, -1275,
-1336, -1232, -1016, -741, -456, -198, 8, 152, 232, 257, 242, 201, 148, 94, 47, 10,
-14, -28, -33, -31, -26, -19, -12, -7, -2, 1, 2, 3, 3, 2, 2, 1,
0, -1, -2, -2, -3, -3, -2, -1, 2, 7, 12, 19, 26, 31, 33, 28,
14, -10, -47, -94, -148, -201, -242, -257, -232, -152, -8, 198, 456, 741, 1016, 1232,
1336, 1275, 1001, 478, -306, -1325, -2500, -3680, -4647, -5136, -4892, -3752, -1725, 957, 3861, 6452,
8255, 9014, 8764, 7793, 6462, 4989, 3288, 990, -2342, -6869, -12177, -17201, -20457, -20552, -16763, -9436,
0, 7431, 6897, -640, -6667, -4963, 1670, 5327, 2411, -2737, -3763, -20, 3262, 1971, -1833, -2964,
0, 2964, 1833, -1971, -3262, 20, 3763, 2737, -2411, -5327, -1670, 4963, 6667, 640, -6897, -7431,
},
{ /* VOX O */
0, 2179, 4345, 6485, 8587, 10639, 12628, 14543, 16374, 18112, 19747, 21271, 22677, 23959, 25113, 26135,
27021, 27771, 28383, 28859, 29200, 29410, 29490, 29447, 29286, 29012, 28633, 28156, 27589, 26941, 26219, 25433,
24592, 23703, 22777, 21822, 20846, 19856, 18862, 17868, 16883, 15912, 14960, 14032, 13131, 12262, 11426, 10627,
9864, 9138, 8451, 7800, 7185, 6604, 6056, 5538, 5048, 4582, 4138, 3712, 3301, 2902, 2512, 2128,
1746, 1364, 980, 591, 196, -207, -619, -1042, -1474, -1917, -2370, -2833, -3304, -3782, -4266, -4753,
-5241, -5729, -6213, -6691, -7160, -7617, -8060, -8485, -8890, -9272, -9628, -9957, -10255, -10521, -10754, -10951,
-11111, -11233, -11316, -11361, -11366, -11333, -11260, -11150, -11003, -10820, -10603, -10353, -10072, -9763, -9426, -9065,
-8683, -8280, -7861, -7427, -6981, -6526, -6065, -5599, -5131, -4664, -4199, -3739, -3286, -2842, -2408, -1986,
-1578, -1184, -806, -445, -101, 224, 531, 819, 1087, 1337, 1567, 1777, 1969, 2142, 2297, 2435,
2555, 2659, 2747, 2819, 2877, 2922, 2954, 2973, 2981, 2978, 2966, 2945, 2915, 2877, 2833, 2782,
2725, 2664, 2598, 2528, 2455, 2378, 2299, 2219, 2136, 2052, 1968, 1882, 1797, 1711, 1626, 1541,
1456, 1373, 1290, 1209, 1129, 1051, 974, 899, 826, 754, 685, 618, 553, 490, 430, 371,
316, 262, 211, 163, 116, 73, 31, -7, -44, -78, -110, -139, -166, -191, -213, -234,
-252, -269, -283, -296, -306, -315, -323, -328, -332, -335, -337, -337, -336, -334, -331, -326,
-321, -316, -309, -302, -294, -286, -277, -268, -258, -248, -238, -228, -217, -206, -195, -185,
-174, -163, -152, -140, -129, -118, -108, -97, -86, -75, -64, -53, -43, -32, -21, -11,
0, 11, 21, 32, 43, 53, 64, 75, 86, 97, 108, 118, 129, 140, 152, 163,
174, 185, 195, 206, 217, 228, 238, 248, 258, 268, 277, 286, 294, 302, 309, 316,
321, 326, 331, 334, 336, 337, 337, 335, 332, 328, 323, 315, 306, 296, 283, 269,
252, 234, 213, 191, 166, 139, 110, 78, 44, 7, -31, -73, -116, -163, -211, -262,
-316, -371, -430, -490, -553, -618, -685, -754, -826, -899, -974, -1051, -1129, -1209, -1290, -1373,
-1456, -1541, -1626, -1711, -1797, -1882, -1968, -2052, -2136, -2219, -2299, -2378, -2455, -2528, -2598, -2664,
-2725, -2782, -2833, -2877, -2915, -2945, -2966, -2978, -2981, -2973, -2954, -2922, -2877, -2819, -2747, -2659,
-2555, -2435, -2297, -2142, -1969, -1777, -1567, -1337, -1087, -819, -531, -224, 101, 445, 806, 1184,
1578, 1986, 2408, 2842, 3286, 3739, 4199, 4664, 5131, 5599, 6065, 6526, 6981, 7427, 7861, 8280,
8683, 9065, 9426, 9763, 10072, 10353, 10603, 10820, 11003, 11150, 11260, 11333, 11366, 11361, 11316, 11233,
11111, 10951, 10754, 10521, 10255, 9957, 9628, 9272, 8890, 8485, 8060, 7617, 7160, 6691, 6213, 5729,
5241, 4753, 4266, 3782, 3304, 2833, 2370, 1917, 1474, 1042, 619, 207, -196, -591, -980, -1364,
-1746, -2128, -2512, -2902, -3301, -3712, -4138, -4582, -5048, -5538, -6056, -6604, -7185, -7800, -8451, -9138,
-9864, -10627, -11426, -12262, -13131, -14032, -14960, -15912, -16883, -17868, -18862, -19856, -20846, -21822, -22777, -23703,
-24592, -25433, -26219, -26941, -27589, -28156, -28633, -29012, -29286, -29447, -29490, -29410, -29200, -28859, -28383, -27771,
-27021, -26135, -25113, -23959, -22677, -21271, -19747, -18112, -16374, -14543, -12628, -10639, -8587, -6485, -4345, -2179,
0, 7432, 14229, 19841, 23875, 26141, 26661, 25643, 23434, 20453, 17114, 13771, 10674, 7951, 5617, 3601,
1790, 64, -1664, -3424, -5187, -6868, -8350, -9508, -10235, -10462, -10169, -9393, -8215, -6749, -5125, -3474,
-1909, -520, 636, 1529, 2159, 2545, 2720, 2723, 2596, 2377, 2100, 1792, 1474, 1163, 871, 606,
373, 175, 14, -112, -203, -264, -298, -308, -301, -280, -250, -213, -172, -130, -86, -43,
0, 43, 86, 130, 172, 213, 250, 280, 301, 308, 298, 264, 203, 112, -14, -175,
-373, -606, -871, -1163, -1474, -1792, -2100, -2377, -2596, -2723, -2720, -2545, -2159, -1529, -636, 520,
1909, 3474, 5125, 6749, 8215, 9393, 10169, 10462, 10235, 9508, 8350, 6868, 5187, 3424, 1664, -64,
-1790, -3601, -5617, -7951, -10674, -13771, -17114, -20453, -23434, -25643, -26661, -26141, -23875, -19841, -14229, -7432,
0, 19097, 25429, 16494, 958, -9838, -11049, -6042, -906, 1372, 1668, 1608, 1328, 312, -925, -1116,
0, 1116, 925, -312, -1328, -1608, -1668, -1372, 906, 6042, 11049, 9838, -958, -16494, -25429, -19097,
},
{ /* BELL */
0, 2266, 4509, 6709, 8846, 10900, 12854, 14694, 16408, 17986, 19423, 20715, 21862, 22866, 23732, 24468,
25083, 25587, 25993, 26313, 26560, 26747, 26884, 26985, 27058, 27111, 27152, 27185, 27213, 27238, 27261, 27279,
27290, 27290, 27276, 27243, 27188, 27105, 26992, 26847, 26667, 26453, 26206, 25927, 25620, 25290, 24940, 24578,
24209, 23840, 23476, 23124, 22788, 22472, 22179, 21911, 21667, 21446, 21244, 21058, 20881, 20707, 20528, 20336,
20122, 19879, 19598, 19274, 18899, 18470, 17985, 17441, 16841, 16188, 15486, 14742, 13964, 13163, 12350, 11535,
10731, 9950, 9203, 8500, 7852, 7266, 6747, 6300, 5927, 5626, 5395, 5230, 5121, 5062, 5042, 5050,
5073, 5099, 5117, 5116, 5085, 5015, 4900, 4735, 4517, 4246, 3924, 3557, 3150, 2712, 2255, 1790,
1330, 888, 478, 112, -196, -437, -600, -680, -669, -567, -373, -90, 278, 723, 1235, 1804,
2417, 3059, 3716, 4374, 5017, 5631, 6204, 6724, 7180, 7563, 7867, 8088, 8223, 8272, 8235, 8115,
7918, 7648, 7312, 6916, 6467, 5974, 5442, 4878, 4287, 3673, 3042, 2394, 1733, 1060, 375, -322,
-1031, -1752, -2485, -3228, -3981, -4741, -5505, -6267, -7021, -7762, -8479, -9164, -9806, -10394, -10918, -11366,
-11728, -11994, -12154, -12203, -12135, -11947, -11637, -11208, -10665, -10014, -9264, -8428, -7519, -6553, -5547, -4520,
-3489, -2474, -1492, -561, 304, 1089, 1781, 2373, 2858, 3232, 3495, 3648, 3698, 3651, 3518, 3310,
3040, 2723, 2373, 2004, 1632, 1269, 928, 619, 352, 131, -37, -152, -213, -223, -186, -109,
2, 139, 291, 450, 607, 753, 880, 982, 1053, 1089, 1090, 1053, 982, 878, 746, 592,
423, 245, 66, -107, -266, -405, -519, -603, -654, -671, -653, -602, -522, -415, -289, -148,
0, 148, 289, 415, 522, 602, 653, 671, 654, 603, 519, 405, 266, 107, -66, -245,
-423, -592, -746, -878, -982, -1053, -1090, -1089, -1053, -982, -880, -753, -607, -450, -291, -139,
-2, 109, 186, 223, 213, 152, 37, -131, -352, -619, -928, -1269, -1632, -2004, -2373, -2723,
-3040, -3310, -3518, -3651, -3698, -3648, -3495, -3232, -2858, -2373, -1781, -1089, -304, 561, 1492, 2474,
3489, 4520, 5547, 6553, 7519, 8428, 9264, 10014, 10665, 11208, 11637, 11947, 12135, 12203, 12154, 11994,
11728, 11366, 10918, 10394, 9806, 9164, 8479, 7762, 7021, 6267, 5505, 4741, 3981, 3228, 2485, 1752,
1031, 322, -375, -1060, -1733, -2394, -3042, -3673, -4287, -4878, -5442, -5974, -6467, -6916, -7312, -7648,
-7918, -8115, -8235, -8272, -8223, -8088, -7867, -7563, -7180, -6724, -6204, -5631, -5017, -4374, -3716, -3059,
-2417, -1804, -1235, -723, -278, 90, 373, 567, 669, 680, 600, 437, 196, -112, -478, -888,
-1330, -1790, -2255, -2712, -3150, -3557, -3924, -4246, -4517, -4735, -4900, -5015, -5085, -5116, -5117, -5099,
-5073, -5050, -5042, -5062, -5121, -5230, -5395, -5626, -5927, -6300, -6747, -7266, -7852, -8500, -9203, -9950,
-10731, -11535, -12350, -13163, -13964, -14742, -15486, -16188, -16841, -17441, -17985, -18470, -18899, -19274, -19598, -19879,
-20122, -20336, -20528, -20707, -20881, -21058, -21244, -21446, -21667, -21911, -22179, -22472, -22788, -23124, -23476, -23840,
-24209, -24578, -24940, -25290, -25620, -25927, -26206, -26453, -26667, -26847, -26992, -27105, -27188, -27243, -27276, -27290,
-27290, -27279, -27261, -27238, -27213, -27185, -27152, -27111, -27058, -26985, -26884, -26747, -26560, -26313, -25993, -25587,
-25083, -24468, -23732, -22866, -21862, -20715, -19423, -17986, -16408, -14694, -12854, -10900, -8846, -6709, -4509, -2266,
0, 7155, 13598, 18811, 22579, 24987, 26313, 26877, 26933, 26625, 26022, 25177, 24168, 23084, 21977, 20814,
19484, 17851, 15853, 13566, 11207, 9054, 7326, 6082, 5198, 4448, 3630, 2694, 1787, 1182, 1149, 1803,
3022, 4476, 5736, 6417, 6292, 5317, 3601, 1331, -1274, -3971, -6477, -8460, -9584, -9598, -8452, -6362,
-3781, -1278, 647, 1722, 1971, 1655, 1137, 710, 504, 476, 491, 430, 268, 69, -65, -79,
0, 79, 65, -69, -268, -430, -491, -476, -504, -710, -1137, -1655, -1971, -1722, -647, 1278,
3781, 6362, 8452, 9598, 9584, 8460, 6477, 3971, 1274, -1331, -3601, -5317, -6292, -6417, -5736, -4476,
-3022, -1803, -1149, -1182, -1787, -2694, -3630, -4448, -5198, -6082, -7326, -9054, -11207, -13566, -15853, -17851,
-19484, -20814, -21977, -23084, -24168, -25177, -26022, -26625, -26933, -26877, -26313, -24987, -22579, -18811, -13598, -7155,
0, 19176, 29490, 27885, 18503, 8872, 4162, 4121, 4727, 2597, -1915, -5444, -5133, -1473, 2141, 2609,
0, -2609, -2141, 1473, 5133, 5444, 1915, -2597, -4727, -4121, -4162, -8872, -18503, -27885, -29490, -19176,
},
{ /* HOLLW */
0, 12465, 22268, 27900, 29490, 28418, 26388, 24602, 23448, 22739, 22153, 21534, 20917, 20389, 19971, 19614,
19265, 18916, 18593, 18312, 18064, 17827, 17593, 17368, 17163, 16978, 16803, 16631, 16463, 16306, 16161, 16024,
15890, 15759, 15633, 15516, 15405, 15297, 15191, 15088, 14991, 14899, 14810, 14722, 14637, 14555, 14477, 14402,
14328, 14256, 14186, 14119, 14055, 13992, 13930, 13870, 13812, 13756, 13702, 13648, 13596, 13546, 13497, 13450,
13404, 13358, 13314, 13271, 13230, 13190, 13150, 13111, 13074, 13037, 13002, 12967, 12933, 12900, 12868, 12837,
12806, 12776, 12747, 12719, 12692, 12665, 12638, 12613, 12588, 12564, 12541, 12518, 12496, 12474, 12453, 12433,
12413, 12393, 12375, 12357, 12339, 12322, 12305, 12289, 12274, 12259, 12244, 12230, 12217, 12204, 12191, 12179,
12168, 12156, 12146, 12136, 12126, 12117, 12108, 12100, 12092, 12084, 12077, 12071, 12065, 12059, 12054, 12049,
12045, 12041, 12037, 12034, 12032, 12030, 12028, 12027, 12026, 12026, 12026, 12026, 12028, 12029, 12031, 12033,
12036, 12040, 12044, 12048, 12053, 12058, 12064, 12070, 12077, 12084, 12092, 12100, 12109, 12119, 12128, 12139,
12150, 12162, 12174, 12187, 12200, 12214, 12229, 12244, 12260, 12276, 12294, 12312, 12330, 12350, 12369, 12390,
12412, 12434, 12457, 12481, 12506, 12532, 12558, 12586, 12614, 12643, 12674, 12705, 12738, 12771, 12805, 12841,
12878, 12916, 12956, 12996, 13038, 13082, 13127, 13173, 13221, 13270, 13322, 13376, 13431, 13487, 13545, 13607,
13671, 13737, 13804, 13874, 13947, 14025, 14104, 14185, 14269, 14358, 14452, 14550, 14650, 14752, 14862, 14979,
15102, 15227, 15356, 15493, 15642, 15802, 15966, 16133, 16310, 16506, 16723, 16949, 17177, 17417, 17690, 18005,
18345, 18686, 19036, 19446, 19965, 20572, 21183, 21764, 22467, 23609, 25378, 27396, 28493, 27004, 21579, 12087,
0, -12087, -21579, -27004, -28493, -27396, -25378, -23609, -22467, -21764, -21183, -20572, -19965, -19446, -19036, -18686,
-18345, -18005, -17690, -17417, -17177, -16949, -16723, -16506, -16310, -16133, -15966, -15802, -15642, -15493, -15356, -15227,
-15102, -14979, -14862, -14752, -14650, -14550, -14452, -14358, -14269, -14185, -14104, -14025, -13947, -13874, -13804, -13737,
-13671, -13607, -13545, -13487, -13431, -13376, -13322, -13270, -13221, -13173, -13127, -13082, -13038, -12996, -12956, -12916,
-12878, -12841, -12805, -12771, -12738, -12705, -12674, -12643, -12614, -12586, -12558, -12532, -12506, -12481, -12457, -12434,
-12412, -12390, -12369, -12350, -12330, -12312, -12294, -12276, -12260, -12244, -12229, -12214, -12200, -12187, -12174, -12162,
-12150, -12139, -12128, -12119, -12109, -12100, -12092, -12084, -12077, -12070, -12064, -12058, -12053, -12048, -12044, -12040,
-12036, -12033, -12031, -12029, -12028, -12026, -12026, -12026, -12026, -12027, -12028, -12030, -12032, -12034, -12037, -12041,
-12045, -12049, -12054, -12059, -12065, -12071, -12077, -12084, -12092, -12100, -12108, -12117, -12126, -12136, -12146, -12156,
-12168, -12179, -12191, -12204, -12217, -12230, -12244, -12259, -12274, -12289, -12305, -12322, -12339, -12357, -12375, -12393,
-12413, -12433, -12453, -12474, -12496, -12518, -12541, -12564, -12588, -12613, -12638, -12665, -12692, -12719, -12747, -12776,
-12806, -12837, -12868, -12900, -12933, -12967, -13002, -13037, -13074, -13111, -13150, -13190, -13230, -13271, -13314, -13358,
-13404, -13450, -13497, -13546, -13596, -13648, -13702, -13756, -13812, -13870, -13930, -13992, -14055, -14119, -14186, -14256,
-14328, -14402, -14477, -14555, -14637, -14722, -14810, -14899, -14991, -15088, -15191, -15297, -15405, -15516, -15633, -15759,
-15890, -16024, -16161, -16306, -16463, -16631, -16803, -16978, -17163, -17368, -17593, -17827, -18064, -18312, -18593, -18916,
-19265, -19614, -19971, -20389, -20917, -21534, -22153, -22739, -23448, -24602, -26388, -28418, -29490, -27900, -22268, -12465,
0, 8635, 15330, 19033, 19924, 19069, 17696, 16585, 15917, 15506, 15136, 14741, 14370, 14075, 13848, 13646,
13445, 13253, 13088, 12951, 12831, 12714, 12603, 12507, 12425, 12354, 12289, 12229, 12178, 12137, 12103, 12076,
12056, 12043, 12037, 12038, 12047, 12065, 12091, 12124, 12163, 12211, 12275, 12353, 12436, 12525, 12628, 12760,
12919, 13088, 13257, 13452, 13714, 14050, 14412, 14751, 15133, 15767, 16835, 18170, 19017, 18196, 14673, 8270,
0, -8270, -14673, -18196, -19017, -18170, -16835, -15767, -15133, -14751, -14412, -14050, -13714, -13452, -13257, -13088,
-12919, -12760, -12628, -12525, -12436, -12353, -12275, -12211, -12163, -12124, -12091, -12065, -12047, -12038, -12037, -12043,
-12056, -12076, -12103, -12137, -12178, -12229, -12289, -12354, -12425, -12507, -12603, -12714, -12831, -12951, -13088, -13253,
-13445, -13646, -13848, -14075, -14370, -14741, -15136, -15506, -15917, -16585, -17696, -19069, -19924, -19033, -15330, -8635,
0, 12425, 19052, 18335, 13696, 10249, 10558, 13082, 14394, 12857, 10262, 9953, 13250, 17566, 18086, 11727,
0, -11727, -18086, -17566, -13250, -9953, -10262, -12857, -14394, -13082, -10558, -10249, -13696, -18335, -19052, -12425,
},
{ /* BRASS */
0, 7498, 13958, 18754, 21855, 23700, 24881, 25847, 26780, 27653, 28377, 28904, 29247, 29438, 29490, 29399,
29158, 28775, 28273, 27671, 26981, 26215, 25384, 24508, 23606, 22693, 21780, 20878, 20000, 19158, 18361, 17615,
16924, 16292, 15723, 15218, 14776, 14395, 14073, 13805, 13590, 13422, 13296, 13207, 13149, 13118, 13110, 13119,
13140, 13170, 13205, 13243, 13280, 13315, 13345, 13369, 13386, 13396, 13398, 13391, 13376, 13354, 13324, 13287,
13244, 13195, 13141, 13083, 13021, 12956, 12888, 12818, 12746, 12674, 12600, 12525, 12450, 12375, 12300, 12226,
12151, 12077, 12002, 11929, 11856, 11783, 11710, 11637, 11565, 11494, 11422, 11351, 11280, 11209, 11138, 11067,
10997, 10926, 10856, 10786, 10715, 10645, 10575, 10505, 10435, 10365, 10295, 10225, 10155, 10086, 10016, 9946,
9876, 9807, 9737, 9667, 9598, 9528, 9459, 9389, 9320, 9250, 9181, 9111, 9042, 8973, 8903, 8834,
8765, 8695, 8626, 8557, 8488, 8419, 8349, 8280, 8211, 8142, 8073, 8004, 7935, 7866, 7797, 7728,
7659, 7590, 7521, 7453, 7384, 7315, 7246, 7177, 7108, 7040, 6971, 6902, 6833, 6765, 6696, 6627,
6558, 6490, 6421, 6353, 6284, 6215, 6147, 6078, 6009, 5941, 5872, 5804, 5735, 5667, 5598, 5530,
5461, 5393, 5324, 5256, 5187, 5119, 5050, 4982, 4914, 4845, 4777, 4708, 4640, 4571, 4503, 4435,
4366, 4298, 4230, 4161, 4093, 4025, 3956, 3888, 3820, 3751, 3683, 3615, 3546, 3478, 3410, 3342,
3273, 3205, 3137, 3069, 3000, 2932, 2864, 2796, 2727, 2659, 2591, 2523, 2454, 2386, 2318, 2250,
2182, 2113, 2045, 1977, 1909, 1841, 1772, 1704, 1636, 1568, 1500, 1431, 1363, 1295, 1227, 1159,
1091, 1022, 954, 886, 818, 750, 682, 613, 545, 477, 409, 341, 273, 204, 136, 68,
0, -68, -136, -204, -273, -341, -409, -477, -545, -613, -682, -750, -818, -886, -954, -1022,
-1091, -1159, -1227, -1295, -1363, -1431, -1500, -1568, -1636, -1704, -1772, -1841, -1909, -1977, -2045, -2113,
-2182, -2250, -2318, -2386, -2454, -2523, -2591, -2659, -2727, -2796, -2864, -2932, -3000, -3069, -3137, -3205,
-3273, -3342, -3410, -3478, -3546, -3615, -3683, -3751, -3820, -3888, -3956, -4025, -4093, -4161, -4230, -4298,
-4366, -4435, -4503, -4571, -4640, -4708, -4777, -4845, -4914, -4982, -5050, -5119, -5187, -5256, -5324, -5393,
-5461, -5530, -5598, -5667, -5735, -5804, -5872, -5941, -6009, -6078, -6147, -6215, -6284, -6353, -6421, -6490,
-6558, -6627, -6696, -6765, -6833, -6902, -6971, -7040, -7108, -7177, -7246, -7315, -7384, -7453, -7521, -7590,
-7659, -7728, -7797, -7866, -7935, -8004, -8073, -8142, -8211, -8280, -8349, -8419, -8488, -8557, -8626, -8695,
-8765, -8834, -8903, -8973, -9042, -9111, -9181, -9250, -9320, -9389, -9459, -9528, -9598, -9667, -9737, -9807,
-9876, -9946, -10016, -10086, -10155, -10225, -10295, -10365, -10435, -10505, -10575, -10645, -10715, -10786, -10856, -10926,
-10997, -11067, -11138, -11209, -11280, -11351, -11422, -11494, -11565, -11637, -11710, -11783, -11856, -11929, -12002, -12077,
-12151, -12226, -12300, -12375, -12450, -12525, -12600, -12674, -12746, -12818, -12888, -12956, -13021, -13083, -13141, -13195,
-13244, -13287, -13324, -13354, -13376, -13391, -13398, -13396, -13386, -13369, -13345, -13315, -13280, -13243, -13205, -13170,
-13140, -13119, -13110, -13118, -13149, -13207, -13296, -13422, -13590, -13805, -14073, -14395, -14776, -15218, -15723, -16292,
-16924, -17615, -18361, -19158, -20000, -20878, -21780, -22693, -23606, -24508, -25384, -26215, -26981, -27671, -28273, -28775,
-29158, -29399, -29490, -29438, -29247, -28904, -28377, -27653, -26780, -25847, -24881, -23700, -21855, -18754, -13958, -7498,
0, 10319, 18739, 24043, 26037, 25402, 23234, 20562, 18072, 16090, 14696, 13844, 13421, 13276, 13251, 13219,
13115, 12935, 12702, 12437, 12156, 11865, 11571, 11282, 10999, 10718, 10438, 10156, 9876, 9598, 9321, 9043,
8765, 8488, 8211, 7936, 7660, 7384, 7108, 6833, 6559, 6285, 6010, 5735, 5461, 5188, 4914, 4640,
4366, 4093, 3820, 3547, 3274, 3000, 2727, 2455, 2182, 1909, 1636, 1363, 1091, 818, 545, 273,
0, -273, -545, -818, -1091, -1363, -1636, -1909, -2182, -2455, -2727, -3000, -3274, -3547, -3820, -4093,
-4366, -4640, -4914, -5188, -5461, -5735, -6010, -6285, -6559, -6833, -7108, -7384, -7660, -7936, -8211, -8488,
-8765, -9043, -9321, -9598, -9876, -10156, -10438, -10718, -10999, -11282, -11571, -11865, -12156, -12437, -12702, -12935,
-13115, -13219, -13251, -13276, -13421, -13844, -14696, -16090, -18072, -20562, -23234, -25402, -26037, -24043, -18739, -10319,
0, 16340, 22978, 18898, 11524, 8433, 10317, 12251, 10521, 6641, 4524, 5249, 6079, 4422, 1214, -563,
0, 563, -1214, -4422, -6079, -5249, -4524, -6641, -10521, -12251, -10317, -8433, -11524, -18898, -22978, -16340,
},
{ /* RESO */
0, 6568, 12271, 16588, 19494, 21359, 22679, 23828, 24957, 26041, 27002, 27796, 28426, 28913, 29262, 29459,
29490, 29355, 29062, 28621, 28033, 27301, 26431, 25432, 24319, 23104, 21795, 20406, 18949, 17441, 15898, 14333,
12760, 11194, 9651, 8146, 6692, 5301, 3986, 2757, 1627, 605, -303, -1089, -1749, -2277, -2671, -2929,
-3053, -3044, -2903, -2636, -2246, -1742, -1131, -420, 380, 1261, 2211, 3218, 4273, 5362, 6474, 7597,
8719, 9829, 10916, 11968, 12977, 13932, 14825, 15648, 16394, 17057, 17632, 18115, 18503, 18794, 18988, 19084,
19083, 18988, 18801, 18527, 18169, 17734, 17227, 16654, 16023, 15342, 14616, 13856, 13069, 12262, 11444, 10623,
9806, 9002, 8216, 7456, 6728, 6037, 5388, 4786, 4236, 3739, 3298, 2916, 2594, 2331, 2129, 1986,
1901, 1872, 1897, 1973, 2097, 2266, 2474, 2719, 2995, 3299, 3625, 3969, 4326, 4692, 5062, 5431,
5796, 6152, 6495, 6823, 7132, 7419, 7681, 7918, 8126, 8305, 8453, 8570, 8656, 8711, 8734, 8728,
8691, 8627, 8536, 8420, 8281, 8121, 7942, 7746, 7535, 7313, 7080, 6840, 6595, 6347, 6098, 5850,
5606, 5366, 5133, 4908, 4692, 4487, 4294, 4113, 3945, 3790, 3650, 3523, 3410, 3311, 3226, 3153,
3093, 3045, 3008, 2981, 2963, 2955, 2953, 2958, 2969, 2985, 3004, 3025, 3048, 3073, 3097, 3120,
3141, 3161, 3177, 3190, 3199, 3204, 3204, 3199, 3189, 3174, 3154, 3128, 3098, 3062, 3021, 2975,
2925, 2871, 2812, 2750, 2685, 2617, 2546, 2473, 2398, 2322, 2244, 2165, 2086, 2007, 1928, 1849,
1771, 1693, 1617, 1541, 1467, 1395, 1324, 1254, 1187, 1121, 1057, 994, 934, 875, 818, 763,
709, 657, 606, 557, 509, 462, 416, 372, 328, 285, 243, 202, 161, 120, 80, 40,
0, -40, -80, -120, -161, -202, -243, -285, -328, -372, -416, -462, -509, -557, -606, -657,
-709, -763, -818, -875, -934, -994, -1057, -1121, -1187, -1254, -1324, -1395, -1467, -1541, -1617, -1693,
-1771, -1849, -1928, -2007, -2086, -2165, -2244, -2322, -2398, -2473, -2546, -2617, -2685, -2750, -2812, -2871,
-2925, -2975, -3021, -3062, -3098, -3128, -3154, -3174, -3189, -3199, -3204, -3204, -3199, -3190, -3177, -3161,
-3141, -3120, -3097, -3073, -3048, -3025, -3004, -2985, -2969, -2958, -2953, -2955, -2963, -2981, -3008, -3045,
-3093, -3153, -3226, -3311, -3410, -3523, -3650, -3790, -3945, -4113, -4294, -4487, -4692, -4908, -5133, -5366,
-5606, -5850, -6098, -6347, -6595, -6840, -7080, -7313, -7535, -7746, -7942, -8121, -8281, -8420, -8536, -8627,
-8691, -8728, -8734, -8711, -8656, -8570, -8453, -8305, -8126, -7918, -7681, -7419, -7132, -6823, -6495, -6152,
-5796, -5431, -5062, -4692, -4326, -3969, -3625, -3299, -2995, -2719, -2474, -2266, -2097, -1973, -1897, -1872,
-1901, -1986, -2129, -2331, -2594, -2916, -3298, -3739, -4236, -4786, -5388, -6037, -6728, -7456, -8216, -9002,
-9806, -10623, -11444, -12262, -13069, -13856, -14616, -15342, -16023, -16654, -17227, -17734, -18169, -18527, -18801, -18988,
-19083, -19084, -18988, -18794, -18503, -18115, -17632, -17057, -16394, -15648, -14825, -13932, -12977, -11968, -10916, -9829,
-8719, -7597, -6474, -5362, -4273, -3218, -2211, -1261, -380, 420, 1131, 1742, 2246, 2636, 2903, 3044,
3053, 2929, 2671, 2277, 1749, 1089, 303, -605, -1627, -2757, -3986, -5301, -6692, -8146, -9651, -11194,
-12760, -14333, -15898, -17441, -18949, -20406, -21795, -23104, -24319, -25432, -26431, -27301, -28033, -28621, -29062, -29355,
-29490, -29459, -29262, -28913, -28426, -27796, -27002, -26041, -24957, -23828, -22679, -21359, -19494, -16588, -12271, -6568,
0, 9928, 18170, 23559, 25712, 24953, 22014, 17729, 12865, 8102, 4051, 1228, -26, 370, 2220, 5107,
8489, 11800, 14536, 16316, 16935, 16383, 14832, 12590, 10034, 7543, 5439, 3951, 3184, 3122, 3642, 4552,
5629, 6660, 7470, 7947, 8046, 7787, 7240, 6508, 5701, 4921, 4245, 3722, 3366, 3165, 3083, 3076,
3097, 3106, 3073, 2981, 2826, 2614, 2359, 2078, 1786, 1499, 1226, 974, 745, 538, 348, 171,
0, -171, -348, -538, -745, -974, -1226, -1499, -1786, -2078, -2359, -2614, -2826, -2981, -3073, -3106,
-3097, -3076, -3083, -3165, -3366, -3722, -4245, -4921, -5701, -6508, -7240, -7787, -8046, -7947, -7470, -6660,
-5629, -4552, -3642, -3122, -3184, -3951, -5439, -7543, -10034, -12590, -14832, -16383, -16935, -16316, -14536, -11800,
-8489, -5107, -2220, -370, 26, -1228, -4051, -8102, -12865, -17729, -22014, -24953, -25712, -23559, -18170, -9928,
0, 10706, 14957, 12367, 8177, 7183, 9046, 9904, 7648, 4330, 3199, 4501, 5349, 3569, 461, -983,
0, 983, -461, -3569, -5349, -4501, -3199, -4330, -7648, -9904, -9046, -7183, -8177, -12367, -14957, -10706,
},
{ /* DIGI */
-12279, -12980, -13928, -15465, -17788, -20625, -23167, -24381, -23578, -20917, -17486, -14833, -14173, -15757, -18812, -22087,
-24622, -26201, -27225, -28160, -29055, -29490, -28996, -27541, -25689, -24275, -23835, -24236, -24752, -24538, -23126, -20642,
-17611, -14561, -11728, -9044, -6378, -3813, -1731, -647, -889, -2357, -4511, -6595, -7957, -8281, -7617, -6256,
-4566, -2895, -1563, -863, -1005, -1991, -3528, -5095, -6157, -6454, -6163, -5825, -6064, -7254, -9325, -11807,
-14062, -15545, -15948, -15192, -13321, -10433, -6701, -2440, 1868, 5674, 8560, 10404, 11388, 11825, 11915, 11598,
10634, 8862, 6451, 3976, 2202, 1705, 2532, 4106, 5454, 5650, 4246, 1473, -1871, -4777, -6423, -6420,
-4831, -2023, 1496, 5172, 8444, 10813, 11994, 12059, 11412, 10527, 9594, 8325, 6157, 2741, -1614, -5921,
-9001, -10185, -9729, -8660, -8158, -8895, -10776, -13149, -15269, -16636, -17050, -16456, -14823, -12203, -8902, -5578,
-3115, -2294, -3433, -6206, -9754, -13038, -15263, -16171, -16052, -15468, -14841, -14161, -12983, -10740, -7187, -2697,
1779, 5082, 6352, 5385, 2705, -689, -3730, -5651, -6178, -5484, -3990, -2138, -261, 1409, 2670, 3299,
3098, 1990, 109, -2204, -4458, -6088, -6521, -5295, -2256, 2207, 7088, 11001, 12709, 11682, 8325, 3726,
-922, -4829, -7739, -9687, -10674, -10563, -9260, -6963, -4193, -1533, 716, 2666, 4620, 6693, 8587, 9747,
9810, 9013, 8249, 8667, 11040, 15271, 20323, 24620, 26724, 25946, 22615, 17887, 13230, 9826, 8183, 8083,
8852, 9752, 10303, 10368, 10033, 9385, 8363, 6780, 4508, 1700, -1120, -3189, -3826, -2781, -394, 2524,
5033, 6435, 6493, 5410, 3645, 1701, 2, -1155, -1587, -1220, -92, 1657, 3804, 6055, 8049, 9393,
9751, 9007, 7398, 5503, 4020, 3416, 3635, 4075, 3854, 2258, -904, -5203, -9807, -13835, -16652, -17973,
-17789, -16239, -13556, -10077, -6271, -2679, 227, 2179, 3126, 3127, 2209, 350, -2382, -5650, -8823, -11210,
-12440, -12712, -12709, -13175, -14442, -16232, -17858, -18664, -18389, -17215, -15537, -13674, -11756, -9812, -7930, -6311,
-5192, -4720, -4893, -5589, -6593, -7592, -8149, -7773, -6104, -3131, 751, 4901, 8718, 11851, 14168, 15571,
15853, 14771, 12308, 8892, 5371, 2711, 1598, 2210, 4269, 7281, 10775, 14389, 17829, 20790, 22964, 24110,
24125, 23038, 20955, 18018, 14442, 10612, 7133, 4750, 4107, 5436, 8359, 11933, 14986, 16603, 16518, 15213,
13633, 12674, 12707, 13405, 13964, 13592, 11998, 9602, 7361, 6277, 6866, 8858, 11317, 13135, 13646, 12989,
12002, 11686, 12564, 14355, 16172, 17127, 16918, 16025, 15365, 15685, 17072, 18907, 20235, 20303, 18924, 16509,
13789, 11431, 9724, 8483, 7193, 5312, 2608, -654, -3778, -5926, -6493, -5347, -2815, 541, 4199, 7823,
11225, 14217, 16482, 17596, 17198, 15224, 12064, 8505, 5464, 3611, 3093, 3548, 4417, 5359, 6483, 8218,
10894, 14337, 17784, 20200, 20797, 19400, 16462, 12723, 8807, 4980, 1200, -2649, -6505, -10012, -12577, -13561,
-12524, -9421, -4671, 946, 6521, 11278, 14745, 16754, 17347, 16681, 15008, 12727, 10386, 8563, 7654, 7684,
8287, 8875, 8932, 8236, 6932, 5405, 4074, 3219, 2914, 3075, 3541, 4151, 4785, 5398, 6042, 6863,
8027, 9581, 11318, 12768, 13390, 12871, 11365, 9471, 7922, 7178, 7184, 7463, 7465, 6925, 5982, 5011,
4328, 3984, 3787, 3487, 2967, 2315, 1743, 1418, 1302, 1105, 380, -1248, -3818, -6911, -9767, -11643,
-12207, -11697, -10730, -9887, -9361, -8929, -8251, -7236, -6198, -5693, -6172, -7698, -9908, -12169, -13826, -14423,
-13866, -12517, -11157, -10745, -11989, -14918, -18731, -22079, -23700, -23029, -20449, -17042, -14007, -12114, -11473, -11694,
-16920, -17917, -19375, -21166, -22733, -23312, -22316, -19652, -15794, -11598, -7995, -5684, -4925, -5430, -6417, -6875,
-6018, -3715, -612, 2212, 3880, 4227, 3800, 3342, 3177, 2969, 2031, -77, -3157, -6459, -9130, -10643,
-10922, -10193, -8772, -6958, -5036, -3267, -1825, -759, -47, 300, 238, -156, -503, -159, 1457, 4421,
8094, 11351, 13129, 12937, 11034, 8222, 5453, 3469, 2605, 2723, 3276, 3514, 2820, 1045, -1385, -3722,
-5378, -6303, -6967, -7936, -9358, -10766, -11341, -10432, -7944, -4345, -337, 3497, 6853, 9627, 11765, 13196,
13887, 13905, 13430, 12710, 12019, 11632, 11772, 12479, 13494, 14266, 14184, 12923, 10689, 8185, 6288, 5631,
6302, 7808, 9295, 9922, 9247, 7456, 5314, 3792, 3549, 4562, 6162, 7471, 7957, 7705, 7256, 7130,
7433, 7799, 7654, 6590, 4569, 1887, -1014, -3746, -6097, -8048, -9722, -11274, -12775, -14157, -15294, -16155,
-19493, -21437, -16834, -8091, -121, 3045, 901, -3720, -7083, -6926, -3187, 2546, 7773, 9790, 6923, 73,
-6922, -9328, -4945, 3966, 12236, 15659, 13840, 9718, 6676, 6089, 7096, 7908, 6933, 3107, -3795, -12401,
},
{ /* STRNG */
0, 9240, 16900, 22042, 24651, 25439, 25355, 25121, 25036, 25077, 25119, 25101, 25048, 25013, 25013, 25028,
25034, 25024, 25011, 25005, 25002, 24997, 24986, 24974, 24970, 24971, 24973, 24972, 24965, 24956, 24947, 24937,
24925, 24914, 24908, 24908, 24909, 24903, 24883, 24844, 24787, 24720, 24652, 24596, 24559, 24542, 24539, 24534,
24513, 24465, 24389, 24295, 24197, 24113, 24054, 24022, 24011, 24010, 24010, 24006, 23997, 23984, 23970, 23958,
23950, 23946, 23944, 23943, 23941, 23938, 23933, 23926, 23915, 23904, 23896, 23895, 23897, 23895, 23888, 23879,
23873, 23867, 23849, 23811, 23773, 23778, 23844, 23891, 23695, 22943, 21370, 18934, 15902, 12779, 10110, 8251,
7257, 6919, 6918, 6992, 7015, 6981, 6932, 6900, 6886, 6877, 6866, 6856, 6852, 6854, 6854, 6848,
6837, 6825, 6816, 6811, 6807, 6805, 6803, 6802, 6800, 6794, 6784, 6772, 6760, 6752, 6747, 6745,
6745, 6741, 6728, 6702, 6663, 6613, 6560, 6516, 6487, 6474, 6472, 6466, 6437, 6370, 6259, 6116,
5963, 5827, 5728, 5672, 5651, 5648, 5650, 5647, 5637, 5623, 5608, 5595, 5586, 5580, 5577, 5577,
5576, 5573, 5568, 5560, 5551, 5541, 5533, 5529, 5528, 5528, 5526, 5520, 5512, 5500, 5484, 5464,
5444, 5436, 5443, 5454, 5427, 5298, 5011, 4548, 3952, 3320, 2763, 2361, 2136, 2052, 2045, 2055,
2052, 2028, 1994, 1959, 1931, 1910, 1897, 1890, 1888, 1888, 1886, 1880, 1871, 1860, 1850, 1842,
1838, 1835, 1835, 1834, 1831, 1826, 1817, 1807, 1796, 1786, 1781, 1779, 1779, 1776, 1768, 1749,
1720, 1682, 1641, 1604, 1578, 1569, 1571, 1564, 1520, 1412, 1226, 978, 704, 454, 266, 154,
108, 100, 104, 104, 94, 79, 62, 47, 36, 29, 26, 24, 24, 22, 17, 9,
0, -9, -17, -22, -24, -24, -26, -29, -36, -47, -62, -79, -94, -104, -104, -100,
-108, -154, -266, -454, -704, -978, -1226, -1412, -1520, -1564, -1571, -1569, -1578, -1604, -1641, -1682,
-1720, -1749, -1768, -1776, -1779, -1779, -1781, -1786, -1796, -1807, -1817, -1826, -1831, -1834, -1835, -1835,
-1838, -1842, -1850, -1860, -1871, -1880, -1886, -1888, -1888, -1890, -1897, -1910, -1931, -1959, -1994, -2028,
-2052, -2055, -2045, -2052, -2136, -2361, -2763, -3320, -3952, -4548, -5011, -5298, -5427, -5454, -5443, -5436,
-5444, -5464, -5484, -5500, -5512, -5520, -5526, -5528, -5528, -5529, -5533, -5541, -5551, -5560, -5568, -5573,
-5576, -5577, -5577, -5580, -5586, -5595, -5608, -5623, -5637, -5647, -5650, -5648, -5651, -5672, -5728, -5827,
-5963, -6116, -6259, -6370, -6437, -6466, -6472, -6474, -6487, -6516, -6560, -6613, -6663, -6702, -6728, -6741,
-6745, -6745, -6747, -6752, -6760, -6772, -6784, -6794, -6800, -6802, -6803, -6805, -6807, -6811, -6816, -6825,
-6837, -6848, -6854, -6854, -6852, -6856, -6866, -6877, -6886, -6900, -6932, -6981, -7015, -6992, -6918, -6919,
-7257, -8251, -10110, -12779, -15902, -18934, -21370, -22943, -23695, -23891, -23844, -23778, -23773, -23811, -23849, -23867,
-23873, -23879, -23888, -23895, -23897, -23895, -23896, -23904, -23915, -23926, -23933, -23938, -23941, -23943, -23944, -23946,
-23950, -23958, -23970, -23984, -23997, -24006, -24010, -24010, -24011, -24022, -24054, -24113, -24197, -24295, -24389, -24465,
-24513, -24534, -24539, -24542, -24559, -24596, -24652, -24720, -24787, -24844, -24883, -24903, -24909, -24908, -24908, -24914,
-24925, -24937, -24947, -24956, -24965, -24972, -24973, -24971, -24970, -24974, -24986, -24997, -25002, -25005, -25011, -25024,
-25034, -25028, -25013, -25013, -25048, -25101, -25119, -25077, -25036, -25121, -25355, -25439, -24651, -22042, -16900, -9240,
0, 9483, 17246, 22306, 24718, 25320, 25142, 24895, 24811, 24804, 24742, 24596, 24421, 24266, 24137, 24030,
23971, 23988, 24007, 23793, 22989, 21303, 18706, 15518, 12309, 9653, 7884, 7001, 6737, 6754, 6801, 6775,
6684, 6559, 6415, 6247, 6058, 5870, 5719, 5626, 5587, 5568, 5508, 5331, 4982, 4452, 3796, 3126,
2557, 2162, 1946, 1859, 1836, 1825, 1795, 1725, 1595, 1392, 1121, 812, 514, 273, 115, 34,
0, -34, -115, -273, -514, -812, -1121, -1392, -1595, -1725, -1795, -1825, -1836, -1859, -1946, -2162,
-2557, -3126, -3796, -4452, -4982, -5331, -5508, -5568, -5587, -5626, -5719, -5870, -6058, -6247, -6415, -6559,
-6684, -6775, -6801, -6754, -6737, -7001, -7884, -9653, -12309, -15518, -18706, -21303, -22989, -23793, -24007, -23988,
-23971, -24030, -24137, -24266, -24421, -24596, -24742, -24804, -24811, -24895, -25142, -25320, -24718, -22306, -17246, -9483,
0, 17288, 27908, 29490, 24650, 17993, 12612, 9058, 6714, 5274, 4735, 4616, 3976, 2409, 650, -201,
0, 201, -650, -2409, -3976, -4616, -4735, -5274, -6714, -9058, -12612, -17993, -24650, -29490, -27908, -17288,
},
{ /* METAL */
0, 6955, 13486, 19207, 23811, 27095, 28975, 29490, 28789, 27111, 24750, 22026, 19242, 16658, 14465, 12771,
11599, 10898, 10557, 10430, 10365, 10225, 9911, 9375, 8624, 7715, 6742, 5820, 5062, 4558, 4361, 4473,
4846, 5382, 5953, 6413, 6623, 6471, 5890, 4867, 3453, 1751, -88, -1891, -3480, -4697, -5425, -5604,
-5235, -4384, -3170, -1752, -304, 1008, 2043, 2711, 2979, 2878, 2495, 1965, 1445, 1098, 1066, 1451,
2298, 3591, 5248, 7136, 9084, 10904, 12416, 13471, 13971, 13879, 13231, 12124, 10714, 9191, 7763, 6626,
5948, 5845, 6370, 7508, 9177, 11238, 13509, 15786, 17862, 19547, 20684, 21167, 20938, 19999, 18400, 16234,
13626, 10719, 7662, 4599, 1658, -1050, -3439, -5445, -7029, -8168, -8859, -9113, -8953, -8413, -7539, -6387,
-5021, -3513, -1941, -383, 1086, 2399, 3505, 4367, 4973, 5332, 5473, 5442, 5297, 5100, 4910, 4774,
4726, 4774, 4910, 5100, 5297, 5442, 5473, 5332, 4973, 4367, 3505, 2399, 1086, -383, -1941, -3513,
-5021, -6387, -7539, -8413, -8953, -9113, -8859, -8168, -7029, -5445, -3439, -1050, 1658, 4599, 7662, 10719,
13626, 16234, 18400, 19999, 20938, 21167, 20684, 19547, 17862, 15786, 13509, 11238, 9177, 7508, 6370, 5845,
5948, 6626, 7763, 9191, 10714, 12124, 13231, 13879, 13971, 13471, 12416, 10904, 9084, 7136, 5248, 3591,
2298, 1451, 1066, 1098, 1445, 1965, 2495, 2878, 2979, 2711, 2043, 1008, -304, -1752, -3170, -4384,
-5235, -5604, -5425, -4697, -3480, -1891, -88, 1751, 3453, 4867, 5890, 6471, 6623, 6413, 5953, 5382,
4846, 4473, 4361, 4558, 5062, 5820, 6742, 7715, 8624, 9375, 9911, 10225, 10365, 10430, 10557, 10898,
11599, 12771, 14465, 16658, 19242, 22026, 24750, 27111, 28789, 29490, 28975, 27095, 23811, 19207, 13486, 6955,
0, -6955, -13486, -19207, -23811, -27095, -28975, -29490, -28789, -27111, -24750, -22026, -19242, -16658, -14465, -12771,
-11599, -10898, -10557, -10430, -10365, -10225, -9911, -9375, -8624, -7715, -6742, -5820, -5062, -4558, -4361, -4473,
-4846, -5382, -5953, -6413, -6623, -6471, -5890, -4867, -3453, -1751, 88, 1891, 3480, 4697, 5425, 5604,
5235, 4384, 3170, 1752, 304, -1008, -2043, -2711, -2979, -2878, -2495, -1965, -1445, -1098, -1066, -1451,
-2298, -3591, -5248, -7136, -9084, -10904, -12416, -13471, -13971, -13879, -13231, -12124, -10714, -9191, -7763, -6626,
-5948, -5845, -6370, -7508, -9177, -11238, -13509, -15786, -17862, -19547, -20684, -21167, -20938, -19999, -18400, -16234,
-13626, -10719, -7662, -4599, -1658, 1050, 3439, 5445, 7029, 8168, 8859, 9113, 8953, 8413, 7539, 6387,
5021, 3513, 1941, 383, -1086, -2399, -3505, -4367, -4973, -5332, -5473, -5442, -5297, -5100, -4910, -4774,
-4726, -4774, -4910, -5100, -5297, -5442, -5473, -5332, -4973, -4367, -3505, -2399, -1086, 383, 1941, 3513,
5021, 6387, 7539, 8413, 8953, 9113, 8859, 8168, 7029, 5445, 3439, 1050, -1658, -4599, -7662, -10719,
-13626, -16234, -18400, -19999, -20938, -21167, -20684, -19547, -17862, -15786, -13509, -11238, -9177, -7508, -6370, -5845,
-5948, -6626, -7763, -9191, -10714, -12124, -13231, -13879, -13971, -13471, -12416, -10904, -9084, -7136, -5248, -3591,
-2298, -1451, -1066, -1098, -1445, -1965, -2495, -2878, -2979, -2711, -2043, -1008, 304, 1752, 3170, 4384,
5235, 5604, 5425, 4697, 3480, 1891, 88, -1751, -3453, -4867, -5890, -6471, -6623, -6413, -5953, -5382,
-4846, -4473, -4361, -4558, -5062, -5820, -6742, -7715, -8624, -9375, -9911, -10225, -10365, -10430, -10557, -10898,
-11599, -12771, -14465, -16658, -19242, -22026, -24750, -27111, -28789, -29490, -28975, -27095, -23811, -19207, -13486, -6955,
0, 7932, 13597, 15819, 14923, 12265, 9307, 6874, 5015, 3394, 1806, 427, -312, -57, 1205, 3119,
5182, 7035, 8623, 10094, 11503, 12555, 12634, 11166, 8100, 4135, 486, -1703, -1917, -475, 1703, 3549,
4261, 3549, 1703, -475, -1917, -1703, 486, 4135, 8100, 11166, 12634, 12555, 11503, 10094, 8623, 7035,
5182, 3119, 1205, -57, -312, 427, 1806, 3394, 5015, 6874, 9307, 12265, 14923, 15819, 13597, 7932,
0, -7932, -13597, -15819, -14923, -12265, -9307, -6874, -5015, -3394, -1806, -427, 312, 57, -1205, -3119,
-5182, -7035, -8623, -10094, -11503, -12555, -12634, -11166, -8100, -4135, -486, 1703, 1917, 475, -1703, -3549,
-4261, -3549, -1703, 475, 1917, 1703, -486, -4135, -8100, -11166, -12634, -12555, -11503, -10094, -8623, -7035,
-5182, -3119, -1205, 57, 312, -427, -1806, -3394, -5015, -6874, -9307, -12265, -14923, -15819, -13597, -7932,
0, 3398, 6025, 7356, 7275, 6099, 4464, 3099, 2572, 3099, 4464, 6099, 7275, 7356, 6025, 3398,
0, -3398, -6025, -7356, -7275, -6099, -4464, -3099, -2572, -3099, -4464, -6099, -7275, -7356, -6025, -3398,
},
};
+18 -1
View File
@@ -926,6 +926,21 @@ static void mx_load(const int16_t *p, mx_t *x)
x->n++;
}
}
/* Clipper 0.8: the MOD SEQ. Four lanes of 16 steps (-8..7) per sound, stepping at RATE (the song's grid while it
* plays and START is SYNC; from each first key with KEY, and while stopped), LEN steps, each lane's value gliding
* (SMTH) to its step's: the matrix's sources SEQ1..SEQ4 (seq.c mseq_tick moves them, once a block). A sound loaded
* (a factory one) brings four shapes to start from: a ramp, a triangle, a rhythm, a random line */
static const int8_t MSEQ_INIT[MSEQ_LANES][MSEQ_STEPS] = {
{-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7},
{0, 2, 4, 6, 7, 5, 3, 1, -1, -3, -5, -7, -8, -6, -4, -2},
{7, 7, -8, -8, 7, -8, 7, 7, -8, 7, -8, -8, 7, -8, 7, -8},
{3, -5, 6, -2, 0, 7, -7, 2, -4, 5, -1, -8, 4, 1, -6, 6},
};
static void mseq_init(track_t *t)
{
memcpy(t->ms, MSEQ_INIT, sizeof t->ms);
}
static int32_t mseq_q15(int32_t v) { return clamp(v * 4369, -32767, 32767); } /* a step: -8 full scale, 7 just under */
/* LFO 2's rate index, + the slots to MT_L2RATE (sv: the sources) */
static uint32_t mx_l2rate(const int16_t *p, const mx_t *x, const int32_t *sv)
{
@@ -969,7 +984,7 @@ static int vs_ok(const engine_t *e) /* its render may run on two
{
return e == &ENG_HYBRID || e == &ENG_FMX || e == &ENG_WAVE || e == &ENG_ANALOG || e == &ENG_FM6 || e == &ENG_VPS ||
e == &ENG_TERRAIN || e == &ENG_WSEQ || e == &ENG_MACRO || e == &ENG_STRINGS || e == &ENG_TRIO ||
e == &ENG_PHASE || e == &ENG_DIGITAL || e == &ENG_LOFI || e == &ENG_ACID;
e == &ENG_PHASE || e == &ENG_DIGITAL || e == &ENG_LOFI || e == &ENG_ACID || e == &ENG_JUNO || e == &ENG_VECTOR;
}
static void vs_finish(track_t *t, const engine_t *e, int32_t *out, uint32_t n)
{
@@ -1059,6 +1074,8 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
sv[MS_LFO1] = lfo; /* (the part's sources; with FADE, as the LFO's routes) */
sv[MS_MW] = part_ctl[pc].mw * 258; /* (on HYBRID too: its own matrix has them as well) */
sv[MS_AT] = (int32_t)catr * 258;
for (i = 0; i < MSEQ_LANES; i++) /* (0.8) the MOD SEQ's lanes: the part's */
sv[MS_SEQ1 + i] = t->ms_cur[i];
{ /* LFO 2 FREE: one for the part, its rate moved by the part's sources only */
uint32_t old = t->l2ph;
t->l2ph += LFO_INC[mx_l2rate(p, &mx, sv)];
+3
View File
@@ -120,6 +120,9 @@ static void host_preset_req(track_t *t, uint32_t e, uint32_t pi)
t->p[P_AMODE + i] = (int16_t)(p->arp[i] ? p->arp[i] - 1 : TP[P_AMODE + i].def);
}
preset_extras(t->p, p);
#if CLIPPER_SYNTH
mseq_init(t); /* (0.8) the MOD SEQ's shapes (ui.c apply_preset_to) */
#endif
fm6_track_loaded(t); /* FM6: the preset's patch (ui.c apply_preset_to) */
}
static void host_preset(track_t *t, uint32_t e, uint32_t pi)
+180
View File
@@ -0,0 +1,180 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 3dSam (Clipper) */
/* Clipper 0.8 on the FM-1 (the harness of tests/ui_pages_test.c): the MOD SEQ's pages, SPICE, JUNO and VECTOR.
* MOD SEQ LANE and STEP choose, VALUE writes the step (-8..7); SHAPE fills the lane over LEN (RAMP+, TRI, SQR,
* FLAT, INVRT, SHIFT, RND); the graph: the lane, the step being edited, the one playing
* MOD SEQ 2 RATE LEN SMTH START (the sound's parameters); a step changed and left: one UNDO step (UNDO: back)
* SPICE ARP family: SPICE, DICE
* SWAP the layer's SWAP trades the MOD SEQs too
* browser JUNO and VECTOR in the engine list and their presets in PRESETS; the INSERT's JUNO1 .. JUN12
* screens: DIR/mseq-*.ppm */
#define UI_PAGES_HARNESS_ONLY
#include "ui_pages_test.c"
static void ok(int c, const char *what) { check(c, what); }
static int page_idx(const char *t)
{
uint32_t i;
for (i = 0; i < NPAGES; i++)
if (!strcmp(PAGES[i].title, t))
return (int)i;
return -1;
}
static int go_page(const char *t)
{
int i = page_idx(t);
if (i < 0)
return 0;
open_family(PAGES[i].fam);
ui.page = (uint8_t)i;
ui.fam_last[PAGES[i].fam] = (uint8_t)i;
page_entered();
ui.force = 1;
frame();
return 1;
}
static void knob(uint32_t k, int32_t s) { encs[panel.enc[EN_K1 + k]] = s; frame(); }
static void rest(void) { frames(70); }
int main(int argc, char **argv)
{
uint32_t i;
track_t *t = &trk[0];
outdir = argc > 1 ? argv[1] : "build/host";
bank_resolve();
panel = PANEL_DEFAULT;
layers_init();
settings.palette = 4;
palette_set(4);
host_tracks_init();
for (i = 0; i < NPART; i++) { set_engine_of(&trk[i], i ? 1u : 0u); apply_preset_to(&trk[i], 0); trk[i].engine = trk[i].eng_req; }
clipper_proj_neutral();
go_home(); ui.force = 1; frames(4);
ok(!memcmp(t->ms, MSEQ_INIT, sizeof t->ms), "MOD SEQ: a sound loaded brings the four shapes");
ok(go_page("MOD SEQ") && PAGES[ui.page].fam == FAM_LFO, "MOD SEQ: a page of the LFO family");
ppm("mseq-page");
knob(0, 1); /* LANE 2 */
knob(1, 4); /* STEP 5 */
ok(xv[X_QLANE] == 2 && xv[X_QSTEP] == 5, "MOD SEQ: LANE and STEP choose the step");
{
int8_t was = t->ms[1][4];
knob(2, was < 7 ? 1 : -1);
ok(t->ms[1][4] == was + (was < 7 ? 1 : -1), "MOD SEQ: VALUE writes the step");
knob(2, 40);
ok(t->ms[1][4] == 7, "MOD SEQ: VALUE stops at 7");
knob(2, -40);
ok(t->ms[1][4] == -8, "MOD SEQ: VALUE stops at -8");
}
ppm("mseq-edit");
rest();
{ /* one UNDO step: back */
uint32_t n0 = hist_n;
go_page("MOD SEQ");
knob(2, 5);
rest();
ok(hist_n == n0 + 1u, "MOD SEQ: a step changed and left: one UNDO step");
go_page("UNDO");
knob(0, -1);
rest();
ok(t->ms[1][4] == -8, "MOD SEQ: UNDO brings the step back");
knob(0, 1);
rest();
ok(t->ms[1][4] == -3, "MOD SEQ: UNDO right: the edit again");
}
{ /* SHAPE */
int good;
go_page("MOD SEQ");
knob(3, 1); /* RAMP+ */
good = t->ms[1][0] == -8 && t->ms[1][15] == 7 && t->ms[1][7] < t->ms[1][8];
ok(good, "MOD SEQ SHAPE RAMP+: -8 to 7 over the 16 steps");
t->p[P_MSLEN] = 8;
knob(3, 4); /* SQR */
good = t->ms[1][0] == 7 && t->ms[1][3] == 7 && t->ms[1][4] == -8 && t->ms[1][7] == -8 && t->ms[1][15] == 7;
ok(good, "MOD SEQ SHAPE SQR over LEN 8 (the steps past LEN kept)");
knob(3, 2); /* FLAT (one turn of two detents: the last one applies) */
good = 1;
for (i = 0; i < 8u; i++)
good &= t->ms[1][i] == 0;
ok(good, "MOD SEQ SHAPE FLAT: every step 0");
knob(3, 1); /* INVRT of flat: flat */
ok(t->ms[1][3] == 0 && xv[X_QFILL] == QF_INV, "MOD SEQ SHAPE INVRT");
knob(3, -5); /* TRI */
ok(t->ms[1][0] == -8 && t->ms[1][4] > 5, "MOD SEQ SHAPE TRI: up and down");
{
int8_t a = t->ms[1][1];
knob(3, 6); /* .. SHIFT */
ok(t->ms[1][0] == a && xv[X_QFILL] == QF_SHIFT, "MOD SEQ SHAPE SHIFT: one step to the left");
}
t->p[P_MSLEN] = 16;
ppm("mseq-shape");
}
ok(go_page("MOD SEQ 2") && PAGES[ui.page].id[0] == P_MSRATE, "MOD SEQ 2: RATE LEN SMTH START");
knob(1, -8);
ok(t->p[P_MSLEN] == 8, "MOD SEQ 2: LEN turned");
ppm("mseq-page2");
t->p[P_MSLEN] = 16;
ok(go_page("SPICE") && PAGES[ui.page].fam == FAM_ARP && PAGES[ui.page].id[0] == P_SPICE, "SPICE: a page of the ARP family");
knob(0, 20);
knob(1, 3);
ok(t->p[P_SPICE] == 20 && t->p[P_DICE] == 3, "SPICE: SPICE and DICE turned");
ppm("mseq-spice");
t->p[P_SPICE] = 0;
{ /* SWAP trades the MOD SEQs */
int8_t a = t->ms[1][1], b;
trk[1].ms[1][1] = (int8_t)(a == 5 ? 4 : 5);
b = trk[1].ms[1][1];
layer_swap();
frame();
ok(trk[0].ms[1][1] == b && trk[1].ms[1][1] == a, "LAYER SWAP: the MOD SEQs trade places too");
layer_swap();
frame();
}
{ /* the matrix names the lanes */
ok(!strcmp(N_MSRC[MS_SEQ1], "SEQ1") && !strcmp(N_MSRC[MS_SEQ4], "SEQ4") && MS_NSRC <= 16,
"MATRIX: SEQ1..SEQ4 among the sources (4 bits in the stores)");
}
{ /* JUNO and VECTOR in the browser and the engine list */
uint32_t total, n, juno = 0, vec = 0;
preset_pos(&total);
for (n = 0; n < total; n++) {
uint32_t k, e = preset_at(n, &k);
juno += e == ENGI_JUNO;
vec += e == ENGI_VECTOR;
}
ok(juno == ENGINES[ENGI_JUNO]->npresets && vec == ENGINES[ENGI_VECTOR]->npresets,
"PRESETS: every JUNO and VECTOR preset in the list");
ok(!strcmp(N_ENGNAME[ENGI_JUNO], "JUNO") && !strcmp(N_ENGNAME[ENGI_VECTOR], "VECTOR"), "ENG: JUNO and VECTOR named");
set_engine_of(t, ENGI_JUNO);
apply_preset_to(t, 0);
frames(3);
go_home();
frame();
ppm("mseq-juno-home");
go_page("EDIT 2");
ppm("mseq-juno-edit2");
set_engine_of(t, ENGI_VECTOR);
apply_preset_to(t, 0);
frames(3);
go_page("EDIT 1");
ppm("mseq-vector-edit1");
go_page("EDIT 2");
ppm("mseq-vector-edit2");
go_home();
frame();
ppm("mseq-vector-home");
ok(t->engine == ENGI_VECTOR, "VECTOR: loaded and playing");
}
{ /* the INSERT's JUNO chorus types */
go_page("INSERT");
t->p[P_ITYPE] = IT_JUNO1;
ui.force = 1;
frame();
ppm("mseq-insert-juno");
ok(!strcmp(N_ITYPE[IT_JUNO12], "JUN12") && !strcmp(ins_desc(IT_JUNO1, 0)->label, "WIDTH"),
"INSERT: JUNO1 JUNO2 JUN12, their A B C: WIDTH TONE NOISE");
t->p[P_ITYPE] = 0;
}
printf(fails ? "mseq_ui: %d FAILED\n" : "mseq_ui: all passed\n", fails);
return fails;
}
+8
View File
@@ -167,6 +167,14 @@ if ${CC_TSAN:-gcc} -O1 -g -w -fsanitize=thread -DCLIPPER_SYNTH=1 -Ibuild/gen -If
else
echo "(split under ThreadSanitizer: this compiler has none, skipped)"
fi
$SYN -o "$OUT/synth8_test" tests/synth8_test.c -lm
run "Clipper 0.8: JUNO (presets, tune, PW, HPF, the chorus I / II / I+II, no click, as an INSERT), VECTOR (corners, MOVE), the MOD SEQ (KEY, SYNC, LEN, SMTH, to CUT / AMP, projects, user presets), SPICE / DICE (arp, sequencer)" "$OUT/synth8_test"
if $SYN_UB -o "$OUT/synth8_ub" tests/synth8_test.c -lm 2>/dev/null; then
run "Clipper 0.8 under ASan + UBSan" sh -c "'$OUT/synth8_ub' >/dev/null && echo clean"
fi
mkdir -p "$OUT/mseq_ui"
$SYN -o "$OUT/mseq_ui_test" tests/mseq_ui_test.c -lm -lpthread
run "Clipper 0.8 on the FM-1: MOD SEQ pages (lane, step, value, SHAPE), MOD SEQ 2, SPICE, UNDO of a step, the layer SWAP, JUNO / VECTOR in the browser" "$OUT/mseq_ui_test" "$OUT/mseq_ui"
$SYN -o "$OUT/engines3_test" tests/engines3_test.c -lm
run "Clipper 0.5 VPS (vector phaseshaping: pitch, formant, D, no DC, no aliasing, no step) and TERRAIN (every surface pitched, RAD, DRIFT, no aliasing), bounded, cost" "$OUT/engines3_test" build/eng3_demo
if $SYN_UB -o "$OUT/engines3_ub" tests/engines3_test.c -lm 2>/dev/null; then
+1 -1
View File
@@ -518,7 +518,7 @@ static void t_userbank(void)
for (i = 0; i < 53u; i++)
good &= out[i] == (int16_t)i;
for (i = 53u; i < P_E0; i++) /* (0.6: its INSERT, the same values: 99) */
good &= out[i] == (i >= P_ITYPE ? 99 : def[i]);
good &= out[i] == (i >= P_ITYPE && i <= P_IMIX ? 99 : def[i]); /* (0.8: the MOD SEQ's at defaults) */
for (i = 0; i < 8u; i++)
good &= out[P_E0 + i] == (int16_t)(263 + i);
ok(good, "user presets: a SLOOP 2.6 record: its sound and its INSERT, 2.6's others left out, the matrix at defaults");
+589
View File
@@ -0,0 +1,589 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 3dSam (Clipper) */
/* Clipper 0.8 (CLIPPER_SYNTH 1): JUNO and its chorus, VECTOR, the MOD SEQ, SPICE / DICE.
* JUNO every preset bounded, audible, its voices free after the release; in tune; PW (a square: no even
* harmonics, narrow: they come); HPF 3 thins the bass; the chorus: OFF mono (left = right),
* I II I+II stereo and each its own; a mode changed under a held chord: no click; the INSERT's JUNO1 JUNO2
* JUN12 on another engine (MIX 0: mono again)
* VECTOR every preset bounded and audible; a corner its wave alone (SINE: no harmonics; SAW: the 2nd at half);
* the centre all four; MOVE moves the timbre; a high note bounded (the narrow copy)
* MOD SEQ KEY: step 0 at the first key, the next one a 1/16 later (120 BPM), LEN wraps; SYNC: the song's grid;
* SMTH glides; SEQ1 -> CUT changes the sound, SEQ3 -> AMP gates it; kept with the sound: projects (both
* parts, a 0.7 project: the shapes and defaults), user presets (the steps in note / flags, the values in
* the side), a record without steps: none
* SPICE 0: the arp as written; up: rests, octaves, velocities; the same DICE: the same variation; another DICE:
* another; the sequencer's steps too (the pattern never changes) */
#define main hostsim_main
#include <stddef.h>
#include "hostsim.c"
#undef main
#define PROJ_HOST 1
static const uint8_t TRK_DEF[NPART][2] = {{ENGI_HYBRID, 0}, {1, 0}, {4, 5}}; /* (ui.c, Clipper) */
static uint32_t trk_def_engine(uint32_t i) { return i < NPART ? TRK_DEF[i][0] : 0u; }
#include "../firmware/src/project.c"
#define UP_HOST 1
#include "../firmware/src/upreset.c"
static int fails;
static void ok(int c, const char *what)
{
printf("synth8: %-96s %s\n", what, c ? "ok" : "FAIL");
fails += !c;
}
#define NCAP (4096u * 16u)
static int32_t cl[NCAP], cr[NCAP];
static uint32_t ncap;
static void run(uint32_t nb)
{
static int32_t o[CTL * 2];
uint32_t b, i;
ncap = 0;
for (b = 0; b < nb; b++) {
mix_block(o, CTL);
for (i = 0; i < CTL; i++)
if (ncap < NCAP) {
cl[ncap] = o[2 * i];
cr[ncap++] = o[2 * i + 1];
}
}
}
static void quiet(void)
{
uint32_t i, k;
for (i = 0; i < NPART; i++)
trk_all_off(&trk[i]);
run(400);
for (i = 0; i < NPART; i++)
for (k = 0; k < NVOICE; k++)
trk[i].v[k].active = trk[i].v[k].gate = 0, trk[i].v[k].stage = 0, trk[i].v[k].env = trk[i].v[k].env_out = 0;
run(300);
}
static void plain(track_t *t, uint32_t eng, uint32_t pi)
{
host_preset(t, eng, pi);
t->p[P_DIST] = t->p[P_CHOR] = t->p[P_DLY] = t->p[P_REV] = 0;
t->p[P_LD_PIT] = t->p[P_LD_FLT] = t->p[P_LD_SHP] = t->p[P_LD_AMP] = t->p[P_ED_PIT] = t->p[P_ED_FLT] = 0;
t->p[P_ATK] = 0, t->p[P_SUS] = 127, t->p[P_REL] = 10, t->p[P_VOICE] = V_POLY, t->p[P_PAN] = 0, t->p[P_GLIDE] = 0;
t->p[P_MWDST] = t->p[P_ATDST] = MD_OFF;
t->p[P_AMODE] = 0;
t->p[P_ITYPE] = 0, t->p[P_IMIX] = 127;
}
static uint32_t sounding(const track_t *t)
{
uint32_t i, n = 0;
for (i = 0; i < NVOICE; i++)
n += t->v[i].active;
return n;
}
/* the magnitude of frequency f (Hz) in cl[a .. a + n) */
static double mag(double f, uint32_t a, uint32_t n)
{
double re = 0, im = 0;
uint32_t i;
for (i = 0; i < n; i++) {
double w = 0.5 - 0.5 * cos(2 * M_PI * i / n), x = cl[a + i] * w;
re += x * cos(2 * M_PI * f * i / FS);
im += x * sin(2 * M_PI * f * i / FS);
}
return sqrt(re * re + im * im) / n;
}
static double rms_l(uint32_t a, uint32_t n)
{
double e = 0;
uint32_t i;
for (i = a; i < a + n && i < ncap; i++)
e += (double)cl[i] * cl[i];
return sqrt(e / n);
}
static double side_ratio(uint32_t a, uint32_t n) /* |L - R| / |L + R| */
{
double s = 0, m = 0;
uint32_t i;
for (i = a; i < a + n && i < ncap; i++) {
double d = (double)cl[i] - cr[i], u = (double)cl[i] + cr[i];
s += d * d, m += u * u;
}
return m > 0 ? sqrt(s / m) : 0;
}
static int32_t max_step(uint32_t a, uint32_t n) /* the largest sample-to-sample move of the left channel */
{
int32_t mx = 0;
uint32_t i;
for (i = a + 1u; i < a + n && i < ncap; i++) {
int32_t d = cl[i] - cl[i - 1];
d = d < 0 ? -d : d;
mx = d > mx ? d : mx;
}
return mx;
}
static int bounded(void)
{
uint32_t i;
for (i = 0; i < ncap; i++)
if (cl[i] > (1 << 23) || cl[i] < -(1 << 23) || cr[i] > (1 << 23) || cr[i] < -(1 << 23))
return 0;
return 1;
}
/* every preset of engine e: a chord held, then let go: bounded, audible, the voices free after */
static void presets_all(uint32_t e)
{
const engine_t *en = ENGINES[e];
uint32_t pi, good = 1, loud = 1, freed = 1;
char w[200];
for (pi = 0; pi < en->npresets; pi++) {
static const uint8_t ch[3] = {48, 55, 64};
uint32_t i;
quiet();
host_preset(&trk[0], e, pi);
trk[0].p[P_AMODE] = 0;
for (i = 0; i < 3u; i++)
trk_note_on(&trk[0], ch[i], 100);
run(1400);
if (!bounded())
good = 0, printf(" %s: out of bounds\n", en->presets[pi].name);
{
double r = 0;
uint32_t w;
for (w = 0; w < 8u; w++) /* (the loudest eighth: plucks fade) */
r = rms_l(w * (ncap / 8u), ncap / 8u) > r ? rms_l(w * (ncap / 8u), ncap / 8u) : r;
if (r < 300.0) {
loud = 0;
printf(" %s: quiet (%.0f)\n", en->presets[pi].name, r);
}
}
for (i = 0; i < 3u; i++)
trk_note_off(&trk[0], ch[i]);
for (i = 0; i < 40u && sounding(&trk[0]); i++) /* (long releases: up to 15 s) */
run(500);
if (!bounded())
good = 0, printf(" %s: out of bounds after\n", en->presets[pi].name);
if (sounding(&trk[0]))
freed = 0, printf(" %s: %u voices left\n", en->presets[pi].name, (unsigned)sounding(&trk[0]));
}
snprintf(w, sizeof w, "%s: all %u presets bounded, audible, their voices free after the release", en->name,
(unsigned)en->npresets);
ok(good && loud && freed, w);
}
static void t_juno(void)
{
track_t *t = &trk[0];
presets_all(ENGI_JUNO);
{ /* in tune: a saw at A4, the filter open */
double m0, ml, mh;
quiet();
run(8000); /* (the presets' reverb and delay tails die away: 6 s) */
plain(t, ENGI_JUNO, 0);
t->p[P_E0] = 0, t->p[P_E2] = 0, t->p[P_E3] = 0, t->p[P_E4] = 1, t->p[P_E5] = 127, t->p[P_E6] = 0, t->p[P_E7] = 0;
t->p[P_LD_SHP] = 0;
trk_note_on(t, 69, 100);
run(500);
m0 = mag(440, 8192, 8192), ml = mag(428, 8192, 8192), mh = mag(452, 8192, 8192);
ok(m0 > 8 * ml && m0 > 8 * mh, "JUNO: in tune (a saw at A4: 440 Hz, not beside it)");
ok(side_ratio(8192, 8192) < 1e-3, "JUNO: CHOR OFF: mono (left = right)");
}
{ /* PW: a square has no even harmonics, a narrow pulse has */
double sq, nar;
quiet();
plain(t, ENGI_JUNO, 0);
t->p[P_E0] = 1, t->p[P_E1] = 0, t->p[P_E2] = 0, t->p[P_E3] = 0, t->p[P_E4] = 1, t->p[P_E5] = 127, t->p[P_E6] = 0;
t->p[P_E7] = 0, t->p[P_LD_SHP] = 0;
trk_note_on(t, 57, 100);
run(500);
sq = mag(440, 8192, 8192) / mag(220, 8192, 8192);
quiet();
t->p[P_E1] = 110;
trk_note_on(t, 57, 100);
run(500);
nar = mag(440, 8192, 8192) / mag(220, 8192, 8192);
ok(sq < 0.05 && nar > 0.3, "JUNO: PW 0 a square (no 2nd harmonic), PW 110 a narrow pulse (its 2nd harmonic)");
}
{ /* HPF: 3 thins the bass */
double f1, f3;
quiet();
plain(t, ENGI_JUNO, 0);
t->p[P_E0] = 0, t->p[P_E2] = 0, t->p[P_E5] = 127, t->p[P_E6] = 0, t->p[P_E7] = 0, t->p[P_E4] = 1;
trk_note_on(t, 33, 100); /* A1, 55 Hz */
run(600);
f1 = mag(55, 8192, 16384);
quiet();
t->p[P_E4] = 3;
trk_note_on(t, 33, 100);
run(600);
f3 = mag(55, 8192, 16384);
ok(f3 < 0.3 * f1, "JUNO: HPF 3 thins the bass (55 Hz at least 10 dB down from HPF 1)");
}
{ /* the chorus: I, II, I+II stereo and each its own */
double sr[4];
uint32_t m;
int32_t again[3] = {0};
static int32_t keep[3][4096];
for (m = 1; m < 4u; m++) {
quiet();
plain(t, ENGI_JUNO, 0);
t->p[P_E7] = (int16_t)m;
trk_note_on(t, 57, 100);
trk_note_on(t, 64, 100);
run(1000);
sr[m] = side_ratio(8192, 16384);
memcpy(keep[m - 1u], cl + 16384, sizeof keep[0]);
(void)again;
}
ok(sr[1] > 0.15 && sr[2] > 0.15 && sr[3] > 0.05, "JUNO: CHOR I, II, I+II: stereo (left - right a good share)");
ok(memcmp(keep[0], keep[1], sizeof keep[0]) && memcmp(keep[1], keep[2], sizeof keep[0]),
"JUNO: CHOR I, II, I+II: three different choruses");
}
{ /* a mode changed under a held chord: no click */
int32_t steady, sw;
quiet();
plain(t, ENGI_JUNO, 0);
t->p[P_E0] = 0, t->p[P_E5] = 60, t->p[P_E7] = 1;
trk_note_on(t, 57, 100);
trk_note_on(t, 61, 100);
run(600);
steady = max_step(4096, 8192);
t->p[P_E7] = 3;
run(60);
sw = max_step(0, ncap);
t->p[P_E7] = 0;
run(60);
sw = max_step(0, ncap) > sw ? max_step(0, ncap) : sw;
ok(sw < steady * 3 / 2 + 64, "JUNO: CHOR changed under a held chord (I -> I+II -> OFF): no click");
}
{ /* the INSERT's JUNO types on ANALOG */
double s1, s0;
static int32_t a1[4096], a3[4096];
quiet();
plain(t, 0, 0);
t->p[P_ITYPE] = IT_JUNO1, t->p[P_IA] = 127, t->p[P_IB] = 100, t->p[P_IC] = 0, t->p[P_IMIX] = 127;
trk_note_on(t, 57, 100);
run(800);
s1 = side_ratio(8192, 16384);
memcpy(a1, cl + 16384, sizeof a1);
quiet();
t->p[P_ITYPE] = IT_JUNO12;
trk_note_on(t, 57, 100);
run(800);
memcpy(a3, cl + 16384, sizeof a3);
quiet();
t->p[P_ITYPE] = IT_JUNO2, t->p[P_IMIX] = 0;
trk_note_on(t, 57, 100);
run(800);
s0 = side_ratio(8192, 16384);
ok(s1 > 0.15 && s0 < 1e-3 && memcmp(a1, a3, sizeof a1) && !strcmp(N_ITYPE[IT_JUNO1], "JUNO1"),
"JUNO chorus as an INSERT (JUNO1, JUN12) on ANALOG: stereo, each its own; MIX 0: mono");
t->p[P_ITYPE] = 0, t->p[P_IMIX] = 127;
}
}
static void t_vector(void)
{
track_t *t = &trk[0];
presets_all(ENGI_VECTOR);
{ /* a corner: its wave alone */
double sine2, saw2, mid2, h1;
quiet();
plain(t, ENGI_VECTOR, 0);
t->p[P_E0] = 0, t->p[P_E1] = 2, t->p[P_E2] = 3, t->p[P_E3] = 2; /* A SINE, B SAW, C SQR, D SAW */
t->p[P_E4] = -64, t->p[P_E5] = -64, t->p[P_E6] = VM_OFF, t->p[P_E7] = 127;
trk_note_on(t, 57, 100);
run(500);
h1 = mag(220, 8192, 8192);
sine2 = (mag(440, 8192, 8192) + mag(660, 8192, 8192)) / h1;
quiet();
t->p[P_E4] = 63; /* B */
trk_note_on(t, 57, 100);
run(500);
saw2 = mag(440, 8192, 8192) / mag(220, 8192, 8192);
quiet();
t->p[P_E4] = 0, t->p[P_E5] = 0; /* the centre */
trk_note_on(t, 57, 100);
run(500);
mid2 = mag(440, 8192, 8192) / mag(220, 8192, 8192);
ok(sine2 < 0.02 && saw2 > 0.35 && saw2 < 0.65 && mid2 > 0.1 && mid2 < saw2,
"VECTOR: corner A (SINE) a sine, corner B (SAW) its 2nd harmonic at half, the centre between");
}
{ /* MOVE moves the timbre over the note; OFF holds it */
double r0[2], r1[2];
uint32_t mv;
for (mv = 0; mv < 2u; mv++) {
quiet();
plain(t, ENGI_VECTOR, 0);
t->p[P_E0] = 0, t->p[P_E1] = 2, t->p[P_E2] = 3, t->p[P_E3] = 13;
t->p[P_E4] = 0, t->p[P_E5] = 0, t->p[P_E6] = mv ? VM_CIRCF : VM_OFF, t->p[P_E7] = 127;
trk_note_on(t, 57, 100);
run(2000);
r0[mv] = mag(440, 4096, 8192) / mag(220, 4096, 8192);
r1[mv] = mag(440, 4096 + 11025, 8192) / mag(220, 4096 + 11025, 8192); /* a quarter of CIRC+'s turn on */
}
ok(fabs(r0[0] - r1[0]) < 0.02 * r0[0] + 0.005 && fabs(r0[1] - r1[1]) > 0.05,
"VECTOR: MOVE OFF holds the mix, CIRC+ moves it (the 2nd harmonic's share changes)");
}
{ /* a high note: the narrow copy, bounded */
quiet();
plain(t, ENGI_VECTOR, 0);
t->p[P_E6] = VM_OFF;
trk_note_on(t, 100, 127);
trk_note_on(t, 108, 127);
run(500);
ok(bounded() && rms_l(4096, 8192) > 100.0, "VECTOR: notes at the top of the keyboard bounded and audible");
}
}
static void t_mseq(void)
{
track_t *t = &trk[0];
uint32_t i, good = 1;
quiet();
plain(t, 0, 0);
song.g[G_BPM] = 120;
t->p[P_MSRATE] = 2, t->p[P_MSLEN] = 16, t->p[P_MSSMTH] = 0, t->p[P_MSKEY] = 1;
ok(t->ms[0][0] == -8 && t->ms[0][15] == 7 && t->ms[2][2] == -8, "MOD SEQ: a sound loaded brings the four shapes");
run(100);
trk_note_on(t, 57, 100);
run(1);
good &= t->ms_step == 0u && t->ms_cur[0] == mseq_q15(t->ms[0][0]);
run(170); /* 1/16 at 120 BPM: 5512.5 samples, 172.3 blocks */
good &= t->ms_step == 0u;
run(4);
good &= t->ms_step == 1u && t->ms_cur[1] == mseq_q15(t->ms[1][1]);
ok(good, "MOD SEQ KEY: step 1 at the first key, the next a 1/16 later (120 BPM), the values at once (SMTH 0)");
t->p[P_MSLEN] = 4;
run(172 * 4);
ok(t->ms_step < 4u, "MOD SEQ: LEN 4 wraps at 4");
trk_note_off(t, 57);
run(20);
trk_note_on(t, 60, 100);
run(1);
ok(t->ms_step == 0u, "MOD SEQ KEY: a new first key starts it again");
{ /* SMTH: a glide between steps */
int32_t a, b;
t->p[P_MSSMTH] = 110, t->p[P_MSLEN] = 16;
run(172 + 3);
a = t->ms_cur[0];
b = mseq_q15(t->ms[0][t->ms_step]);
ok(a != b && a < b, "MOD SEQ: SMTH glides to the step's value");
t->p[P_MSSMTH] = 0;
}
trk_note_off(t, 60);
{ /* SYNC: the song's grid */
uint32_t into, slen, g = 1;
t->p[P_MSKEY] = 0, t->p[P_MSLEN] = 16;
transport_req = 1;
run(2);
for (i = 0; i < 40u; i++) {
run(37);
g &= t->ms_step == grid_at(2, 0, &into, &slen) % 16u || into < 64u * 120u;
}
transport_req = 2;
run(2);
ok(g, "MOD SEQ SYNC: on the song's grid while it plays");
t->p[P_MSKEY] = 1;
}
{ /* SEQ1 -> CUT changes the sound; SEQ3 (the rhythm) -> AMP gates it */
static int32_t a[8192];
double lo, hi;
quiet();
plain(t, 0, 0);
t->p[P_E4] = 60;
trk_note_on(t, 48, 100);
run(800);
memcpy(a, cl + 8192, sizeof a);
quiet();
t->p[P_M1SRC] = MS_SEQ1, t->p[P_M1DST] = MT_CUT, t->p[P_M1AMT] = 63;
trk_note_on(t, 48, 100);
run(800);
ok(memcmp(a, cl + 8192, sizeof a) != 0, "MOD SEQ: SEQ1 -> CUT moves the sound");
quiet();
t->p[P_M1SRC] = MS_SEQ3, t->p[P_M1DST] = MT_AMP, t->p[P_M1AMT] = 63;
t->p[P_MSRATE] = 5; /* 1/4: 22050 samples a step */
trk_note_on(t, 48, 100);
run(1400); /* steps 0, 1 (7: up), 2 (-8: down) */
lo = rms_l(44100 + 4000, 16000);
hi = rms_l(4000, 16000);
ok(hi > 3.0 * lo, "MOD SEQ: SEQ3 (the rhythm) -> AMP: its steps up loud, down quiet");
t->p[P_M1SRC] = 0, t->p[P_M1AMT] = 0, t->p[P_MSRATE] = 2;
}
}
static project_t pj;
static void t_storage(void)
{
track_t *a = &trk[0], *b = &trk[1];
uint32_t i, l, s, good = 1;
int8_t ma[MSEQ_LANES][MSEQ_STEPS], mb[MSEQ_LANES][MSEQ_STEPS];
quiet();
plain(a, ENGI_JUNO, 0);
plain(b, ENGI_VECTOR, 0);
for (l = 0; l < MSEQ_LANES; l++)
for (s = 0; s < MSEQ_STEPS; s++)
a->ms[l][s] = ma[l][s] = (int8_t)((int32_t)((l * 7u + s * 5u) % 16u) - 8),
b->ms[l][s] = mb[l][s] = (int8_t)((int32_t)((l * 3u + s * 11u + 4u) % 16u) - 8);
a->p[P_MSRATE] = 8, a->p[P_MSLEN] = 1, a->p[P_MSSMTH] = 127, a->p[P_MSKEY] = 0, a->p[P_SPICE] = 127, a->p[P_DICE] = 99;
b->p[P_MSRATE] = 0, b->p[P_MSLEN] = 16, b->p[P_MSSMTH] = 3, b->p[P_MSKEY] = 1, b->p[P_SPICE] = 1, b->p[P_DICE] = 0;
a->p[P_ITYPE] = IT_JUNO2, a->p[P_IMIX] = 77, a->p[P_M2SRC] = MS_SEQ4;
proj_capture(&pj);
mseq_init(a), mseq_init(b);
for (i = P_MSRATE; i <= P_DICE; i++)
a->p[i] = b->p[i] = TP[i].def;
a->p[P_ITYPE] = 0, a->p[P_M2SRC] = 0;
proj_apply(&pj, 1);
good = !memcmp(a->ms, ma, sizeof ma) && !memcmp(b->ms, mb, sizeof mb) && a->p[P_MSRATE] == 8 && a->p[P_MSLEN] == 1 &&
a->p[P_MSSMTH] == 127 && a->p[P_MSKEY] == 0 && a->p[P_SPICE] == 127 && a->p[P_DICE] == 99 &&
b->p[P_MSRATE] == 0 && b->p[P_MSLEN] == 16 && b->p[P_MSSMTH] == 3 && b->p[P_MSKEY] == 1 && b->p[P_SPICE] == 1 &&
b->p[P_DICE] == 0 && a->p[P_ITYPE] == IT_JUNO2 && a->p[P_IMIX] == 77 && a->p[P_M2SRC] == MS_SEQ4 &&
a->eng_req == ENGI_JUNO && b->eng_req == ENGI_VECTOR && sizeof pj == 3840u;
ok(good, "project: both sounds' MOD SEQ (steps, RATE LEN SMTH START), SPICE, DICE kept; JUNO, VECTOR; the size unchanged");
{ /* as 0.7 wrote it: no 0.8 bytes, no steps */
uint8_t raw[3u * NLOCK];
uint32_t k;
proj_capture(&pj);
for (k = 0; k < NLOCK; k++)
raw[3u * k] = pj.t[2].lock[k].param, raw[3u * k + 1u] = (uint8_t)pj.t[2].lock[k].val,
raw[3u * k + 2u] = (uint8_t)((uint16_t)pj.t[2].lock[k].val >> 8);
memset(raw + PROJ_XM2 + 1u, 0, sizeof raw - PROJ_XM2 - 1u);
for (k = 0; k < NLOCK; k++)
pj.t[2].lock[k].param = raw[3u * k], pj.t[2].lock[k].val = (int16_t)(raw[3u * k + 1u] | raw[3u * k + 2u] << 8);
for (k = 0; k < NLOCK; k++)
pj.t[3].lock[k].step = LOCK_FREE, pj.t[3].lock[k].param = 0, pj.t[3].lock[k].val = 0;
proj_apply(&pj, 1);
ok(!memcmp(a->ms, MSEQ_INIT, sizeof ma) && a->p[P_MSLEN] == TP[P_MSLEN].def && a->p[P_SPICE] == 0 &&
a->p[P_ITYPE] == IT_JUNO2 && a->p[P_IMIX] == 77, "a project of 0.7: its INSERT read, the MOD SEQ's shapes and defaults");
}
{ /* user presets */
up_rec_t r;
int16_t v[P_COUNT], out[P_COUNT], def[P_COUNT];
int8_t got[MSEQ_LANES][MSEQ_STEPS];
uint32_t same = 1;
for (i = 0; i < P_COUNT; i++)
def[i] = i >= P_E0 ? 0 : TP[i].def;
for (i = 0; i < P_COUNT; i++)
v[i] = (int16_t)(i >= P_E0 ? 40 + i : i < UP_E0V ? i * 3 : TP[i].min + (int32_t)(i * 7u) % (TP[i].max - TP[i].min + 1));
memset(&r, 0, sizeof r);
r.used = UP_USED, r.ver = UP_VER, r.name[0] = 'M';
up_rec_set(&r, v);
ok(!up_has_ms(&r), "user presets: a record without the MOD SEQ's steps says so");
up_ms_put(&r, ma);
up_params(&r, out, def);
for (i = 0; i < P_COUNT; i++)
same &= out[i] == v[i];
up_ms_get(&r, got);
ok(same && up_has_ms(&r) && !memcmp(got, ma, sizeof got) && r.np == 61u && r.p[53] == 40 + P_E0 && up_valid(&r),
"user presets: the MOD SEQ's steps (note / flags) and values (the side) back exactly; SLOOP's view the same");
memset(up_xs, 0, sizeof up_xs); /* (a record of 0.7: no side bytes) */
up_params(&r, out, def);
ok(out[P_MSLEN] == TP[P_MSLEN].def && out[P_SPICE] == 0 && out[P_MSKEY] == TP[P_MSKEY].def,
"user presets: a record without side bytes: the MOD SEQ's and SPICE's defaults");
}
}
/* the arp's notes over 32 steps: note, or 0 (a rest), and their velocities */
static void arp_take(uint32_t spice, uint32_t dice, uint8_t *notes, uint8_t *vels)
{
track_t *t = &trk[0];
uint32_t k = 0, b, last_idx;
quiet();
plain(t, 0, 0);
t->p[P_SPICE] = (int16_t)spice, t->p[P_DICE] = (int16_t)dice;
t->p[P_AMODE] = 1, t->p[P_ARATE] = 2, t->p[P_AGATE] = 64, t->p[P_APROB] = 127, t->p[P_AOCT] = 1;
t->arp_idx = 0;
input_on(t, 60, 100);
input_on(t, 64, 100);
input_on(t, 67, 100);
last_idx = t->arp_idx;
for (b = 0; b < 6000u && k < 32u; b++) {
run(1);
if (t->arp_idx != last_idx) {
uint32_t i, vel = 0;
last_idx = t->arp_idx;
for (i = 0; i < NVOICE; i++)
if (t->v[i].active && t->v[i].gate && t->v[i].note == t->arp_note)
vel = t->v[i].vel;
notes[k] = t->arp_note;
vels[k++] = (uint8_t)vel;
}
}
input_off(t, 60);
input_off(t, 64);
input_off(t, 67);
t->p[P_AMODE] = 0, t->p[P_SPICE] = 0;
run(50);
}
static void t_spice(void)
{
uint8_t n0[32], v0[32], n1[32], v1[32], n2[32], v2[32], n3[32], v3[32];
uint32_t i, rest = 0, oct = 0, velv = 0, plain_ok = 1;
arp_take(0, 0, n0, v0);
for (i = 0; i < 32u; i++)
plain_ok &= n0[i] == (uint8_t)(i % 3u == 0u ? 60 : i % 3u == 1u ? 64 : 67) && v0[i] == 100u;
ok(plain_ok, "SPICE 0: the arp as written (UP, every note at velocity 100)");
arp_take(127, 5, n1, v1);
for (i = 0; i < 32u; i++) {
rest += n1[i] == 0u;
oct += n1[i] && n1[i] != n0[i] && (n1[i] == n0[i] + 12u || n1[i] + 12u == n0[i]);
velv += n1[i] && v1[i] != 100u;
}
ok(rest >= 1u && rest <= 14u && oct >= 1u && velv >= 8u, "SPICE 127: some rests, some octaves, the velocities move");
arp_take(127, 5, n2, v2);
arp_take(127, 6, n3, v3);
ok(!memcmp(n1, n2, 32) && !memcmp(v1, v2, 32), "SPICE: the same DICE, the same variation");
ok(memcmp(n1, n3, 32) || memcmp(v1, v3, 32), "SPICE: another DICE, another variation");
{ /* the first 16 and the next 16: the same (the variation loops over 16 notes); the notes cycle every 3 */
uint32_t same = 1;
for (i = 0; i < 16u; i++)
same &= (n1[i] == 0u) == (n1[i + 16u] == 0u) && v1[i] == v1[i + 16u];
ok(same, "SPICE: the variation comes round every 16 notes");
}
{ /* the sequencer: a pattern of C4s; with SPICE some steps rest or jump, the pattern itself unchanged */
track_t *t = &trk[0];
static const uint8_t c4[1] = {60};
step_t before[16];
uint32_t b, rests = 0, jumps = 0, plays = 0, s, last = 99;
quiet();
plain(t, 0, 0);
steps_clear(t);
t->p[P_SLEN] = 16, t->p[P_SDIV] = 2, t->p[P_SGATE] = 64;
for (s = 0; s < 16u; s++)
put_step(t, s, 1, c4, ST_NOTE, 0);
memcpy(before, t->step, sizeof before);
t->p[P_SPICE] = 127, t->p[P_DICE] = 9;
transport_req = 1;
for (b = 0; b < 16u * 173u + 40u; b++) {
uint32_t q, st = at_step(t, &q), i2, n60 = 0, nother = 0;
run(1);
if (st == last || q < 30u || q > 45u)
continue;
last = st;
for (i2 = 0; i2 < NVOICE; i2++)
if (t->v[i2].active && t->v[i2].gate)
t->v[i2].note == 60 ? n60++ : nother++;
plays += n60 > 0u;
jumps += nother > 0u;
rests += !n60 && !nother;
}
transport_req = 2;
run(4);
t->p[P_SPICE] = 0;
ok(rests >= 1u && jumps >= 1u && plays >= 6u && !memcmp(before, t->step, sizeof before),
"SPICE on the sequencer: steps rest or jump an octave, the rest play; the pattern unchanged");
}
}
int main(void)
{
uint32_t i;
host_tracks_init();
for (i = 0; i < NPART; i++)
host_preset(&trk[i], TRK_DEF[i][0], TRK_DEF[i][1]);
clipper_proj_neutral();
trk[1].p[P_LYMODE] = LY_OFF;
t_juno();
t_vector();
t_mseq();
t_storage();
t_spice();
printf(fails ? "synth8: %d FAILED\n" : "synth8: all passed\n", fails);
return fails;
}
+136
View File
@@ -0,0 +1,136 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-only
# Copyright (C) 2026 3dSam (Clipper)
"""VECTOR's waves (firmware/src/eng_vector.c, Clipper 0.8): 16 single cycles of Clipper's own, each in three
band-limited copies (the voice reads the one whose top harmonic stays under ~20 kHz at its pitch):
512 points, harmonics to the 96th (notes to ~208 Hz), 128 points to the 24th (~833 Hz), 32 points to the 6th.
Written to firmware/src/vector_tables.h (committed: no build step). Usage: python3 tools/gen_vector.py [out.h]
Each wave is a spectrum (harmonic -> amplitude, phase), made here from simple recipes (no samples of anyone's); the
three copies share one scale (the loudest copy's peak 0.9), so a note crossing a copy's range keeps its level."""
import math
import random
import sys
TAU = 2 * math.pi
LEVELS = [(512, 96), (128, 24), (32, 6)]
def soft(k, nh): # a gentle roll-off at the copy's top (no ringing edge)
return 0.5 + 0.5 * math.cos(math.pi * k / (nh + 1))
def spec_saw(k):
return 1.0 / k, 0.0
def spec_sqr(k):
return (1.0 / k if k % 2 else 0.0), 0.0
def spec_pulse(w):
return lambda k: (math.sin(math.pi * k * w) / k, -math.pi / 2)
def spec_tri(k):
return ((1.0 / (k * k)) * (1 if (k // 2) % 2 == 0 else -1) if k % 2 else 0.0), 0.0
def spec_sine(k):
return (1.0 if k == 1 else 0.0), 0.0
def spec_organ(k): # drawbars 16' 8' 4' 2 2/3' 2' (the fundamental here = 8')
bars = {1: 1.0, 2: 0.8, 3: 0.55, 4: 0.5, 6: 0.3, 8: 0.25}
return bars.get(k, 0.0), 0.0
def formant(centres):
def f(k):
a = 0.0
for c, bw, g in centres:
a += g * math.exp(-((k - c) / bw) ** 2)
return a / math.sqrt(k), 0.0
return f
def spec_bell(k): # harmonic stand-ins for a bell's partials (2, 3, 4.2 -> 4, 5.4 -> 5, 8)
return {1: 0.6, 2: 1.0, 3: 0.7, 4: 0.45, 5: 0.5, 8: 0.35, 11: 0.2, 16: 0.12}.get(k, 0.0), 0.0
def spec_hollow(k): # odd harmonics, slowly falling (a clarinet's idea)
return ((1.0 / k ** 0.7) if k % 2 else 0.04 / k), 0.0
def spec_bright(k): # a saw with its upper half lifted (a buzzy brass)
return (1.0 / k) * (1.0 + 1.5 * math.exp(-((k - 9) / 5.0) ** 2)), 0.0
def spec_reso(k): # a resonant peak at the 8th harmonic (a swept filter frozen)
return (1.0 / k) * (1.0 + 6.0 * math.exp(-((k - 8) / 1.5) ** 2)), 0.0
def spec_digi(): # a PPG-like digital spectrum: random levels and phases, fixed seed
rnd = random.Random(808)
lv = [rnd.random() ** 2 for _ in range(97)]
ph = [rnd.random() * TAU for _ in range(97)]
return lambda k: (lv[k] / math.sqrt(k), ph[k])
def spec_string(k): # a saw through a comb (the bowed string's notches)
return (1.0 / k) * abs(math.sin(math.pi * k * 0.18)) * 1.3, 0.0
def spec_metal(k): # sparse high partials (a struck metal)
return {1: 0.5, 3: 0.3, 7: 0.6, 9: 0.5, 13: 0.45, 17: 0.4, 19: 0.3, 23: 0.35, 29: 0.25, 31: 0.2}.get(k, 0.0), 0.0
def spec_glass(k): # a sine with a soft octave and twelfth (a glassy pad)
return {1: 1.0, 2: 0.35, 3: 0.25, 4: 0.1, 6: 0.15, 12: 0.06}.get(k, 0.0), 0.0
WAVES = [
("SINE", spec_sine), ("TRI", spec_tri), ("SAW", spec_saw), ("SQR", spec_sqr), ("PLS25", spec_pulse(0.25)),
("PLS10", spec_pulse(0.10)), ("ORGAN", spec_organ), ("VOX A", formant([(7, 2.0, 1.0), (13, 3.0, 0.6)])),
("VOX O", formant([(4, 1.5, 1.0), (8, 2.0, 0.4)])), ("BELL", spec_bell), ("HOLLW", spec_hollow),
("BRASS", spec_bright), ("RESO", spec_reso), ("DIGI", spec_digi()), ("STRNG", spec_string), ("METAL", spec_metal),
]
def render(spec, n, nh):
out = [0.0] * n
for k in range(1, nh + 1):
a, ph = spec(k)
if not a:
continue
a *= soft(k, nh) if nh > 6 else 1.0
for i in range(n):
out[i] += a * math.sin(TAU * k * i / n + ph)
return out
def main():
out = sys.argv[1] if len(sys.argv) > 1 else "firmware/src/vector_tables.h"
rows = []
for name, spec in WAVES:
copies = [render(spec, n, nh) for n, nh in LEVELS]
pk = max(max(abs(x) for x in c) for c in copies)
g = 0.9 * 32767 / pk
rows.append((name, [[int(round(x * g)) for x in c] for c in copies]))
lines = ["/* generated by tools/gen_vector.py: VECTOR's waves, 16 x (512 + 128 + 32) int16 (eng_vector.c) */",
"#pragma once",
"#define VEC_NW 16u",
"#define VEC_PTS (512u + 128u + 32u)",
"static const char *const N_VEC_WAVE[VEC_NW] = {%s};" % ", ".join('"%s"' % n for n, _ in rows),
"static const int16_t VEC_WAVE[VEC_NW][VEC_PTS] = {"]
for name, copies in rows:
lines.append(" { /* %s */" % name)
flat = copies[0] + copies[1] + copies[2]
for i in range(0, len(flat), 16):
lines.append(" " + ", ".join(str(x) for x in flat[i:i + 16]) + ",")
lines.append(" },")
lines.append("};")
open(out, "w").write("\n".join(lines) + "\n")
if __name__ == "__main__":
main()
+20
View File
@@ -461,6 +461,26 @@ scaling, detune 0..14 with 7 in tune), the routing 72..107 (`mod[to][from]`, 0..
feedback), the outputs 108..113, the template it came from 114 (1..40, 0 none), the pitch envelope 115 (64 none, +-24
semitones) and its time 116, the level 117 (100 unity), the name 118..127.
## v13: the MOD SEQ (Clipper 0.8)
INFO ends with 13. Each synth part (0 the instrument, 1 the layer) has a MOD SEQ (`seq.c mseq_tick`): four lanes of
16 steps, each -8..7, read by the matrix as the sources SEQ1..SEQ4 (`MS_SEQ1..MS_SEQ4`, 11..14). Its RATE, LEN, SMTH,
START (ids 83..86) and SPICE, DICE (87, 88: the arp's and the sequencer's notes vary) are parameters as any other
(GET / SET / DESC); P_E0 is 89, P_COUNT 97. The steps:
| cmd | name | request | reply |
|---|---|---|---|
| 93 | MSEQ_GET | part | part, rc, 64 bytes |
| 94 | MSEQ_PUT | part, 64 bytes | part, rc |
- the 64 bytes: lane 1's 16 steps, then lane 2's, 3's, 4's; each the value + 8 (0..15). MSEQ_PUT clamps each.
- rc 0 ok, 1 bad request (a part other than 0, 1; MSEQ_PUT without its 64 bytes).
- They go with the sound: a factory preset brings four shapes to start from; user presets keep them (the record's
note / flags, `upreset.c up_ms_put`; their RATE .. DICE in the bank's side record) and projects (track 4's free lock
slots; RATE .. DICE after 0.6's INSERT in track 3's). UP_GET sends note / flags as they are.
- 0.8 also has the engines JUNO (21) and VECTOR (22), and the INSERT's types JUNO1, JUNO2, JUN12 (9..11: the JUNO
chorus on any sound; A WIDTH, B TONE, C NOISE).
## Notes for the editor
- **One request at a time.** Wait for the reply, about 10–50 ms, before sending the next.
+143 -4
View File
@@ -406,6 +406,14 @@
#hypanel h3 { margin: 16px 0 6px; color: var(--dim); text-transform: uppercase; }
#fxpanel h3 { margin: 16px 0 6px; color: var(--dim); text-transform: uppercase; }
#fxpanel .fxn { width: 3.4em; }
#msbody .msrow { display: flex; align-items: center; gap: 2px; margin: 4px 0; }
#msbody .mslab { width: 3.2em; cursor: pointer; color: var(--dim); }
#msbody .msrow.sel .mslab { color: var(--fg); font-weight: 600; }
#msbody .mscell { position: relative; width: 22px; height: 48px; background: var(--s2);
border-radius: 2px; cursor: ns-resize; touch-action: none; }
#msbody .mscell::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(127,127,127,.4); }
#msbody .msbar { position: absolute; left: 3px; right: 3px; background: var(--t2); border-radius: 1px; z-index: 1; }
#msbody .msrow.sel .msbar { background: var(--t3); }
#fxpanel td.fxfb .fxn { outline: 1px dashed var(--hi); }
#fxpanel .fxgraph { width: 100%; max-width: 560px; height: auto; display: block; margin: 4px 0 8px; }
.hy { overflow-x: auto; }
@@ -588,6 +596,15 @@
<label><span data-t="fxStoreTo"></span> <select id="fxslot"></select></label> <button id="fxstore" data-t="fxStore"></button></p>
<div id="fxbody"></div>
</div>
<!-- Clipper 0.8: the MOD SEQ's steps (firmware protocol v13): every engine -->
<div class="card" id="mspanel" hidden>
<h2 data-t="msTitle" data-ic="ui_knob"></h2>
<p class="dim" data-t="msHelp"></p>
<p class="bar"><button id="msread" data-t="hyReadBtn"></button> <button id="mssend" class="pri" data-t="hySendBtn"></button>
<label><input type="checkbox" id="mslive" checked> <span data-t="hyLive"></span></label>
<label><span data-t="msShape"></span> <select id="msshape"></select></label> <button id="msapply" data-t="msApply"></button></p>
<div id="msbody"></div>
</div>
<!-- Clipper: the HYBRID engine's patch (firmware protocol v11): only while the selected track plays HYBRID -->
<div class="card" id="hypanel" hidden>
<h2 data-t="hyTitle" data-ic="ui_knob"></h2>
@@ -791,7 +808,8 @@ const CMD = { INFO: 1, GET: 2, SET: 3, DUMP: 4, DESC: 5, STEP_GET: 6, STEP_SET:
FM6_GET: 68, FM6_PUT: 69, FM6_LIST: 70, FM6_ERASE: 71, /* v9 (SLOOP 2.4): the FM6 engine's patches (Felucca 1.0's numbers) */
DSYN_LIST: 72, DSYN_GET: 73, DSYN_PUT: 74, DSYN_STORE: 75, DSYN_PLAY: 76, /* v10 (SLOOP 2.5): the SYN drum kits */
HY_GET: 77, HY_PUT: 78, /* v11 (Clipper): the HYBRID engine's patches */
FMX_GET: 90, FMX_PUT: 91, FMX_STORE: 92 }; /* v12 (Clipper 0.6): the FMX engine's patches */
FMX_GET: 90, FMX_PUT: 91, FMX_STORE: 92, /* v12 (Clipper 0.6): the FMX engine's patches */
MSEQ_GET: 93, MSEQ_PUT: 94 }; /* v13 (Clipper 0.8): the MOD SEQ's steps of a part */
/* v7: the parameters a step can lock (firmware seq.c p_lockable: the sound, not the sequencer / arp / key / voice
mode); ids as core.h: LEVEL .. LFO dests, GATE, the sends, GLIDE, PAN, DETUNE, the SLICER, the engine's 8 (from pe0:
53, or 78 on Clipper 0.4, whose LFO 2, ENV 2 and matrix at 53..77 are not lockable) */
@@ -994,6 +1012,9 @@ const parse = {
/* v12 (Clipper 0.6): an FMX patch, pack7 of its 128 bytes (FX.unpack) */
[CMD.FMX_GET](a) { return { target: a[0], index: a[1], rc: a[2], bytes: a[2] ? null : unpack7(a.slice(3)).slice(0, 128) }; },
[CMD.FMX_PUT](a) { return { target: a[0], index: a[1], rc: a[2] }; },
/* v13: part, rc, 64 values (lane 1's 16 steps, lane 2's ..: -8..7) */
[CMD.MSEQ_GET](a) { return { part: a[0], rc: a[1], steps: a[1] ? null : Array.from(a.slice(2, 66), (x) => x - 8) }; },
[CMD.MSEQ_PUT](a) { return { part: a[0], rc: a[1] }; },
[CMD.FMX_STORE](a) { return { slot: a[0], rc: a[1] }; },
[CMD.FM6_LIST](a) {
const r = new Reader(a), o = { factory: r.b(), bank: r.b(), slots: [] };
@@ -1097,6 +1118,8 @@ const req = {
hyPut: (part, bytes) => [CMD.HY_PUT, [0, part & 0x7F, ...pack7(bytes)]],
fmxGet: (target, i) => [CMD.FMX_GET, [target & 0x7F, i & 0x7F]],
fmxPut: (part, bytes) => [CMD.FMX_PUT, [0, part & 0x7F, ...pack7(bytes)]],
mseqGet: (part) => [CMD.MSEQ_GET, [part & 0x7F]],
mseqPut: (part, steps) => [CMD.MSEQ_PUT, [part & 0x7F, ...steps.map((v) => Math.max(0, Math.min(15, (v | 0) + 8)))]],
fmxStore: (slot, bytes) => [CMD.FMX_STORE, [slot & 0x7F, ...pack7(bytes)]],
fm6List: () => [CMD.FM6_LIST, []],
fm6Erase: (i) => [CMD.FM6_ERASE, [i & 0x7F]],
@@ -1131,6 +1154,7 @@ function replyMatches(cmd, args, a) {
case CMD.HY_GET: case CMD.HY_PUT: return a[0] === args[0] && a[1] === args[1];
case CMD.FMX_GET: case CMD.FMX_PUT: return a[0] === args[0] && a[1] === args[1];
case CMD.FMX_STORE: return a[0] === args[0];
case CMD.MSEQ_GET: case CMD.MSEQ_PUT: return a[0] === args[0];
case CMD.FM6_ERASE: return a[0] === args[0];
case CMD.DSYN_GET: return a[0] === args[0];
case CMD.DSYN_PUT: case CMD.DSYN_PLAY: return a[0] === args[0] && a[1] === args[1];
@@ -2516,12 +2540,25 @@ function makeMockDevice(opt = {}) {
D("PITCH", F.PCT, 0, 127, 64), D("CUT", F.CUTOFF, 0, 127, 110), D("RES", F.PCT, 0, 127, 10)],
presets: ["WAVE STEPS", "RHYTHM SEQ", "SWEEP PAD", "FIFTH STAB"].map((n, i) => P(n, [i, 40, 20, 0, 0, 64, 110, 10], [0, 90, 110, 50], 0)) });
ge.names = [...ge.names, "FMX", "WSEQ"];
if (opt.clipper !== "0.6" && opt.clipper !== "0.7") { /* Clipper 0.8: JUNO, VECTOR, protocol 13 (the MOD SEQ) */
ENG.push({ name: "JUNO", titles: ["DCO", "VCF"], edit: [E("WAVE", ["SAW", "PLS", "S+P"], 2), D("PW", F.PCT, 0, 127, 30),
D("SUB", F.PCT, 0, 127, 40), D("NOIS", F.PCT, 0, 127, 0), E("HPF", ["0", "1", "2", "3"], 1), D("CUT", F.CUTOFF, 0, 127, 90),
D("RES", F.PCT, 0, 127, 20), E("CHOR", ["OFF", "I", "II", "I+II"], 1)],
presets: ["JUNO 106 PAD", "JUNO BRASS", "JUNO BASS", "JUNO STRINGS"].map((n, i) => P(n, [[2, 0, 1, 0][i], 40, 40, 0, 1, 88, 20, [1, 0, 0, 2][i]], [70, 100, 115, 95], 0)) });
const VW = ["SINE", "TRI", "SAW", "SQR", "PLS25", "PLS10", "ORGAN", "VOX A", "VOX O", "BELL", "HOLLW", "BRASS", "RESO", "DIGI", "STRNG", "METAL"];
ENG.push({ name: "VECTOR", titles: ["WAVES", "JOYSTICK"], edit: [E("A", VW, 2), E("B", VW, 7), E("C", VW, 14), E("D", VW, 9),
D("X", F.BIPCT, -64, 63, 0), D("Y", F.BIPCT, -64, 63, 0),
E("MOVE", ["OFF", "CIRC", "CIRC+", "8", "8+", "SWEEP", "SWP+", "LOOP", "LOOP+", "RND", "RND+"], 1), D("CUT", F.CUTOFF, 0, 127, 100)],
presets: ["VS PAD", "VECTOR SWEEP", "VS BRASS", "GLASS VS"].map((n) => P(n, [2, 7, 14, 9, 0, 0, 1, 100], [70, 100, 115, 95], 0)) });
ge.names = [...ge.names, "JUNO", "VECTOR"];
}
}
}
ge.max = ge.names.length - 1;
}
const HY_E = ENG.findIndex((e) => e.name === "HYBRID");
const FX_E = ENG.findIndex((e) => e.name === "FMX");
const JU_E = ENG.findIndex((e) => e.name === "JUNO"); /* (Clipper 0.8: protocol 13, the MOD SEQ) */
const FM6_E = ENG.findIndex((e) => e.name === "FM6"), FM6_BANK = 27, FM6_NPART = 3;
const v9 = !opt.legacy && !opt.v3 && !opt.noBackup && !opt.v7 && !opt.v8; /* SLOOP 2.4: FM6 patches */
const v10 = v9 && !opt.v9; /* SLOOP 2.5: the SYN drum kits */
@@ -2728,7 +2765,7 @@ function makeMockDevice(opt = {}) {
s(opt.legacy ? "FELUCCA 0.4 BETA (MOCK)" : opt.v3 ? "FELUCCA 0.8 (MOCK)" : (opt.clipper ? "FELUCCA CLIPPER 0.2 (MOCK)" : "FELUCCA SLOOP 2.0 (MOCK)")); b(ENG.length); b(P_COUNT); b(G_COUNT); b(NSTEP); b(P_E0);
ENG.forEach((e) => s(e.name));
if (!opt.legacy) b(NTRK);
if (v5) b(opt.noBackup ? 5 : opt.v7 ? 7 : opt.v8 ? 8 : opt.v9 ? 9 : opt.clipper ? (FX_E >= 0 ? 12 : 11) : 10); /* v10: SYN kits (v9: FM6 patches, v8: fill conditions, v7: nudges and locks, v6: backup) */
if (v5) b(opt.noBackup ? 5 : opt.v7 ? 7 : opt.v8 ? 8 : opt.v9 ? 9 : opt.clipper ? (JU_E >= 0 ? 13 : FX_E >= 0 ? 12 : 11) : 10); /* v10: SYN kits (v9: FM6 patches, v8: fill conditions, v7: nudges and locks, v6: backup) */
break;
case CMD.GET: case CMD.SET: {
if (a.length < 2) return null;
@@ -3038,6 +3075,23 @@ function makeMockDevice(opt = {}) {
}
break;
}
case CMD.MSEQ_GET: case CMD.MSEQ_PUT: { /* Clipper 0.8: editor_fmx.c ed_mseq_handle */
if (JU_E < 0) return null;
const tr = a.length && a[0] < 2 ? st.tracks[a[0]] : null;
const INIT = [[-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7], [0, 2, 4, 6, 7, 5, 3, 1, -1, -3, -5, -7, -8, -6, -4, -2],
[7, 7, -8, -8, 7, -8, 7, 7, -8, 7, -8, -8, 7, -8, 7, -8], [3, -5, 6, -2, 0, 7, -7, 2, -4, 5, -1, -8, 4, 1, -6, 6]].flat();
if (tr && !tr.ms) tr.ms = INIT.slice();
if (cmd === CMD.MSEQ_GET) {
const rc = a.length !== 1 || !tr ? 1 : 0;
b(a.length ? a[0] : 127); b(rc);
if (!rc) tr.ms.forEach((v) => b(v + 8));
} else {
const rc = a.length !== 65 || !tr ? 1 : 0;
if (!rc) tr.ms = Array.from(a.slice(1), (x) => Math.max(-8, Math.min(7, x - 8)));
b(a.length ? a[0] : 127); b(rc);
}
break;
}
case CMD.HY_GET: case CMD.HY_PUT: { /* Clipper: editor_hybrid.c */
if (!opt.clipper) return null;
const pa = a[1], tr = pa < 3 ? st.tracks[pa] : null;
@@ -4099,6 +4153,8 @@ const TEXT = {
smpSlots: "サンプルスロット", userBank: "ユーザープリセット", none: "なし",
fm6Title: "FM6 の音色(6 オペレーター)", fm6Help: "FM6 エンジンの音色をまるごと編集します。本体のノブ(EDIT の 8 つ)はこの音色の上にかかるマクロです。トラックへ送るとすぐ鳴り、PTCH を回すか別の音を読み込むまでそのトラックの音色になります(プロジェクトは PTCH だけを保存します)。バンク(B1〜B27)に保存すると PTCH で呼び出せます(本体を停止してから)。",
hyTitle: "HYBRID の音色(Clipper)", hyHelp: "HYBRID エンジンの音色をまるごと編集します。ボイスごとに 3 オシレーター、2 フィルター、専用のエンベロープ 2 つと LFO 2 つ、16 スロットのモジュレーション・マトリクス。本体のノブはこの上の 8 つの値です(CUT、RES、FENV、PTCH、マクロ M1〜M4 はマトリクスのソース)。LIVE ではすぐに音が変わります。PTCH を回すか別の音を読み込むまでトラックの音色です(プロジェクトは PTCH だけ保存:残したい音色は書き出してください)。",
msTitle: "MOD SEQ(16ステップ×4レーン)", msHelp: "サウンドのモジュレーション・シーケンサー:16ステップ(-8..7)の4レーン。RATEで進み(LFOグループのMOD SEQ 2:RATE・LEN・SMTH・START)、マトリックスのソースSEQ1..SEQ4になります。バーを上下にドラッグ、レーン名のクリックでSHAPEの対象を選択。ライブで変更ごとに送信。サウンドと一緒に保存(ユーザープリセット・プロジェクト)。",
msShape: "シェイプ", msApply: "レーンに適用",
fxTitle: "FMXパッチ(6オペレーター・自由なルーティング)", fxHelp: "FMXエンジンのパッチ全体:オペレーターごとの波形とモード(PM・FM・RING)、比率または固定周波数、エンベロープ。どのオペレーターも他のどれでも変調でき(自分自身はフィードバック)、どれでも出力へ。テンプレート(DX7の32種と8種)から始めて自由に変更。STOREでバンク(B1..B27)に保存(再生を止めてから)。",
fxRouting: "ルーティング", fxTemplate: "テンプレート", fxTemplateHelp: "(行がオペレーター、列がそれを変調するもの、対角線はフィードバック、OUTは出力)",
fxOps: "オペレーター", fxGlobal: "ピッチエンベロープとレベル", fxStoreTo: "保存先", fxStore: "保存", fxStored: "保存しました", fxEmpty: "空のスロット:", fxStopFirst: "先に再生を止めてください",
@@ -4317,6 +4373,8 @@ const TEXT = {
smpSlots: "Sample slots", userBank: "User presets", none: "none",
fm6Title: "FM6 patch (six operators)", fm6Help: "Edit the whole patch of the FM6 engine. The device's knobs (the eight EDIT values) are macros on top of it. Sent to a track it plays at once and stays that track's patch until PTCH turns or another sound loads (a project keeps PTCH only); stored in the bank (B1..B27) it is a PTCH value (stop the device first).",
hyTitle: "HYBRID patch (Clipper)", hyHelp: "The whole patch of the HYBRID engine: three oscillators, two filters, two envelopes and two LFOs of its own per voice, and a 16-slot modulation matrix. The device's knobs play eight values on top of it (CUT, RES, FENV, PTCH and the macros M1..M4: matrix sources). With LIVE each change is heard at once; the patch stays the track's until PTCH turns or another sound loads (a project keeps PTCH: export the patch to keep it).",
msTitle: "MOD SEQ (four lanes of 16 steps)", msHelp: "The sound's modulation sequencer: four lanes of 16 steps (-8..7), stepping at RATE (MOD SEQ 2 in the LFO group: RATE, LEN, SMTH, START), read by the matrix as SEQ1..SEQ4. Drag a bar up or down; click a lane's name to pick it for SHAPE. LIVE sends each change. Kept with the sound (user presets, projects).",
msShape: "shape", msApply: "Apply to the lane",
fxTitle: "FMX patch (six operators, any routing)", fxHelp: "The whole patch of the FMX engine: each operator its own wave (sine, triangle, saw, square, OPL halves and quarters, pulse, 8-bit sine, noise) and its own mode (PM as the DX7, true FM, RING), a ratio or a fixed frequency, an envelope; any operator into any other (its own: feedback) and any to the output. Start from a template (the DX7's 32 and 8 more), then change any connection. The device's EDIT knobs are macros on top (PTCH, ALG, MOD, FB, TIME, DTN, VEL, KTRK). With LIVE each change is heard at once; STORE keeps it in a bank slot (B1..B27, stop the device first): then it is a PTCH value, kept with presets and projects.",
fxRouting: "Routing", fxTemplate: "template", fxTemplateHelp: "(fills the grid: a row is an operator, a column what modulates it; the diagonal is feedback; OUT to the output)",
fxOps: "Operators", fxGlobal: "Pitch envelope and level", fxStoreTo: "store to", fxStore: "Store", fxStored: "Stored in", fxEmpty: "Empty slot:", fxStopFirst: "Stop the song first (a flash write silences the audio a moment)",
@@ -4563,20 +4621,23 @@ const EXPECT = { pcount: 61, gcount: [32, 33], pe0: 53 }; /* gcount 33: 2.5's
const EXPECT_04 = { pcount: 86, pe0: 78 };
/* Clipper 0.6: 5 more just before P_E0: the sound's INSERT (78..82: TYPE, A, B, C, MIX) */
const EXPECT_06 = { pcount: 91, pe0: 83 };
/* Clipper 0.8: 6 more just before P_E0: the MOD SEQ's RATE LEN SMTH START (83..86), SPICE, DICE (87, 88) */
const EXPECT_08 = { pcount: 97, pe0: 89 };
const layoutKnown = (info) => EXPECT.gcount.includes(info.gcount) &&
[EXPECT, EXPECT_04, EXPECT_06].some((x) => info.pcount === x.pcount && info.pe0 === x.pe0);
[EXPECT, EXPECT_04, EXPECT_06, EXPECT_08].some((x) => info.pcount === x.pcount && info.pe0 === x.pe0);
const MX_PAGES = [1, 2, 3, 4, 5, 6].map((k) => ["MATRIX " + k, 0, [57 + 3 * k, 58 + 3 * k, 59 + 3 * k]]);
const P = { LEVEL: 0, SLEN: 29, CHORD: 49 };
const LAYOUT = (pe0) => [
{ t: "ENV", pages: [["ENV", 0, [1, 2, 3, 4]], ["ENV DEST", 0, [5, 6, 7, 8]], ...(pe0 >= 78 ? [["ENV 2", 0, [56, 57, 58, 59]]] : [])] },
{ t: "LFO", pages: [["LFO", 0, [9, 10, 11, 12]], ["LFO DEST", 0, [13, 14, 15, 16]], ...(pe0 >= 78 ? [["LFO 2", 0, [53, 54, 55]]] : [])] },
...(pe0 >= 78 ? [{ t: "LFO", title: "MATRIX", pages: MX_PAGES }] : []),
...(pe0 >= 89 ? [{ t: "LFO", title: "MOD SEQ", pages: [["MOD SEQ 2", 0, [83, 84, 85, 86]]] }] : []),
{ t: "EDIT", engine: true, pages: [["EDIT 1", 0, [pe0, pe0 + 1, pe0 + 2, pe0 + 3]], ["EDIT 2", 0, [pe0 + 4, pe0 + 5, pe0 + 6, pe0 + 7]]] },
{ t: "VOICE", pages: [["LEVEL", 0, [0]], ["VOICE", 0, [37, 38, 41, 42]], ["VOICE 2", 0, [43, 44, 39, 40]]] },
{ t: "FX", pages: [["FX", 0, [33, 34, 35, 36]], ["FILTER", 0, [50]], ...(pe0 >= 83 ? [["INSERT", 0, [78, 79, 80, 81]], ["INSERT 2", 0, [82]]] : []),
["SLICER", 0, [45, 46, 47, 48]], ["DLY", 1, [4, 5, 6, 7]], ["REV/CHO", 1, [8, 9, 10, 11]]] },
{ t: "SEL", pages: [["SEL", 0, [25, 26, 27, 49]], ["SEL 2", 0, [28, 51, 52]]] },
{ t: "ARP", pages: [["ARP", 0, [17, 18, 19, 20]], ["ARP 2", 0, [21, 22, 23, 24]]] },
{ t: "ARP", pages: [["ARP", 0, [17, 18, 19, 20]], ["ARP 2", 0, [21, 22, 23, 24]], ...(pe0 >= 89 ? [["SPICE", 0, [87, 88]]] : [])] },
{ t: "SEQ PATTERN", tab: "seqgroups", pages: [["PATTERN", 0, [29, 30, 31, 32]]] },
{ t: "GLOBAL", tab: "setgroups", pages: [["GLOBAL", 1, [0, 1, 2, 3]]] },
{ t: "MASTER", tab: "setgroups", pages: [["MASTER", 1, [27, 28, 29, 30]]] },
@@ -4870,6 +4931,7 @@ function updateBrowser() {
fm6Show();
hyShow();
fxShow();
msShow();
}
function visible(d) { return d && d.max > d.min && d.label !== "-"; }
@@ -5071,6 +5133,7 @@ async function afterSoundChange(msg = "ready") {
await fm6Follow(); /* FM6: the track's patch (a PTCH value may have loaded one) */
await hyFollow(); /* Clipper: the HYBRID patch, the same */
await fxFollow(); /* Clipper 0.6: the FMX patch, the same */
await msFollow(); /* Clipper 0.8: the MOD SEQ's steps, the same */
stLoaded(); /* (0.7: the sound as loaded: COMPARE's, the diff's) */
sayK(msg);
}
@@ -8494,6 +8557,82 @@ $("hyfile").addEventListener("change", async (e) => {
sayK("hyImported", ` ${hyv.name}`);
} catch (err) { sayK("hyBadFile", ` ${f.name}`); }
});
/* --------------------------------------------------------------- MOD SEQ --- */
/* Clipper 0.8: the MOD SEQ's steps of the selected part (firmware v13, EDITOR_PROTOCOL.md "MOD SEQ"), on every engine:
four lanes of 16 bars, dragged up and down (-8..7); a SHAPE fills the selected lane over the 16 steps. Its RATE, LEN,
SMTH, START are the sound's parameters (the LFO group's MOD SEQ 2). LIVE sends each change */
const MS_SHAPES = ["RAMP+", "RAMP-", "TRI", "SINE", "SQR", "RND", "FLAT", "INVRT", "SHIFT"];
let msv = new Array(64).fill(0), msLane = 0, msTimer = null, msPending = false;
const msOk = () => !!dev && !!dev.info && dev.info.proto >= 13;
const msTrack = () => (dev && dev.sel != null ? Math.min(dev.sel, 1) : 0);
function msShow() {
const on = msOk();
$("mspanel").hidden = !on;
if (on) renderMs();
if (on && msShow.dev !== dev) { msShow.dev = dev; op(msFollow); } /* (a device connected: its steps) */
}
function msChanged() {
if (!$("mslive").checked || !msOk()) return;
clearTimeout(msTimer);
msTimer = setTimeout(() => op(() => msSend(true)), 80);
}
function msShape(lane, k) { /* (firmware ui_synth.c mseq_fill, over 16 steps) */
const q = msv.slice(lane * 16, lane * 16 + 16), first = q[0];
for (let i = 0; i < 16; i++) {
let v = q[i];
switch (MS_SHAPES[k]) {
case "RAMP+": v = -8 + Math.floor(i * 15 / 15); break;
case "RAMP-": v = 7 - Math.floor(i * 15 / 15); break;
case "TRI": { const h = Math.floor((i * 30 + 8) / 16); v = (h <= 15 ? h : 30 - h) - 8; break; }
case "SINE": v = Math.round(Math.sin(2 * Math.PI * i / 16) * 7); break;
case "SQR": v = i < 8 ? 7 : -8; break;
case "RND": v = Math.floor(Math.random() * 16) - 8; break;
case "FLAT": v = 0; break;
case "INVRT": v = -v; break;
case "SHIFT": v = i + 1 < 16 ? q[i + 1] : first; break;
}
msv[lane * 16 + i] = Math.max(-8, Math.min(7, v));
}
}
function renderMs() {
const sh = $("msshape");
if (!sh.options.length) sh.replaceChildren(...MS_SHAPES.map((n, i) => el("option", { value: i, text: n })));
const rows = [0, 1, 2, 3].map((l) => {
const cells = Array.from({ length: 16 }, (_, i) => {
const v = msv[l * 16 + i], bar = el("div", { class: "msbar" });
bar.style.top = v >= 0 ? `${24 - v * 3}px` : "24px";
bar.style.height = `${Math.max(1, Math.abs(v) * 3)}px`;
const c = el("div", { class: "mscell", title: `SEQ${l + 1} step ${i + 1}: ${v}` }, bar);
const set = (e) => {
const r = c.getBoundingClientRect(), y = (e.clientY - r.top) / r.height;
const nv = Math.max(-8, Math.min(7, Math.round((0.5 - y) * 16)));
if (nv !== msv[l * 16 + i]) { msv[l * 16 + i] = nv; renderMs(); msChanged(); }
};
c.addEventListener("pointerdown", (e) => { c.setPointerCapture(e.pointerId); set(e); });
c.addEventListener("pointermove", (e) => { if (e.buttons) set(e); });
return c;
});
const lab = el("span", { class: "mslab", text: `SEQ${l + 1}`, onclick: () => { msLane = l; renderMs(); } });
return el("div", { class: "msrow" + (l === msLane ? " sel" : "") }, lab, ...cells);
});
$("msbody").replaceChildren(...rows);
}
async function msReadTrack(quiet) {
const r = parse[CMD.MSEQ_GET](await rq(req.mseqGet(msTrack())));
if (r.rc) { if (!quiet) checkRc(r.rc); return; }
msv = r.steps;
renderMs();
if (!quiet) sayK("hyRead", ` ${msTrack() + 1}`);
}
async function msSend(quiet) {
const r = parse[CMD.MSEQ_PUT](await rq(req.mseqPut(msTrack(), msv)));
checkRc(r.rc);
if (!quiet) sayK("hySent", ` ${msTrack() + 1}`);
}
async function msFollow() { if (msOk()) await msReadTrack(true); }
$("msread").addEventListener("click", () => op(() => msReadTrack(false)));
$("mssend").addEventListener("click", () => op(() => msSend(false)));
$("msapply").addEventListener("click", () => { msShape(msLane, +$("msshape").value); renderMs(); msChanged(); });
/* ------------------------------------------------------------------- FMX --- */
/* Clipper 0.6: the FMX engine's whole patch (firmware v12, EDITOR_PROTOCOL.md "FMX patches"), in the Sound tab while the
selected track plays FMX: the six operators (wave, PM / FM / RING, ratio or a fixed frequency, level, envelope,
+20 -7
View File
@@ -661,8 +661,19 @@ async function fmxPatch() {
const empty = E.parse[E.CMD.FMX_GET](await rq(E.req.fmxGet(2, 6)));
const st = E.parse[E.CMD.FMX_STORE](await rq(E.req.fmxStore(6, X.pack(kick))));
const back = E.parse[E.CMD.FMX_GET](await rq(E.req.fmxGet(2, 6)));
ok(info.proto === 12 && info.engines.includes("FMX") && !put.rc && eq(Array.from(got.bytes), fx.factory[0]) && empty.rc === 2 && !st.rc
ok(info.proto === 13 && info.engines.includes("FMX") && !put.rc && eq(Array.from(got.bytes), fx.factory[0]) && empty.rc === 2 && !st.rc
&& eq(Array.from(back.bytes), fx.factory[10]), "FMX: through the mock: PUT, GET back, an empty slot (rc 2), STORE, the slot read");
/* Clipper 0.8 (protocol 13): JUNO and VECTOR, the MOD SEQ's steps (editor_fmx.c ed_mseq_handle) */
const q = E.req.mseqPut(1, Array.from({ length: 64 }, (_, i) => (i % 16) - 8));
ok(q[0] === E.CMD.MSEQ_PUT && q[0] === 94 && q[1].length === 65 && q[1][0] === 1 && q[1][1] === 0 && q[1][16] === 15 && q[1].every((x) => x < 128),
"MOD SEQ: MSEQ_PUT is the part, then 64 steps + 8 (0..15)");
const g0 = E.parse[E.CMD.MSEQ_GET](await rq(E.req.mseqGet(0)));
const p1 = E.parse[E.CMD.MSEQ_PUT](await rq(q));
const g1 = E.parse[E.CMD.MSEQ_GET](await rq(E.req.mseqGet(1)));
const bad = E.parse[E.CMD.MSEQ_GET](await rq(E.req.mseqGet(5)));
ok(info.engines.includes("JUNO") && info.engines.includes("VECTOR") && !g0.rc && g0.steps.length === 64 && g0.steps[0] === -8 && g0.steps[15] === 7
&& !p1.rc && !g1.rc && g1.steps[16] === -8 && g1.steps[31] === 7 && bad.rc === 1,
"MOD SEQ through the mock: JUNO, VECTOR listed; the shapes to start from; PUT, GET back; a part out of range (rc 1)");
}
/* ------------------------------------- editor v5 (SLOOP 2.0): lanes, levels, ratchets --- */
@@ -681,12 +692,14 @@ async function editorV5() {
&& names.indexOf("ED_MICRO_GET") + 1 === C.MICRO_GET && names.indexOf("ED_MICRO_SET") + 1 === C.MICRO_SET
&& names.indexOf("ED_FILL_GET") + 1 === C.FILL_GET && names.indexOf("ED_FILL_SET") + 1 === C.FILL_SET
&& /ED_FM6_GET = 68, ED_FM6_PUT, ED_FM6_LIST, ED_FM6_ERASE/.test(ec) && C.FM6_GET === 68 && C.FM6_ERASE === 71
&& /#define ED_PROTO \(CLIPPER_SYNTH \? 12u : 11u\)/.test(ec) && /ed_b\(ED_PROTO\);/.test(ec)
&& /#define ED_PROTO \(CLIPPER_SYNTH \? 13u : 11u\)/.test(ec) && /ed_b\(ED_PROTO\);/.test(ec)
&& /enum \{ ED_FMX_GET = 90, ED_FMX_PUT, ED_FMX_STORE \};/.test(readFileSync(join(HERE, "../firmware/src/editor_fmx.c"), "utf8"))
&& C.FMX_GET === 90 && C.FMX_STORE === 92
&& /enum \{ ED_MSEQ_GET = 93, ED_MSEQ_PUT \};/.test(readFileSync(join(HERE, "../firmware/src/editor_fmx.c"), "utf8"))
&& C.MSEQ_GET === 93 && C.MSEQ_PUT === 94
&& /enum \{ ED_HY_GET = 77, ED_HY_PUT \};/.test(readFileSync(join(HERE, "../firmware/src/editor_hybrid.c"), "utf8")) && C.HY_GET === 77 && C.HY_PUT === 78
&& /enum \{ ED_DSYN_LIST = 72, ED_DSYN_GET, ED_DSYN_PUT, ED_DSYN_STORE, ED_DSYN_PLAY \};/.test(readFileSync(join(HERE, "../firmware/src/editor_dsyn.c"), "utf8"))
&& C.DSYN_LIST === 72 && C.DSYN_PLAY === 76, "v5..v11: command numbers and INFO == editor.c / editor_dsyn.c / editor_hybrid.c");
&& C.DSYN_LIST === 72 && C.DSYN_PLAY === 76, "v5..v13: command numbers and INFO == editor.c / editor_dsyn.c / editor_hybrid.c / editor_fmx.c");
const enumNames = (id) => (new RegExp(`${id}\\[\\] = \\{([^}]*)\\}`).exec(pc) || [])[1].split(",").map((x) => x.trim().replace(/"/g, ""));
const chord = E.parse[C.DESC](await rq(E.req.desc(0, 49)));
const gd = [];
@@ -772,10 +785,10 @@ async function editorV7() {
const sy = {}; let k = 0;
for (const nm of (/enum \{\s*\/\* per-track parameters \*\/([^}]*)\}/.exec(ch) || [])[1].replace(/#(if|endif)[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").split(",").map((x) => x.trim()).filter(Boolean)) sy[nm] = k++;
ok(sy.P_L2RATE === 53 && sy.P_E2ATK === 56 && sy.P_M1SRC === 60 && sy.P_M6AMT === 77 && sy.P_ITYPE === 78 && sy.P_IMIX === 82
&& sy.P_E0 === 83 && sy.P_COUNT === 91
&& E.lockable(sy.P_E0, 83) && E.lockable(sy.P_E7, 83) && !E.lockable(sy.P_L2RATE, 83) && !E.lockable(sy.P_M6AMT, 83)
&& !E.lockable(sy.P_ITYPE, 83) && !E.lockable(sy.P_IMIX, 83),
"v7: Clipper's layout (LFO 2 53, ENV 2 56, MATRIX 60, 0.6's INSERT 78, P_E0 83): its EDIT values lockable, the rest not");
&& sy.P_MSRATE === 83 && sy.P_MSKEY === 86 && sy.P_SPICE === 87 && sy.P_DICE === 88 && sy.P_E0 === 89 && sy.P_COUNT === 97
&& E.lockable(sy.P_E0, 89) && E.lockable(sy.P_E7, 89) && !E.lockable(sy.P_L2RATE, 89) && !E.lockable(sy.P_M6AMT, 89)
&& !E.lockable(sy.P_ITYPE, 89) && !E.lockable(sy.P_IMIX, 89) && !E.lockable(sy.P_MSRATE, 89) && !E.lockable(sy.P_DICE, 89),
"v7: Clipper's layout (LFO 2 53, ENV 2 56, MATRIX 60, INSERT 78, 0.8's MOD SEQ 83, SPICE 87, P_E0 89): its EDIT values lockable, the rest not");
}
{ /* (after SLOOP 2.6) SetGate: a value set again is sent once the last request is answered */
const g = new E.SetGate();