Clipper 1.0: SPREAD, a 12-slot matrix with LFO 3 and the macros, ENV 2 LOOP, HALL / SHIMMER, PING / TAPE

Sound
- SPREAD (VOICE 3): each voice its own place in the stereo field. The part renders
  its voices' sum (the mid, bit for bit as before at 0) and a side signal (each voice
  times its place x SPREAD, gliding through the block), on either core (vs_tmp per
  core, C1_IX). The side follows DIST / INSERT's level, goes through the track FILTER
  (its own state) and the duck; mix_part1 adds it left, takes it right. The pads and
  the unison sounds load with 48 (preset_extras), unless a preset sets SPREAD.
- The matrix: 12 slots (7..12 at P_M7SRC), new sources LFO 3 (its own page: RATE,
  WAVE, FREE / KEY) and MAC1..MAC4.
- ENV 2 LOOP: past its decay the attack again while the note is held.
- MACROS on every engine (EDIT > MACROS, CC 16..19 but on HYBRID): BRITE (cutoff),
  TIMBR (shape), MOTN (a vibrato, LFO 3 on the cutoff), SPACE (reverb, delay, SPREAD).
- Reverb TYPE HALL (the plate's tank: longer decay up to 0.9, a pre-delay, darker)
  and SHIMMER (an octave-up line fed back, kept under a loop gain of 1: decay and
  damping capped). A change between the room and the tank fades over 6 blocks; the
  pre-delay glides.
- The delay's MODE (G_DMODE, DLY 2): MONO, PING (left at TIME, right at 2 x TIME, the
  feedback from the right), TAPE (wow and flutter swing the tap, the feedback
  saturates); a change of MODE cross-fades (DL_XF).

Fixed
- The JUNO chorus wrapped round on a loud chord (x * g past 2^31): 64-bit products,
  the line at an eighth (no clipping). A test in synth10.

Storage
- User presets: the 1.0 values and the fifth bit of slots 1..6's sources in a tail
  after the bank payload (storage.c st_tail: programmed with the payload, outside its
  length and CRC; SLOOP / older Clipper never see it). The record SLOOP reads is
  unchanged.
- Projects: the 1.0 values of both sounds and G_DMODE in track 3's nudges while track
  3 has no steps (a mark and a check byte); otherwise their defaults.
- RAM: the undo history and the shimmer line in the pool (the RAM region was full).

Editor: EXPECT_10 (126 / 118, gcount 34), the new pages, the matrix's 12 slots,
synDesc for slots 7..12. Still protocol 14 (no new command); EDITOR_PROTOCOL.md.
Docs: README, DEMARRAGE-RAPIDE-FR, the installer page. Version CLIPPER 1.0.

Tests: synth10 (SPREAD, slots, LFO 3, ENV 2 LOOP, macros, CC, reverbs incl. the worst
case, PING / TAPE / MODE change, projects, user presets, pages, the JUNO fix) plain
and under ASan + UBSan; split_test with SPREAD and the macros (both cores, bit for
bit); clean_test 55 cases (SPREAD, the macros, the reverb TYPE, the delay MODE);
storage_test (the tail); the soak waits out HALL's tail.

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 19:51:53 -04:00
1 parent 4c1670d6a2
commit 7cf24e5a1c
29 files changed
+1443 -146

No files matched your search

+18 -5
View File
@@ -1,16 +1,16 @@
# Clipper — démarrage rapide (version de test 0.9)
# Clipper — démarrage rapide (version 1.0)
**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 32 sons d'usine. Il ajoute aussi le pitch bend, la molette, l'aftertouch et la pédale de sustain sur tous les moteurs.
> **C'est une version de test.** Avant d'installer, fais une **sauvegarde** dans l'éditeur (celui de Clipper ou de SLOOP, selon ce qui est installé) : Projects → Backup → *Save a backup*.
> **Version 1.0, testée sur ordinateur (toute la suite de tests), encore peu sur la FM-1.** Avant d'installer, fais une **sauvegarde** dans l'éditeur (celui de Clipper ou de SLOOP, selon ce qui est installé) : Projects → Backup → *Save a backup*.
## En bref
**23 moteurs, 409 sons**, tous au même niveau :
- **HYBRID** (3 oscillateurs, 2 filtres, matrice de 16 slots, 4 macros), **FMX** (6 opérateurs façon opsix, routage libre, PM / FM / RING), **FM6** (DX7, banques `.syx`), **DIGITAL** (FM 4 opérateurs), **WAVE** (tables d'ondes, et les tiennes), **WSEQ** (wave sequencing façon Wavestation), **VECTOR** (Prophet VS / joystick du Wavestation), **JUNO** (Juno-6 / 60 / 106 et son chorus I / II / I+II), **ANALOG** (analogique virtuel, 8 modèles de filtre), **ACID** (303), **STRINGS** (string machine), **MACRO** (façon Plaits), **PHASE** (façon CZ), **VPS** (vector phaseshaping), **TERRAIN** (wave terrain), **PHYS** (modèles physiques), **TRIO** (puce 8 bits), **LOFI** (chiptune), **WHEEL** (orgue à roues phoniques), **VOICE** (voyelles chantées), **NOISE**, **GRAIN** et **SAMPLE** (sur quatre sources synthétisées de Clipper, VOX, GLASS, PAD et AIR, ou sur tes propres samples).
- **Sculpter le son** (tous les moteurs) : une **matrice de modulation** de 6 slots, **LFO 2**, **ENV 2**, le **MOD SEQ** (séquenceur de modulation à 4 pistes), **8 modèles de filtre** sur ANALOG, WAVE et VECTOR (SVF, ladder Moog, MS-20, ladder à diodes, SEM, notch, passe-bande, passe-haut), **VINTAGE** (chaque voix dérive comme sur un vrai polyphonique analogique), un effet **INSERT** par son (SOFT, HARD, FOLD, FUZZ, CRUSH, PHASER, FLANGER, CHORUS et le chorus JUNO).
- **Effets** : distorsion, chorus stéréo, delay synchronisé, réverbs room et plate, filtre DJ, EQ 3 bandes, compresseur de bus et limiteur. Les réglages glissent au lieu de claquer.
- **Sculpter le son** (tous les moteurs) : une **matrice de modulation** de 12 slots, **LFO 2**, **LFO 3**, **ENV 2** (simple ou en boucle), quatre **MACROS** (BRITE, TIMBR, MOTN, SPACE, aussi en CC 16 à 19), **SPREAD** (chaque voix à sa place dans la stéréo), le **MOD SEQ** (séquenceur de modulation à 4 pistes), **8 modèles de filtre** sur ANALOG, WAVE et VECTOR (SVF, ladder Moog, MS-20, ladder à diodes, SEM, notch, passe-bande, passe-haut), **VINTAGE** (chaque voix dérive comme sur un vrai polyphonique analogique), un effet **INSERT** par son (SOFT, HARD, FOLD, FUZZ, CRUSH, PHASER, FLANGER, CHORUS et le chorus JUNO).
- **Effets** : distorsion, chorus stéréo, delay synchronisé (MONO, PING-PONG, TAPE), quatre réverbs (ROOM, PLATE, HALL, SHIMMER à l'octave), filtre DJ, EQ 3 bandes, compresseur de bus et limiteur. Les réglages glissent au lieu de claquer.
- **Accordage** : égal, juste, Pythagore, mésotonique, Werckmeister III, Kirnberger III, maqams Rast et Bayati, slendro, pelog, 19 / 24 / 31-EDO, et toute gamme **Scala `.scl`** envoyée depuis l'éditeur.
- **Jouer** : 8 voix (12 ou 16 en option, sur les deux cœurs), POLY, MONO, LEGATO, UNISON et unisson polyphonique, glide ; **LAYER**, **SPLIT** et **MULTI** (deux parties sur deux canaux MIDI) ; un **arpégiateur** à 15 modes, dont une **machine de Turing** (TURNG), et les variations **SPICE / DICE** ; le séquenceur de pas avec accords et enregistrement ; gammes et accords sur les touches, KBD HOLD ; **MPE** ; MIDI USB et TRS ; interface audio USB.
- **Travailler** : **UNDO** et **COMPARE** sur la FM-1, favoris, **MORPH** entre deux versions d'un son, **randomiseur** par section, presets utilisateur et projets qui gardent tout.
@@ -27,7 +27,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.9**.
Sur la FM-1, Clipper se reconnaît à son écran de démarrage et à HOME (maintenu) → SYS → ABOUT, qui affiche **CLIPPER 1.0**.
## 1. Compiler et installer
@@ -36,6 +36,19 @@ 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 1.0 : une voix stéréo, plus de modulation, quatre macros, un hall et un shimmer
- **SPREAD** (VOICE 3 → **SPRED**, tous les moteurs) : chaque voix a sa place entre gauche et droite (les voix extérieures d'abord, les suivantes entre elles) : un accord s'ouvre dans la stéréo, les voix de UNI2 / UNI4 s'écartent. Le centre ne change pas (gauche + droite = le son sans SPREAD, au bit près à 0). Les nappes et les sons en unisson en ont un peu d'origine (48).
- **La matrice a 12 slots** (MATRIX 1 à 12, sur la FM-1 et dans l'éditeur) et de nouvelles sources : **LFO 3** (page LFO 3 : RATE, WAVE, MODE FREE / KEY) et les quatre macros **MAC1 à MAC4**.
- **ENV 2 LOOP** (page ENV 2 LOOP) : ONE comme avant, ou **LOOP** : arrivée au bout de sa décroissance, elle repart en attaque tant que la note est tenue : une enveloppe qui cycle, un modulateur rythmique dans la matrice.
- **Quatre MACROS sur tous les moteurs** (EDIT → **MACROS** ; CC MIDI 16 à 19 ; HYBRID garde ses M1..M4) : **BRITE** (la coupure, ±2,5 octaves), **TIMBR** (la forme du moteur), **MOTN** (un vibrato et le LFO 3 sur la coupure : du mouvement), **SPACE** (plus de réverb, de delay et de SPREAD). Ce sont aussi des sources de la matrice.
- **HALL et SHIMMER** (REVERB → TYPE) : HALL, c'est la plaque devenue une grande salle de pierre (décroissance longue, pré-délai, aigus plus sombres) ; SHIMMER la nourrit à l'octave au-dessus, la traîne qui monte des disques d'ambient. Changer de TYPE fait disparaître l'ancienne traîne en fondu (pas de clic).
- **Le delay a un MODE** (DLY 2 → **MODE**) : **MONO** comme avant, **PING** (le premier écho à gauche à TIME, le suivant à droite à deux fois TIME, et ainsi de suite), **TAPE** (le pleurage et le scintillement font bouger les échos ; les répétitions saturent en s'empilant). Changer de MODE se fait en fondu.
- **Gardé avec le son** : les presets utilisateur gardent toutes les valeurs de la 1.0 dans une « queue » après la banque (SLOOP et les anciennes versions de Clipper lisent la banque comme avant et ne la voient pas) ; les projets les gardent dans les nudges de la piste 3 tant que la piste 3 n'a pas de pas (un projet dont la piste 3 a des pas les charge à leurs valeurs par défaut).
- **Corrigé** : le chorus du JUNO (CHOR I / II / I+II, et les types JUNO de l'INSERT) craquait sur un accord fort de beaucoup de voix (son calcul débordait au-delà de 16 bits ; maintenant en 64 bits, et la ligne garde un huitième du son au lieu d'un quart : plus d'écrêtage non plus).
- **Changé** : l'historique UNDO est sorti de la zone RAM de 96 Ko (les nouveaux buffers avaient besoin de la place).
- **L'éditeur web** : les nouvelles pages (VOICE 3, LFO 3, ENV 2 LOOP, MACROS, DLY 2) et les 12 slots de la matrice (toujours le protocole 14). Un fichier de son de la 0.9 se charge dans la 1.0, les nouvelles valeurs restant comme elles sont.
## Nouveau dans la 0.9 : modèles de filtre, VINTAGE, micro-accordage, une machine de Turing, un son propre
- **Modèles de filtre** (FILTER → **MODL**, sur ANALOG, WAVE et VECTOR ; HYBRID garde ses deux filtres) : **SVF** (12 dB, comme avant), **MOOG** (le ladder 24 dB), **MS20** (2 pôles avec l'écrêtage à diodes dans la réinjection : il hurle à forte résonance sans décrocher), **DIODE** (le ladder à diodes 4 pôles, famille TB-303 / EMS : caoutchouteux, perd moins de basses), **SEM** (le state variable 12 dB d'Oberheim, résonance douce), **NOTCH**, **BP** et **HP**. Changer de modèle sur une note tenue fait un petit creux puis revient (pas de clic).
+18 -5
View File
@@ -7,7 +7,7 @@ Free and open source (GPL-3.0). It grew out of <a href="https://github.com/isod8
---
> **Status: 0.9, test build.** Install it at your own risk, and keep a backup made with the editor. You can go back to the official V15 from the installer page, or to SLOOP with its own `INSTALL-SLOOP.bat`.
> **Status: 1.0.** Tested on the host (the test suite below), not yet by many on the device. Install it at your own risk, and keep a backup made with the editor. You can go back to the official V15 from the installer page, or to SLOOP with its own `INSTALL-SLOOP.bat`.
SLOOP is a groovebox. **Clipper is a synthesizer** with 23 engines and 409 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.
@@ -40,9 +40,9 @@ SLOOP is a groovebox. **Clipper is a synthesizer** with 23 engines and 409 sound
| **NOISE** | From analog hiss to metallic shift-register tones, through a resonant filter. |
| **GRAIN** / **SAMPLE** | Granular clouds and sampled instruments: on four sources of Clipper's own (VOX, a small choir opening "oo" to "ah"; GLASS, a glass harmonica; PAD, seven saws whose filter opens; AIR, breath on the note's harmonics), synthesized, not recorded, or on your own samples (four slots, sent from the editor). |
**Shaping the sound** (every engine): a six-slot **modulation matrix** (LFO 1 and 2, ENV 1 and 2, velocity, key, mod wheel, aftertouch, random, MPE slide, the **MOD SEQ**'s four lanes) onto pitch, cutoff, shape, amp, pan, LFO 2's rate and the engine's own eight values; **LFO 2**, **ENV 2**; the **MOD SEQ**, a four-lane modulation sequencer; **eight filter models** on ANALOG, WAVE and VECTOR (SVF, Moog ladder, MS-20, diode ladder, SEM, notch, band-pass, high-pass); **VINTAGE** (each voice drifts and differs, like an analog poly); an **INSERT** effect per sound (SOFT, HARD, FOLD, FUZZ, CRUSH, PHASER, FLANGER, CHORUS, and the JUNO chorus).
**Shaping the sound** (every engine): a twelve-slot **modulation matrix** (LFO 1, 2 and 3, ENV 1 and 2, velocity, key, mod wheel, aftertouch, random, MPE slide, the **MOD SEQ**'s four lanes, the four macros) onto pitch, cutoff, shape, amp, pan, LFO 2's rate and the engine's own eight values; **LFO 2**, **LFO 3**, **ENV 2** (one-shot or looping); four **MACROS** (BRITE, TIMBR, MOTN, SPACE) on CC 16 to 19; **SPREAD**, each voice its own place in the stereo field; the **MOD SEQ**, a four-lane modulation sequencer; **eight filter models** on ANALOG, WAVE and VECTOR (SVF, Moog ladder, MS-20, diode ladder, SEM, notch, band-pass, high-pass); **VINTAGE** (each voice drifts and differs, like an analog poly); an **INSERT** effect per sound (SOFT, HARD, FOLD, FUZZ, CRUSH, PHASER, FLANGER, CHORUS, and the JUNO chorus).
**Effects**: distortion, stereo chorus, tempo-synced delay, room and plate reverbs (after Dattorro), a DJ filter, a master three-band EQ, a bus compressor and a look-ahead limiter. Changes glide instead of clicking.
**Effects**: distortion, stereo chorus, a tempo-synced delay (MONO, PING-PONG, TAPE), four reverbs (ROOM, PLATE and HALL after Dattorro, SHIMMER an octave up), a DJ filter, a master three-band EQ, a bus compressor and a look-ahead limiter. Changes glide instead of clicking.
**Tuning**: equal, just, Pythagorean, meantone, Werckmeister III, Kirnberger III, the maqams Rast and Bayati, slendro, pelog, 19 / 24 / 31-EDO, and any **Scala `.scl`** scale from the editor.
@@ -52,6 +52,19 @@ SLOOP is a groovebox. **Clipper is a synthesizer** with 23 engines and 409 sound
**The web editor** (Chrome or Edge, nothing to install): every parameter live; the whole HYBRID and FMX patches; the MOD SEQ's lanes; the tuning and `.scl` files; DX7 banks; wavetables and samples; a sound library, undo / compare / A-B / randomize tools; backups of the whole FM-1.
## New in 1.0: a stereo voice, a deeper modulation, four macros, a hall and a shimmer
- **SPREAD** (VOICE 3 → **SPRED**, every engine): each voice gets its own place between left and right (the outer voices first, the next ones between), so a chord opens across the stereo field and the voices of UNI2 / UNI4 fan out. The middle stays what it was (left + right is the sound without SPREAD, bit for bit at 0), and the side goes through the same DIST / INSERT level and track FILTER. The pads and the unison sounds come with a little of it (48).
- **The matrix has 12 slots** (MATRIX 1 .. 12, on the FM-1 and in the editor), and new sources: **LFO 3** (LFO 3 page: RATE, WAVE, MODE FREE / KEY) and the four macros **MAC1 .. MAC4**.
- **ENV 2 LOOP** (ENV 2 LOOP page): ONE as before, or **LOOP**: past its decay it starts its attack again, as long as the note is held: an envelope that cycles, a rhythmic modulator in the matrix.
- **Four MACROS on every engine** (EDIT → **MACROS**; MIDI CC 16 .. 19; HYBRID keeps its own M1..M4): **BRITE** (the cutoff, ±2.5 octaves), **TIMBR** (the engine's shape), **MOTN** (a vibrato and LFO 3 on the cutoff: motion), **SPACE** (more reverb, delay and SPREAD). They are matrix sources too.
- **HALL and SHIMMER** (REVERB → TYPE): HALL is the plate's tank made a room of stone (a longer decay, a pre-delay, a darker top); SHIMMER feeds it an octave up, the pitched tail of the ambient records. A change of TYPE fades the old tail out (no click).
- **The delay has a MODE** (DLY 2 → **MODE**): **MONO** as before, **PING** (the first echo left at TIME, the next right at twice TIME, back and forth), **TAPE** (wow and flutter swing the echoes; the repeats saturate as they pile up). A change of MODE cross-fades.
- **Kept with the sound**: user presets keep every 1.0 value in a tail after the bank (SLOOP and older Clipper versions read the bank as before and never see it); projects keep them in track 3's nudges while track 3 has no steps (a project whose track 3 has steps loads them at their defaults).
- **Fixed**: the JUNO chorus (CHOR I / II / I+II, and the INSERT's JUNO types) cracked on a loud chord of many voices (its arithmetic wrapped round past 16 bits; now 64-bit products, and the line keeps an eighth of the sound instead of a quarter: no clipping either).
- **Changed**: the undo history moved out of the 96 KB RAM region (the new buffers needed the room).
- **The web editor**: the new pages (VOICE 3, LFO 3, ENV 2 LOOP, MACROS, DLY 2) and the matrix's 12 slots, with Clipper 1.0's layout (126 values, P_E0 118; still protocol 14). A 0.9 sound file loads into 1.0 with the new values left as they are.
## New in 0.9: filter models, VINTAGE, microtuning, a Turing machine, and a clean sound
- **Filter models** (FILTER → **MODL**, on ANALOG, WAVE and VECTOR; HYBRID keeps its own two filters): **SVF** (12 dB, as before), **MOOG** (the 24 dB ladder), **MS20** (2-pole Sallen-Key style with the diode clipping in the feedback: it screams at high RES and stays stable), **DIODE** (the 4-pole diode ladder of the TB-303 / EMS family: rubbery, less bass loss), **SEM** (Oberheim's 12 dB state variable, gentle resonance), **NOTCH**, **BP** and **HP**. Zero-delay-feedback models, integer DSP; each costs between 0.6 and 1.4 times the old filter. A model changed under a held note dips and comes back (no click).
@@ -180,7 +193,7 @@ A SLOOP project loads with only its first track playing. The four-track groovebo
## Playing it from a controller (new in Clipper, every engine)
Pitch bend (±2 semitones, or the HYBRID patch's own range up to ±24), mod wheel (CC 1), expression (CC 11), sustain pedal (CC 64), channel and polyphonic aftertouch, and the macros M1-M4 on CC 16-19. SLOOP's CC map (7, 10, 71-75, 91, 93, 94) still works.
Pitch bend (±2 semitones, or the HYBRID patch's own range up to ±24), mod wheel (CC 1), expression (CC 11), sustain pedal (CC 64), channel and polyphonic aftertouch, and the macros on CC 16-19 (HYBRID: M1-M4; every other engine: BRITE, TIMBR, MOTN, SPACE). SLOOP's CC map (7, 10, 71-75, 91, 93, 94) still works.
## Install and test
@@ -194,7 +207,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.9: the filter models, VINTAGE, the TUNING, TURNG, and the click test of 46 cases; 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.
`HOST_ONLY=1 tests/run_tests.sh` runs everything that does not need the JieLi toolchain (1.0: SPREAD, the 12 slots, LFO 3, ENV 2 LOOP, the macros, HALL / SHIMMER, PING / TAPE, the stores' tail, the voices on both cores with SPREAD, and the click test of 55 cases; 0.9: the filter models, VINTAGE, the TUNING, TURNG; 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
+2 -2
View File
@@ -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.9 ($Voices voices)" -ForegroundColor White
Write-Host " C L I P P E R 1.0 ($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.9 build/clipper-site
python web/make_site.py build/felucca.fwsc 1.0 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
+41 -3
View File
@@ -116,6 +116,17 @@ enum { /* per-track parameters */
P_VINT, /* Clipper 0.9: VINTAGE, each voice a little its own (voice.c vintage) */
P_SLOOP, /* .. LOOP: SPICE's variation comes round every LOOP notes; the arp's
* TURNG mode: its register's length (seq.c turing_step) */
P_SPREAD, /* Clipper 1.0: the voices across the stereo field (voice.c vspread) */
P_L3RATE, P_L3WAVE, P_L3MODE, /* .. LFO 3 (as LFO 2), a matrix source */
P_E2LOOP, /* .. ENV 2: ONE (an ADSR) / LOOP (attack and decay over and over) */
P_MAC1, P_MAC2, P_MAC3, P_MAC4, /* .. the sound's four macros: BRITE TIMBR (+-) MOTN SPACE (0..127), each
* a matrix source too (voice.c, fx.c) */
P_M7SRC, P_M7DST, P_M7AMT, /* .. the matrix's slots 7 to 12 (mx_pid) */
P_M8SRC, P_M8DST, P_M8AMT,
P_M9SRC, P_M9DST, P_M9AMT,
P_M10SRC, P_M10DST, P_M10AMT,
P_M11SRC, P_M11DST, P_M11AMT,
P_M12SRC, P_M12DST, P_M12AMT,
#endif
P_E0, P_E1, P_E2, P_E3, P_E4, P_E5, P_E6, P_E7,
P_COUNT
@@ -129,7 +140,8 @@ enum { FM_SVF = 1, FM_MOOG = 2, FM_MS20, FM_DIODE, FM_SEM, FM_NOTCH, FM_BP, FM_H
* TYPE (ROOM, PLATE: fx.c) and the plate's PRE-delay (ms) */
#define G_RTYPE G_DUCK
#define G_RPRE G_ROLL
enum { RT_ROOM, RT_PLATE };
enum { RT_ROOM, RT_PLATE, RT_HALL, RT_SHIMMER }; /* (1.0: HALL and SHIMMER: the plate's tank, fx.c) */
enum { DM_MONO, DM_PING, DM_TAPE }; /* (1.0) G_DMODE */
/* Clipper 0.3: the drum globals are the master bus (bus.c): EQ LOW / MID / HIGH, dB around their centre (so a SLOOP
* project, its drum level 100, reverb 16, channel 10, loads flat), and COMP (the drums' delay send: 0 = off) */
#define G_EQLOW G_DRLVL
@@ -154,9 +166,25 @@ enum { MD_OFF, MD_VIB, MD_CUT, MD_SHP, MD_WAH, MD_TREM };
#define P_LYCH P_SLEN /* Clipper 0.6, MULTI: the MIDI channel (1..16) the layer's sound answers on its own */
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
#define MX_SLOTS 12u /* (1.0: 12; slots 1..6 at P_M1SRC, 7..12 at P_M7SRC: mx_pid) */
#define MX_SLOTS6 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_SEQ1, MS_SEQ2, MS_SEQ3, MS_SEQ4, MS_NSRC }; /* (0.8: the MOD SEQ's four lanes; 4 bits in the stores) */
MS_SEQ1, MS_SEQ2, MS_SEQ3, MS_SEQ4, /* (0.8: the MOD SEQ's four lanes) */
MS_LFO3, MS_MAC1, MS_MAC2, MS_MAC3, MS_MAC4, MS_NSRC }; /* (1.0: LFO 3, the macros; 5 bits: the user presets'
* record keeps 4 of slots 1..6's, the fifth in the bank's tail) */
#if CLIPPER_SYNTH
/* a matrix slot's first parameter (its source; + 1 destination, + 2 amount) */
#define mx_pid(k) ((uint32_t)((k) < MX_SLOTS6 ? P_M1SRC + 3u * (k) : P_M7SRC + 3u * ((k) - MX_SLOTS6)))
/* the matrix slot (0..11) of a parameter, -1: none; *f its field (0 source, 1 destination, 2 amount) */
static inline int mx_slot_of(uint32_t i, uint32_t *f)
{
if (i >= P_M1SRC && i <= P_M6AMT)
return *f = (i - P_M1SRC) % 3u, (int)((i - P_M1SRC) / 3u);
if (i >= P_M7SRC && i <= P_M12AMT)
return *f = (i - P_M7SRC) % 3u, (int)(MX_SLOTS6 + (i - P_M7SRC) / 3u);
return -1;
}
#endif
#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 };
@@ -180,6 +208,10 @@ enum { /* global parameters */
G_ROLL, /* note repeat rate (ARP + key, seq.c) */
G_NEWPRJ, /* TOOLS > NEW: a new project (GO) */
G_DRDLY, /* SLOOP 2.5: the drums' delay send (GLO > DRUMS; a project keeps it in its own byte) */
#if CLIPPER_SYNTH
G_DMODE, /* Clipper 1.0: the delay MONO / PING (ping-pong) / TAPE (wow, flutter, saturation)
* (a project keeps it with 1.0's values, project.c) */
#endif
G_COUNT
};
@@ -205,6 +237,8 @@ typedef struct {
int32_t env2; /* ENV 2, Q24 */
int16_t rnd, l2rnd; /* a random value per note; LFO 2's S&H value */
uint8_t e2st; /* ENV 2: 0 off, 1 attack, 2 decay / sustain, 3 release */
uint32_t l3ph; /* (1.0) LFO 3 in KEY mode */
int16_t l3rnd; /* .. its S&H value */
int16_t vdrift, vdtgt; /* (0.9) VINTAGE: the voice's slow pitch drift now, and where it goes (Q15) */
uint8_t ch; /* the MIDI channel its note came on (MPE: its own bend, pressure, slide) */
#endif
@@ -411,6 +445,10 @@ typedef struct track {
uint32_t l2ph; /* Clipper 0.4: LFO 2 in FREE mode (one for the part) */
int16_t l2rnd; /* its S&H value */
int16_t panmod; /* the matrix's PAN, from the part's sources (fx.c mix_part) */
uint32_t l3ph; /* (1.0) LFO 3 in FREE mode */
int16_t l3rnd;
int16_t spr; /* (1.0) SPREAD as the last block had it (a change glides through the block) */
int32_t sd_g; /* (1.0) the side's gain after DIST / the INSERT (Q15, 0: none yet) */
uint8_t ins_run; /* Clipper 0.6: the INSERT ran (or faded out) in the last block (fx.c track_insert) */
uint8_t ins_xt; /* .. blocks it ran on after the last voice (its tail: a flanger's feedback) */
uint16_t ins_res; /* .. |its last sample| (a tail still ringing) */
+5
View File
@@ -18,7 +18,12 @@ static inline int32_t soft_knee(int32_t y, int32_t k) /* linear up to k, then
/* 0.7: the second core renders some of a part's voices (voice.c track_render) into vs_buf while this core renders the
* others: an engine's scratch that is not on the stack is one per core, picked by C1_IX(out) (1: the second core's) */
static int32_t vs_buf[CTL] __attribute__((aligned(8)));
#if CLIPPER_SYNTH /* (1.0) SPREAD: a voice alone into a scratch first (voice.c vrender), one a core */
static int32_t vs_tmp[2][CTL] __attribute__((aligned(8)));
#define C1_IX(out) ((out) == vs_buf || (out) == vs_tmp[1] ? 1u : 0u)
#else
#define C1_IX(out) ((out) == vs_buf ? 1u : 0u)
#endif
/* (0.9) the filter MODEL the engines with a low-pass of their own play (dsp.c fmod_*): P_FMODEL after the short duck
* a change of it brings (fx.c mix_part1: no click), SVF in the groovebox */
static inline int32_t fm_model(const track_t *t)
+232 -47
View File
@@ -30,6 +30,11 @@ static struct {
uint32_t dl_cur, dl_old; /* (0.9) the delay's TIME now and the one it fades from (DL_XF samples) */
uint32_t dl_x; /* .. samples into that fade (DL_XF: none) */
int32_t cdep; /* (0.9) the chorus's DEPTH now (glides: a jump moved its taps at once) */
#if CLIPPER_SYNTH
uint32_t dm_cur, dm_old, dm_x; /* (1.0) the delay's MODE now, the one it fades from, samples into that fade */
uint32_t tw_ph, tf_ph; /* (1.0) TAPE: the wow's and the flutter's phases */
int32_t tp0, tpd; /* .. the swing of the tap (Q8 samples, more delay) at the block's start, a step */
#endif
} fx;
#define DL_XF 1024u /* a new delay TIME: the old tap fades out as the new one fades in, 23 ms (a jump
* of the read point was a crack) */
@@ -289,13 +294,38 @@ static inline int32_t pl_mod_ap(uint32_t k, int32_t x, int32_t c, int32_t pos)
pl_put(k, v);
return d + mulq15(v, c);
}
/* one tank step (22.05 kHz) on x: the left and right outputs */
static void plate_step(int32_t x, int32_t decay, int32_t damp, uint32_t pre, int32_t *yl, int32_t *yr)
/* (1.0) SHIMMER: the tank's output an octave up, back into its input (the Eno / Lanois shimmer): a delay line read
* twice as fast as it is written by two taps half a window apart, each faded in and out (a triangle), at 22.05 kHz */
#define PS_LEN 1024u /* 46 ms */
#define PS_WIN 896u /* the window the taps sweep, samples */
static int16_t ps_buf[PS_LEN] __attribute__((section(".pool")));
static struct { uint32_t w, ph; int32_t lp; } ps;
static int32_t shimmer_step(int32_t in)
{
uint32_t k;
int32_t y = 0;
ps_buf[ps.w & (PS_LEN - 1u)] = (int16_t)clamp(in, -32768, 32767);
for (k = 0; k < 2u; k++) { /* delay = WIN - phase: it shrinks one a step (twice the speed) */
uint32_t ph = (ps.ph + k * (PS_WIN / 2u)) % PS_WIN, d = PS_WIN - ph + 2u;
int32_t g = ph < PS_WIN / 2u ? (int32_t)(ph * 65536u / PS_WIN) : (int32_t)((PS_WIN - ph) * 65536u / PS_WIN);
y += (ps_buf[(ps.w - d) & (PS_LEN - 1u)] * g) >> 15; /* (the two triangles sum to 1) */
}
ps.w++;
ps.ph = (ps.ph + 1u) % PS_WIN;
ps.lp += mulq15(y - ps.lp, 16000); /* (a little softer: the octave of a bright tail is harsh) */
return ps.lp;
}
/* one tank step (22.05 kHz) on x: the left and right outputs. (1.0) bw: the input's bandwidth (HALL darker), shim:
* the octave-up share of the tail fed back in (SHIMMER), Q15 */
static void plate_step(int32_t x, int32_t decay, int32_t damp, uint32_t pre, int32_t bw, int32_t shim, int32_t *yl,
int32_t *yr)
{
int32_t a, b, ma, mb;
pl_put(PL_PRE, x);
x = pre ? pl_tap(PL_PRE, pre) : x;
pl.bw += mulq15(x - pl.bw, 26000); /* bandwidth (~6 kHz at 22.05) */
if (shim)
x += mulq15(shimmer_step((pl.end[0] + pl.end[1]) >> 1), shim);
pl.bw += mulq15(x - pl.bw, bw); /* bandwidth (~6 kHz at 22.05; HALL ~3.5 kHz) */
x = pl_ap(PL_AP1, pl.bw, 24576); /* 0.75 */
x = pl_ap(PL_AP2, x, 24576);
x = pl_ap(PL_AP3, x, 20480); /* 0.625 */
@@ -322,34 +352,86 @@ static void plate_step(int32_t x, int32_t decay, int32_t damp, uint32_t pre, int
*yr = pl_tap(PL_DB1, 262) + pl_tap(PL_DB1, 2687) - pl_tap(PL_AB, 910) + pl_tap(PL_DB2, 1980) -
pl_tap(PL_DA1, 1564) - pl_tap(PL_AA, 248) - pl_tap(PL_DA2, 90);
}
#ifndef SH_DECAY
#define SH_DECAY 27000
#define SH_DAMP 28000
#define SH_GAIN 8192
#endif
/* the plate over a block: rev_in (the reverb sends) -> + wet_l, wet_r */
static void plate_run(const int32_t *rev_in, int32_t *wet_l, int32_t *wet_r, uint32_t n)
static void plate_run(const int32_t *rev_in, int32_t *wet_l, int32_t *wet_r, uint32_t n, int32_t rg0, int32_t rg1)
{
int32_t decay = 6554 + song.g[G_RSIZE] * 155; /* 0.2 .. 0.8: RT60 ~0.8 .. 5 s (twice a half) */
int32_t rt = song.g[G_RTYPE], hall = rt >= RT_HALL;
int32_t decay = hall ? 16384 + song.g[G_RSIZE] * 104 /* (1.0) HALL: 0.5 .. 0.9, RT60 ~2 .. 10 s */
: 6554 + song.g[G_RSIZE] * 155; /* 0.2 .. 0.8: RT60 ~0.8 .. 5 s (twice a half) */
int32_t damp = 32767 - song.g[G_RDAMP] * 193; /* the damping low-pass: open .. 0.25 */
uint32_t pre = (uint32_t)clamp(song.g[G_RPRE], 0, 100) * 2205u / 100u; /* ms -> 22.05 kHz samples */
if (rt == RT_SHIMMER) { /* (the octave line feeds the tank: kept under a loop gain
* of 1, the top always damped a little) */
decay = decay > SH_DECAY ? SH_DECAY : decay;
damp = damp > SH_DAMP ? SH_DAMP : damp;
}
uint32_t pre = (uint32_t)clamp(song.g[G_RPRE] + (hall ? 18 : 0), 0, 100) * 2205u / 100u; /* ms -> 22.05 kHz
* samples (HALL: 18 ms more, a big room's) */
int32_t bw = hall ? 18000 : 26000, shim = rt == RT_SHIMMER ? SH_GAIN : 0; /* (SHIMMER: some of the tail an octave up) */
uint32_t i;
static uint32_t pre_cur; /* (1.0) the pre-delay glides (a jump: a step in) */
if (!pl.ready)
plate_clear();
plate_clear(), pre_cur = pre;
for (i = 0; i < n; i++) {
int32_t x = mulq15(rev_in[i], 13000); /* (as the room's input) */
int32_t x = mulq15(rev_in[i], 13000), wl, wr; /* (as the room's input) */
int32_t g = rg0 + (((rg1 - rg0) * (int32_t)i) >> CTL_LOG2);
if (!pl.half) {
pl.acc = x;
wet_l[i] += (pl.y0l + pl.y1l) >> 1; /* between the last two steps */
wet_r[i] += (pl.y0r + pl.y1r) >> 1;
wl = (pl.y0l + pl.y1l) >> 1; /* between the last two steps */
wr = (pl.y0r + pl.y1r) >> 1;
} else {
int32_t yl, yr;
plate_step((pl.acc + x) >> 1, decay, damp, pre, &yl, &yr);
pre_cur += pre_cur < pre ? 1u : pre_cur > pre ? (uint32_t)-1 : 0u;
plate_step((pl.acc + x) >> 1, decay, damp, pre_cur, bw, shim, &yl, &yr);
pl.y0l = pl.y1l, pl.y0r = pl.y1r;
pl.y1l = (yl * 19661) >> 14, pl.y1r = (yr * 19661) >> 14; /* x 1.2: the paper's 0.6, as loud as ROOM */
wet_l[i] += pl.y0l;
wet_r[i] += pl.y0r;
wl = pl.y0l, wr = pl.y0r;
}
if (g != 32767)
wl = mulq15(wl, g), wr = mulq15(wr, g);
wet_l[i] += wl;
wet_r[i] += wr;
pl.half ^= 1u;
}
}
#endif
#if CLIPPER_SYNTH
/* (1.0) the half-rate line read q (Q8) samples back: entry e ~ sample 2e, linear between entries */
static inline int32_t dly_rd(uint32_t q)
{
uint32_t s = (fx.dly_w << 8) - q, e = s >> 9, fr = (s >> 1) & 255u;
int32_t a = dly_buf[e & (DLY_LEN - 1u)], b = dly_buf[(e + 1u) & (DLY_LEN - 1u)];
return a + (((b - a) * (int32_t)fr) >> 8);
}
/* (1.0) the taps of a MODE at a TIME d, sample i of the block: left, right, and the one fed back */
static inline void dly_taps(uint32_t m, uint32_t d, uint32_t i, int32_t *l, int32_t *r, int32_t *f)
{
if (m == DM_PING) {
uint32_t d2 = 2u * d;
if (d2 > DLY_SPAN - 4u)
d2 = DLY_SPAN - 4u;
*l = dly_rd(d << 8);
*r = *f = dly_rd(d2 << 8);
} else if (m == DM_TAPE) {
uint32_t q = (d << 8) + (uint32_t)(fx.tp0 + fx.tpd * (int32_t)i);
if (q > ((DLY_SPAN - 4u) << 8))
q = (DLY_SPAN - 4u) << 8;
*l = *r = *f = dly_rd(q);
} else {
uint32_t p = fx.dly_w - d, e = p >> 1;
int32_t a = dly_buf[e & (DLY_LEN - 1u)];
*l = *r = *f = (p & 1u) ? (a + dly_buf[(e + 1u) & (DLY_LEN - 1u)]) >> 1 : a;
}
}
#define TW_INC 1558299u /* (a block's turn: 0.5 Hz, the wow) */
#define TF_INC 20257887u /* (6.5 Hz, the flutter) */
#endif
/* process the three buses for one block; sends in, wet out (stereo). The LFOs (chorus, reverb line)
* are computed per block and ramped: no sine per sample */
static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t *rev_in, int32_t *wet_l,
@@ -361,19 +443,38 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
int32_t g = 17000 + song.g[G_RSIZE] * 104, lpk = 32767 - song.g[G_RDAMP] * 200; /* loop gain (RT60 ~0.4..4 s), damping */
int32_t cdepth = song.g[G_CDEPTH] * 6, cdep0;
int32_t ca0, ca1, cb0, cb1, ma, mb, dca, dcb;
int plate = CLIPPER_SYNTH && song.g[G_RTYPE] == RT_PLATE; /* Clipper: the plate instead of the room */
int plate = CLIPPER_SYNTH && song.g[G_RTYPE] >= RT_PLATE; /* Clipper: the plate (1.0: HALL, SHIMMER: its tank)
* instead of the room */
const uint32_t L0 = REV_LINE[0] + REV_MOD + 2u, B1 = L0, B2 = B1 + REV_LINE[1], B3 = B2 + REV_LINE[2];
int32_t rg0 = 32767, rg1 = 32767; /* (1.0) the reverb's share over the block (a change of type) */
#if CLIPPER_SYNTH
{ /* a change of type: the other one starts from silence (no old tail bursting out of its lines) */
static int was_plate = -1;
if (plate != was_plate) {
if (plate)
pl.ready = 0;
else
for (k = 0; k < NELEM(rev_line); k++)
rev_line[k] = 0;
was_plate = plate;
{ /* a change between the room and the plate's tank (PLATE, HALL, SHIMMER share it: they change on the fly): the
* old one fades out over 6 blocks (1.0: it was cut, a click on a ringing tail), then the other starts from
* silence (no old tail bursting out of its lines) */
static int fam_used = -1, was_shim;
static uint8_t rv_fade;
int shim = song.g[G_RTYPE] == RT_SHIMMER;
if (fam_used < 0)
fam_used = plate;
if (plate != fam_used) {
if (!rv_fade)
rv_fade = 6;
rg0 = rv_fade * 5461, rg1 = (rv_fade - 1) * 5461; /* (32767 / 6) */
plate = fam_used; /* (this block: the old one) */
if (!--rv_fade) {
if (fam_used)
for (k = 0; k < NELEM(rev_line); k++)
rev_line[k] = 0;
else
pl.ready = 0;
fam_used = !fam_used;
}
}
if (shim && !was_shim) { /* (the octave line from silence) */
memset(ps_buf, 0, sizeof ps_buf);
ps.lp = 0;
}
was_shim = shim;
}
#endif
if (!fx.dl_cur)
@@ -381,6 +482,20 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
if (dl != fx.dl_cur && fx.dl_x >= DL_XF) /* (0.9) a new TIME: the fade starts (one at a time) */
fx.dl_old = fx.dl_cur, fx.dl_cur = dl, fx.dl_x = 0;
dl = fx.dl_cur, dlo = fx.dl_old;
#if CLIPPER_SYNTH
{ /* (1.0) a new MODE: the fade starts (one at a time); TAPE's swing at both ends of the block */
uint32_t dm = song.g[G_DMODE] <= DM_TAPE ? song.g[G_DMODE] : DM_MONO;
int32_t dw = (int32_t)((dl * 197u) >> 8) + 1536, t1; /* (wow: 0.3 % of TIME + 6 samples; flutter: 2) */
if (fx.dm_x == 0 && fx.dm_old == fx.dm_cur)
fx.dm_x = DL_XF; /* (from the start: nothing to fade) */
if (dm != fx.dm_cur && fx.dm_x >= DL_XF)
fx.dm_old = fx.dm_cur, fx.dm_cur = dm, fx.dm_x = 0;
fx.tp0 = dw + 512 + ((dw * osc_sine(fx.tw_ph)) >> 15) + ((512 * osc_sine(fx.tf_ph)) >> 15);
fx.tw_ph += TW_INC, fx.tf_ph += TF_INC;
t1 = dw + 512 + ((dw * osc_sine(fx.tw_ph)) >> 15) + ((512 * osc_sine(fx.tf_ph)) >> 15);
fx.tpd = (t1 - fx.tp0) >> CTL_LOG2;
}
#endif
cdep0 = fx.cdep; /* (0.9) DEPTH glides: ~60 ms over its range */
fx.cdep += clamp(cdepth - fx.cdep, -10, 10);
{ /* the chorus' two read points (Q8 samples back) and line 0's extra length, at both ends of the block */
@@ -395,7 +510,10 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
dca = (ca1 - ca0) >> CTL_LOG2, dcb = (cb1 - cb0) >> CTL_LOG2;
}
for (i = 0; i < n; i++) {
int32_t yl, yr, x, a, o0, o1, o2, o3;
int32_t yl, yr, a, o0, o1, o2, o3;
#if !CLIPPER_SYNTH
int32_t x;
#endif
/* chorus: two modulated short delays, 5..15 ms, the LFO half a turn apart: left and right move apart */
cho_buf[fx.cho_w & (CHO_LEN - 1u)] = (int16_t)clamp(cho_in[i] >> 1, -32768, 32767);
{
@@ -409,24 +527,38 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
fx.cho_w++;
/* delay with a low-passed feedback (in the middle) */
#if CLIPPER_SYNTH
{ /* half rate: an entry is the mean of two samples (entry e ~ sample 2e); an odd position reads between
* two entries */
uint32_t p = fx.dly_w - dl, e = p >> 1;
int32_t a = dly_buf[e & (DLY_LEN - 1u)], v;
x = (p & 1u) ? (a + dly_buf[(e + 1u) & (DLY_LEN - 1u)]) >> 1 : a;
if (fx.dl_x < DL_XF) { /* (0.9) the old TIME's tap fading out */
int32_t xo;
p = fx.dly_w - dlo, e = p >> 1, a = dly_buf[e & (DLY_LEN - 1u)];
xo = (p & 1u) ? (a + dly_buf[(e + 1u) & (DLY_LEN - 1u)]) >> 1 : a;
x = xo + (((x - xo) * (int32_t)fx.dl_x) >> 10);
{ /* half rate: an entry is the mean of two samples (entry e ~ sample 2e); a position between two entries
* reads between them. (1.0) MONO: one tap in the middle; PING: the echoes left (TIME) and right (2 x
* TIME), the feedback from the right; TAPE: the tap swung by wow and flutter, the feedback saturating.
* A change of MODE: the old one's taps fade out as the new one's fade in (DL_XF) */
int32_t xl, xr, xf, v, ol, or_, of;
uint32_t m = fx.dm_cur;
dly_taps(m, dl, i, &xl, &xr, &xf);
if (fx.dl_x < DL_XF) { /* (0.9) the old TIME's taps fading out */
dly_taps(m, dlo, i, &ol, &or_, &of);
xl = ol + (((xl - ol) * (int32_t)fx.dl_x) >> 10);
xr = or_ + (((xr - or_) * (int32_t)fx.dl_x) >> 10);
xf = of + (((xf - of) * (int32_t)fx.dl_x) >> 10);
fx.dl_x++;
}
fx.dly_lp += mulq15(x - fx.dly_lp, col);
if (fx.dm_x < DL_XF) { /* (1.0) the old MODE's taps fading out */
dly_taps(fx.dm_old, dl, i, &ol, &or_, &of);
xl = ol + (((xl - ol) * (int32_t)fx.dm_x) >> 10);
xr = or_ + (((xr - or_) * (int32_t)fx.dm_x) >> 10);
xf = of + (((xf - of) * (int32_t)fx.dm_x) >> 10);
fx.dm_x++;
}
fx.dly_lp += mulq15(xf - fx.dly_lp, col);
v = (dly_in[i] >> 1) + mulq15(fx.dly_lp, fb);
if (m == DM_TAPE)
v = softclip(v); /* (a tape's: the repeats round off as they pile up) */
if (fx.dly_w & 1u)
dly_buf[(fx.dly_w >> 1) & (DLY_LEN - 1u)] = (int16_t)clamp((fx.dly_acc + v) >> 1, -32768, 32767);
else
fx.dly_acc = v;
fx.dly_w++;
yl += mulq15(xl << 1, dmix);
yr += mulq15(xr << 1, dmix);
}
#else
x = dly_buf[(fx.dly_w - dl) & (DLY_LEN - 1u)];
@@ -438,11 +570,11 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
fx.dly_lp += mulq15(x - fx.dly_lp, col);
dly_buf[fx.dly_w & (DLY_LEN - 1u)] =
(int16_t)clamp((dly_in[i] >> 1) + mulq15(fx.dly_lp, fb), -32768, 32767);
#endif
fx.dly_w++;
x = mulq15(x << 1, dmix);
yl += x;
yr += x;
#endif
/* reverb: two diffusers, then the four lines (Clipper: or the plate, after the loop) */
if (plate) {
wet_l[i] = yl;
@@ -486,12 +618,16 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
if (++fx.line_i[2] >= REV_LINE[2]) fx.line_i[2] = 0;
if (++fx.line_i[3] >= REV_LINE[3]) fx.line_i[3] = 0;
}
if (rg0 != 32767 || rg1 != 32767) { /* (1.0) fading out (a change of type) */
int32_t g = rg0 + (((rg1 - rg0) * (int32_t)i) >> CTL_LOG2);
o0 = mulq15(o0, g), o1 = mulq15(o1, g), o2 = mulq15(o2, g), o3 = mulq15(o3, g);
}
wet_l[i] = yl + o0 + o2;
wet_r[i] = yr + o1 - o3;
}
#if CLIPPER_SYNTH
if (plate)
plate_run(rev_in, wet_l, wet_r, n);
plate_run(rev_in, wet_l, wet_r, n, rg0, rg1);
#endif
}
@@ -925,19 +1061,20 @@ static __attribute__((noinline)) int juno_chorus(track_t *t, int32_t *b, uint32_
l1 += ((v1 - l1) * k) >> 15; /* the BBD's dark */
l2 += ((v2 - l2) * k) >> 15;
{
int32_t in = clamp(x >> 2, -32767, 32767);
int32_t in = clamp(x >> 3, -32767, 32767); /* (1.0: an eighth, was a quarter: 8 loud voices clipped) */
if (hiss) {
c->nz = c->nz * 1664525u + 1013904223u;
in += (((int32_t)(c->nz >> 16) - 32768) * hiss) >> 15;
in += (((int32_t)(c->nz >> 16) - 32768) * hiss) >> 16;
}
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);
/* (1.0: 64-bit products: a loud chord's x passes 2^16, and x * g wrapped round: a crack at a chord change) */
md = x + (int32_t)(((int64_t)((l1 + l2) << 2) * w) >> 15); /* dry + (tap 1 + tap 2) / 2 (the taps at an eighth) */
sd = (int32_t)(((int64_t)(((int64_t)((l1 - l2) << 2) * w) >> 15) * width) >> 15); /* (tap 1 - tap 2) / 2 */
b[i] = (int32_t)(((int64_t)md * g) >> 15);
jc_side[i] = (int32_t)(((int64_t)sd * g) >> 15);
}
c->w = w, c->ph = ph, c->wp = (uint16_t)wp, c->l1 = l1, c->l2 = l2;
if (!w && c->mode != m)
@@ -987,7 +1124,7 @@ static void part_apply(track_t *t, int32_t fmw)
else
wt_tab_eff[k] = 0;
}
static void part_duck(track_t *t, int32_t *b, uint32_t n, int32_t fmw)
static void part_duck(track_t *t, int32_t *b, int32_t *b2, uint32_t n, int32_t fmw) /* (1.0: b2, SPREAD's side, too) */
{
uint32_t k;
if (t->dk_phase == 2u) { /* held silent until the change has landed (50 ms at most) */
@@ -995,6 +1132,9 @@ static void part_duck(track_t *t, int32_t *b, uint32_t n, int32_t fmw)
int ready = !part_pending(t, fmw) && (ENGINES[t->engine % NENGINES] != &ENG_WAVE || wt_have == wt_tab_eff[p] - 1);
for (k = 0; k < n; k++)
b[k] = 0;
if (b2)
for (k = 0; k < n; k++)
b2[k] = 0;
if (ready || ++t->dk_hold > 68u)
t->dk_phase = 3, t->dk_pos = 0, t->dk_hold = 0;
return;
@@ -1003,11 +1143,16 @@ static void part_duck(track_t *t, int32_t *b, uint32_t n, int32_t fmw)
int32_t x = t->dk_phase == 1u ? 32768 - t->dk_pos * 256 : t->dk_pos * 256, x2 = (x * x) >> 15;
int32_t g = 3 * x2 - 2 * ((x2 * x) >> 15); /* smoothstep, Q15 */
if (t->dk_pos >= 128u) {
if (t->dk_phase == 1u)
if (t->dk_phase == 1u) {
b[k] = 0;
if (b2)
b2[k] = 0;
}
continue;
}
b[k] = (int32_t)(((int64_t)b[k] * g) >> 15);
if (b2)
b2[k] = (int32_t)(((int64_t)b2[k] * g) >> 15);
t->dk_pos++;
}
if (t->dk_pos >= 128u) {
@@ -1065,7 +1210,7 @@ static void mix_part1(track_t *t, uint32_t n)
#endif
#if CLIPPER_SYNTH
if (t->dk_phase)
part_duck(t, b, n, fmw);
part_duck(t, b, part_side_on ? part_side : 0, n, fmw);
#endif
if (!g0 && !g1) { /* silent (MUTE / SOLO): the voices run, nothing is heard */
slicer_track(t, 0, n);
@@ -1078,6 +1223,14 @@ static void mix_part1(track_t *t, uint32_t n)
#endif
int32_t gl = 4096 - (pan > 0 ? pan * 64 : 0), gr = 4096 + (pan < 0 ? pan * 64 : 0);
int32_t c = t->p[P_CHOR] * 258, d = t->p[P_DLY] * 258, r = t->p[P_REV] * 258, pk = t->peak;
#if CLIPPER_SYNTH
int32_t sa = 0; /* (1.0) |the part| before DIST and the INSERT (SPREAD's side
* follows their level: they run on the mid) */
{ /* (1.0) SPACE: more reverb and delay */
int32_t sp = clamp(t->p[P_MAC4], 0, 127);
r = clamp(t->p[P_REV] + sp, 0, 127) * 258, d = clamp(t->p[P_DLY] + sp / 2, 0, 127) * 258;
}
#endif
int32_t xmax, c0, d0, r0, dsc, dsd, dsr;
int32_t ga = mulq15(g0, duck.g0), gb = mulq15(g1, duck.g1); /* mute x duck, ramped over the block */
if (!t->mix_on || fresh) /* (0.9) the sends glide as LEVEL does (a jump: a crack in the
@@ -1090,6 +1243,11 @@ static void mix_part1(track_t *t, uint32_t n)
xmax = xmax > r0 ? xmax : r0;
xmax = xmax > c ? xmax : c, xmax = xmax > d ? xmax : d, xmax = xmax > r ? xmax : r;
xmax = 0x7FFFFFFF / (xmax | 1); /* sends: loud chords at a high LEVEL */
#if CLIPPER_SYNTH
if (part_side_on && (t->p[P_DIST] | t->dist_w | t->p[P_ITYPE] | t->ins_run))
for (i = 0; i < n; i++)
sa += b[i] < 0 ? -(b[i] >> 6) : b[i] >> 6;
#endif
track_dist(t, b, n, fresh);
#if CLIPPER_SYNTH
if (t->p[P_ITYPE] | t->ins_run) {
@@ -1102,11 +1260,38 @@ static void mix_part1(track_t *t, uint32_t n)
{
tsvf_t fc; /* the track's FILTER (P_TFLT), after the SLICER */
djf_t *f = &tflt[(uint32_t)(t - trk) % NTRK];
if (djf_block(f, t->p[P_TFLT], &fc))
if (djf_block(f, t->p[P_TFLT], &fc)) {
tflt_run(f, &fc, b, n, 0);
#if CLIPPER_SYNTH
if (part_side_on) /* (1.0) SPREAD's side through the same filter (its own state) */
tflt_run(f, &fc, part_side, n, 1);
#endif
}
}
#if CLIPPER_SYNTH
if (part_side_on && sa) { /* (1.0) the side as loud as DIST / the INSERT left the mid */
int32_t sb = 0, g, g0s = t->sd_g ? t->sd_g : 32768;
for (i = 0; i < n; i++)
sb += b[i] < 0 ? -(b[i] >> 6) : b[i] >> 6;
while (sb > 65535 || sa > 65535) /* (32 bits: no 64-bit divide) */
sb >>= 1, sa >>= 1;
g = (int32_t)(((uint32_t)sb << 15) / (uint32_t)(sa + 1));
g = clamp(g, 0, 65535);
t->sd_g = g;
for (i = 0; i < n; i++) {
int32_t gi = g0s + (((g - g0s) * (int32_t)i) >> CTL_LOG2);
part_side[i] = (int32_t)(((int64_t)part_side[i] * gi) >> 15);
}
} else {
t->sd_g = 0;
}
const int32_t *side = juno_chorus(t, b, n) ? jc_side : 0; /* (0.8) the JUNO chorus: stereo */
if (part_side_on) { /* (1.0) + SPREAD's */
if (side)
for (i = 0; i < n; i++)
part_side[i] += jc_side[i];
side = part_side;
}
#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 */
+37 -2
View File
@@ -32,7 +32,9 @@ static const char *const N_SLCR[] = {"OFF", "GATE", "STUT"}; /* SL_O
static const char *const N_FMODEL[] = {"SVF", "MOOG", "MS20", "DIODE", "SEM", "NOTCH", "BP", "HP"}; /* P_FMODEL: FM_* */
static const char *const N_SLDIV[] = {"1/8", "1/16", "1/32", "8T", "16T", "32T"}; /* SL_DEN */
static const char *const N_CHORD[] = {"OFF", "TRIAD", "7TH", "9TH", "SUS4", "POWER"}; /* seq.c CHORD_DEG */
static const char *const N_RTYPE[] = {"ROOM", "PLATE"};
static const char *const N_RTYPE[] = {"ROOM", "PLATE", "HALL", "SHIMR"}; /* (1.0: HALL, SHIMMER) */
static const char *const N_DMODE[] = {"MONO", "PING", "TAPE"}; /* (1.0) G_DMODE */
static const char *const N_E2LOOP[] = {"ONE", "LOOP"};
static const char *const N_MODDST[] = {"OFF", "VIB", "CUT", "SHP", "WAH", "TREM"}; /* MD_OFF .. MD_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
@@ -48,7 +50,8 @@ static const char *const N_IRATE[] = {"689", "919", "1.1k", "1.4k", "1.8k", "2.2
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",
"SEQ1", "SEQ2", "SEQ3", "SEQ4"}; /* (0.8: the MOD SEQ's lanes) */
"SEQ1", "SEQ2", "SEQ3", "SEQ4", /* (0.8: the MOD SEQ's lanes) */
"LFO3", "MAC1", "MAC2", "MAC3", "MAC4"}; /* (1.0) */
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",
@@ -140,6 +143,7 @@ static const param_desc_t TP[P_COUNT] = {
#define MXP(n) [P_M##n##SRC] = PE("SRC", N_MSRC, MS_OFF), [P_M##n##DST] = PE("DST", N_MDST, MT_OFF), \
[P_M##n##AMT] = PD("AMT", F_BIPCT, -64, 63, 0)
MXP(1), MXP(2), MXP(3), MXP(4), MXP(5), MXP(6),
MXP(7), MXP(8), MXP(9), MXP(10), MXP(11), MXP(12), /* 1.0 */
#undef MXP
/* Clipper 0.6: the sound's INSERT (fx.c track_insert, SLOOP 2.6's): TYPE OFF = as before. A B C as the editor
* protocol names them; the device shows the type's own labels (ins_desc) */
@@ -157,6 +161,16 @@ static const param_desc_t TP[P_COUNT] = {
[P_DICE] = PD("DICE", F_INT, 0, 127, 0),
[P_VINT] = PD("VINTG", F_PCT, 0, 127, 0), /* 0.9 */
[P_SLOOP] = PD("LOOP", F_INT, 1, 16, 16),
/* Clipper 1.0 */
[P_SPREAD] = PD("SPRED", F_PCT, 0, 127, 0),
[P_L3RATE] = PD("RATE", F_LFOHZ, 0, 127, 40),
[P_L3WAVE] = PE("WAVE", N_LWAVE, 0),
[P_L3MODE] = PE("MODE", N_L2MODE, L2_FREE),
[P_E2LOOP] = PE("LOOP", N_E2LOOP, 0),
[P_MAC1] = PD("BRITE", F_BIPCT, -64, 63, 0),
[P_MAC2] = PD("TIMBR", F_BIPCT, -64, 63, 0),
[P_MAC3] = PD("MOTN", F_PCT, 0, 127, 0),
[P_MAC4] = PD("SPACE", F_PCT, 0, 127, 0),
#endif
};
#if CLIPPER_SYNTH
@@ -168,6 +182,7 @@ static void clipper_proj_neutral(void)
song.g[G_EQMID] = EQ_MID_C;
song.g[G_EQHIGH] = EQ_HIGH_C;
song.g[G_COMP] = 0;
song.g[G_DMODE] = 0;
for (k = 0; k < NPART; k++) {
trk[k].p[P_VELF] = TP[P_VELF].def;
trk[k].p[P_MWDST] = TP[P_MWDST].def;
@@ -183,11 +198,23 @@ static void clipper_proj_neutral(void)
static void preset_extras(int16_t *p, const preset_t *pr)
{
uint32_t i;
#if CLIPPER_SYNTH
int own = 0;
#endif
for (i = 0; i + 1u < 8u; i += 2u) {
int32_t id = pr->x[i] - 1;
if (id >= 0 && id < P_E0)
p[id] = (int16_t)clamp(pr->x[i + 1u], TP[id].min, TP[id].max);
#if CLIPPER_SYNTH
own |= id == P_SPREAD;
#endif
}
#if CLIPPER_SYNTH
/* (1.0) the pads (a slow attack, a long release) and the unison sounds spread their voices a little, unless the
* preset sets SPREAD itself */
if (!own)
p[P_SPREAD] = (int16_t)((pr->env[0] >= 50u && pr->env[3] >= 80u) || p[P_VOICE] >= V_UNISON ? 48 : TP[P_SPREAD].def);
#endif
}
@@ -238,6 +265,7 @@ static const param_desc_t GP[G_COUNT] = {
[G_NEWPRJ] = PE("NEW", N_GO, 0),
#if CLIPPER_SYNTH
[G_DRDLY] = PD("COMP", F_PCT, 0, 127, 0), /* G_COMP */
[G_DMODE] = PE("MODE", N_DMODE, 0), /* 1.0 */
#else
[G_DRDLY] = PD("DLY", F_INT, 0, 127, 0),
#endif
@@ -472,12 +500,14 @@ static const page_t PAGES[] = {
{"ENV DEST", FAM_ENV, SC_TRACK, GR_NONE, {P_ED_FLT, P_ED_PIT, P_ED_SHP, 0xFF}}, /* (P_ED_FX: the level trim, no page) */
#if CLIPPER_SYNTH
{"ENV 2", FAM_ENV, SC_TRACK, GR_NONE, {P_E2ATK, P_E2DEC, P_E2SUS, P_E2REL}}, /* (a modulation source: MATRIX) */
{"ENV 2 LOOP", FAM_ENV, SC_TRACK, GR_NONE, {P_E2LOOP, 0xFF, 0xFF, 0xFF}}, /* (1.0) */
#endif
{"LFO", FAM_LFO, SC_TRACK, GR_LFO, {P_LRATE, P_LWAVE, P_LPHASE, P_LFADE}},
{"LFO DEST", FAM_LFO, SC_TRACK, GR_NONE, {P_LD_PIT, P_LD_FLT, P_LD_SHP, P_LD_AMP}},
#if CLIPPER_SYNTH /* (velocity, mod wheel, aftertouch) */
{"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}},
{"LFO 3", FAM_LFO, SC_TRACK, GR_NONE, {P_L3RATE, P_L3WAVE, P_L3MODE, 0xFF}}, /* (1.0) */
{"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}},
@@ -494,6 +524,9 @@ static const page_t PAGES[] = {
{"SLICER", FAM_FX, SC_TRACK, GR_SLCR, {P_SLCR, P_SLPAT, P_SLRATE, P_SLDEPTH}}, /* drum track too */
#endif
{"DLY", FAM_FX, SC_GLOBAL, GR_NONE, {G_DTIME, G_DFDBK, G_DCOLOR, G_DMIX}},
#if CLIPPER_SYNTH
{"DLY 2", FAM_FX, SC_GLOBAL, GR_NONE, {G_DMODE, 0xFF, 0xFF, 0xFF}}, /* (1.0: MONO PING TAPE) */
#endif
#if CLIPPER_SYNTH /* (the plate: TYPE and PRE-delay) */
{"REVERB", FAM_FX, SC_GLOBAL, GR_NONE, {G_RTYPE, G_RSIZE, G_RDAMP, G_RPRE}},
{"CHORUS", FAM_FX, SC_GLOBAL, GR_NONE, {G_CRATE, G_CDEPTH, 0xFF, 0xFF}},
@@ -516,6 +549,8 @@ static const page_t PAGES[] = {
{"VOICE", FAM_EDIT, SC_TRACK, GR_NONE, {P_VOICE, P_GLIDE, P_GLMODE, P_PRIO}},
#if CLIPPER_SYNTH /* (one instrument: nothing to mute) */
{"VOICE 2", FAM_EDIT, SC_TRACK, GR_NONE, {P_ALLOC, P_DETUNE, P_PAN, P_VINT}}, /* (0.9: VINTAGE) */
{"VOICE 3", FAM_EDIT, SC_TRACK, GR_NONE, {P_SPREAD, 0xFF, 0xFF, 0xFF}}, /* (1.0: SPREAD) */
{"MACROS", FAM_EDIT, SC_TRACK, GR_NONE, {P_MAC1, P_MAC2, P_MAC3, P_MAC4}}, /* (1.0) */
{"LAYER", FAM_EDIT, SC_SYN, GR_LAYER, {0, 1, 2, 3}}, /* X_LYMODE X_LYSOUND X_LYSPLIT X_LYLEVEL */
{"LAYER 2", FAM_EDIT, SC_SYN, GR_LAYER, {4, 5, 6, 7}}, /* X_LYOCT X_LYPAN X_LYFILT X_LYSWAP */
{"MORPH", FAM_EDIT, SC_SYN, GR_MORPH, {8, 9, 10, 0xFF}}, /* X_MORPH X_SETA X_SETB */
+57 -4
View File
@@ -31,7 +31,8 @@
#define PROJ_NG 32u /* the globals of formats 4 and 5 (G_COUNT until 2.4). SLOOP 2.5's
* G_DRDLY rides in the byte after sel (0 in older projects: off),
* so the format and its size do not change */
_Static_assert(G_DRDLY == PROJ_NG && G_COUNT == PROJ_NG + 1u, "the globals a project holds, then G_DRDLY");
_Static_assert(G_DRDLY == PROJ_NG && G_COUNT == PROJ_NG + 1u + (CLIPPER_SYNTH ? 1u : 0u),
"the globals a project holds, then G_DRDLY (Clipper 1.0: then G_DMODE, with the 1.0 values)");
/* the parameters a track holds: P_COUNT of SLOOP 2.4 / 2.5 (P_E0 was 53). Clipper 0.4 added PROJ_NX before P_E0
* (LFO 2, ENV 2, the matrix: core.h); the synth never uses tracks 3 and 4, so tracks 1 and 2's are kept in track 3's
* lock slots: free ones (step LOCK_FREE), which SLOOP (and any firmware) passes over, a byte a value in their param
@@ -41,7 +42,7 @@ _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),
_Static_assert(P_COUNT == PROJ_NP || (CLIPPER_SYNTH && P_COUNT == PROJ_NP + PROJ_NX && P_COUNT < 128 && 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
@@ -57,7 +58,7 @@ _Static_assert(P_COUNT == PROJ_NP || (CLIPPER_SYNTH && P_COUNT == PROJ_NP + PROJ
#define PROJ_XS ((uint32_t)(P_VINT - P_MSRATE))
/* 0.9: VINTAGE and LOOP of both (PROJ_X9 each, value - its minimum) in track 4, after the steps' mark, then
* CLIPPER_PROJ_MARK_09 */
#define PROJ_X9 ((uint32_t)(P_E0 - P_VINT))
#define PROJ_X9 ((uint32_t)(P_SPREAD - P_VINT))
#define PROJ_X9_AT (PROJ_MS_MARK + 1u)
#define PROJ_X9_MARK (PROJ_X9_AT + 2u * PROJ_X9)
#define CLIPPER_PROJ_MARK_09 0xC9u
@@ -194,6 +195,42 @@ typedef struct { /* one track; the drum track igno
plock_t lock[NLOCK]; /* and its parameter locks (step LOCK_FREE = none) */
uint8_t fill[NSTEP / 4]; /* and its fill condition, 2 bits a step (FC_*) */
} proj_trk_t;
#if CLIPPER_SYNTH
/* 1.0: SPREAD .. the matrix's slot 12 of both (PROJ_X10 each, value - its minimum) and G_DMODE, in track 3's nudges
* (micro: SLOOP plays them on track 3's steps; Clipper writes them only while track 3 has none, so they nudge nothing
* there): byte 0 CLIPPER_PROJ_MARK_10, then track 1's, track 2's, G_DMODE, a check byte */
#define PROJ_X10 ((uint32_t)(P_E0 - P_SPREAD))
#define PROJ_X10_DM (1u + 2u * PROJ_X10)
#define PROJ_X10_CK (PROJ_X10_DM + 1u)
#define CLIPPER_PROJ_MARK_10 0xCAu
_Static_assert(PROJ_X10 == 27u && PROJ_X10_CK < NSTEP, "1.0's values in track 3's nudges");
static uint32_t proj_x10_ck(const int8_t *m)
{
uint32_t i, c = 0x5Au;
for (i = 0; i < PROJ_X10_CK; i++)
c = ((c << 1) | (c >> 7)) ^ (uint8_t)m[i];
return c & 255u;
}
static void proj_x10_put(proj_trk_t *d, const step_t *st) /* (track 3's own steps: none, or nothing put) */
{
uint32_t j, n;
int8_t *m = d->micro;
for (n = 0; n < NSTEP; n++)
if (st[n].n)
return;
memset(m, 0, NSTEP);
m[0] = (int8_t)CLIPPER_PROJ_MARK_10;
for (j = 0; j < 2u; j++)
for (n = 0; n < PROJ_X10; n++)
m[1u + PROJ_X10 * j + n] = (int8_t)(uint8_t)clamp(trk[j].p[P_SPREAD + n] - TP[P_SPREAD + n].min, 0, 255);
m[PROJ_X10_DM] = (int8_t)(uint8_t)clamp(song.g[G_DMODE], GP[G_DMODE].min, GP[G_DMODE].max);
m[PROJ_X10_CK] = (int8_t)proj_x10_ck(m);
}
static int proj_x10_ok(const int8_t *m)
{
return (uint8_t)m[0] == CLIPPER_PROJ_MARK_10 && (uint8_t)m[PROJ_X10_CK] == proj_x10_ck(m);
}
#endif
typedef struct {
uint32_t magic, size;
int16_t g[PROJ_NG];
@@ -571,6 +608,10 @@ static void proj_capture(project_t *p) /* what is playing now, as a proje
memcpy(p->t[i].step, trk[i].step, sizeof trk[i].step);
memcpy(p->t[i].micro, trk[i].micro, sizeof trk[i].micro);
memcpy(p->t[i].fill, trk[i].fill, sizeof trk[i].fill);
#if CLIPPER_SYNTH
if (i == 2u) /* (1.0: tracks 1 and 2's SPREAD .. slot 12, G_DMODE) */
proj_x10_put(&p->t[2], trk[2].step);
#endif
}
p->sum = proj_sum(p);
}
@@ -599,7 +640,10 @@ static void proj_apply(const project_t *p, int all)
i >= P_E0 && i <= P_E7 ? &ENGINES[e]->edit[i - P_E0] : &TP[i];
int32_t v = i < PROJ_E0 ? s->p[i] : i >= P_E0 ? s->p[PROJ_E0 + i - P_E0] : d->def;
#if CLIPPER_SYNTH
if (i >= P_VINT && i < P_E0 && k < 2u && p->rsv[0] == CLIPPER_PROJ_MARK) {
if (i >= P_SPREAD && i < P_E0 && k < 2u) { /* (1.0: in track 3's nudges) */
v = p->rsv[0] == CLIPPER_PROJ_MARK && proj_x10_ok(p->t[2].micro) ?
(uint8_t)p->t[2].micro[1u + PROJ_X10 * k + (i - P_SPREAD)] + d->min : d->def;
} else if (i >= P_VINT && i < P_E0 && k < 2u && p->rsv[0] == CLIPPER_PROJ_MARK) {
int x = proj_x9_get(p->t[3].lock, k, i - P_VINT); /* (0.9: in track 4) */
v = x < 0 ? d->def : x + d->min;
} else if (i >= PROJ_E0 && i < P_E0 && k < 2u && p->rsv[0] == CLIPPER_PROJ_MARK) {
@@ -619,6 +663,15 @@ static void proj_apply(const project_t *p, int all)
memcpy(t->step, s->step, sizeof t->step);
for (i = 0; i < NSTEP; i++) /* the nudges and locks, each inside its range */
t->micro[i] = (int8_t)clamp(s->micro[i], MICRO_MIN, MICRO_MAX);
#if CLIPPER_SYNTH
if (k == 2u && p->rsv[0] == CLIPPER_PROJ_MARK && proj_x10_ok(s->micro)) {
memset(t->micro, 0, sizeof t->micro); /* (1.0's values, not nudges) */
if (all)
song.g[G_DMODE] = (int16_t)clamp((uint8_t)s->micro[PROJ_X10_DM], GP[G_DMODE].min, GP[G_DMODE].max);
} else if (k == 2u && all) {
song.g[G_DMODE] = GP[G_DMODE].def;
}
#endif
for (i = 0; i < NSTEP / 4u; i++) { /* the conditions: 3 means normal (0) */
uint32_t b = s->fill[i], j;
for (j = 0; j < 4u; j++)
+5 -1
View File
@@ -2552,7 +2552,7 @@ static const uint8_t MIDI_CC_MAP[][2] = {
};
/* Clipper: the performance controllers of a part (eng_hybrid.c part_ctl: the matrix's MW, AT, BEND, EXPR):
* pitch bend (En, every engine: voice.c), channel and polyphonic pressure (Dn, An), and the CCs 1 (mod
* wheel), 11 (expression), 64 (sustain pedal), 16..19 (HYBRID: the macros M1..M4) */
* wheel), 11 (expression), 64 (sustain pedal), 16..19 (HYBRID: the macros M1..M4; 1.0, the others: MACROS) */
static void part_ctl_event(track_t *t, uint32_t st, uint32_t d1, uint32_t d2)
{
uint32_t p = (uint32_t)(t - trk), i;
@@ -2610,6 +2610,10 @@ static int part_ctl_cc(track_t *t, uint32_t cc, uint32_t value) /* 1: taken */
case 16: case 17: case 18: case 19:
if (t->eng_req == ENGI_HYBRID)
t->p[P_E4 + cc - 16u] = (int16_t)value;
#if CLIPPER_SYNTH
else /* (1.0) the other engines: the sound's MACROS (BRITE TIMBR: centred) */
t->p[P_MAC1 + cc - 16u] = (int16_t)(cc < 18u ? (int32_t)value - 64 : (int32_t)value);
#endif
return 1;
#if CLIPPER_SYNTH
case 20: /* Clipper 0.3: MORPH (ui_synth.c, the UI applies it) */
+24 -5
View File
@@ -132,6 +132,11 @@ static int st_load(uint32_t obj, void *dst, uint32_t max)
#define ST_SIDE_MAX (ST_PAYLOAD_OFF - ST_SIDE_OFF)
static const void *st_side; /* the next save's side record (0: none), for one save */
static uint32_t st_side_len;
/* (Clipper 1.0) a tail: bytes right after the payload, in the rest of the copy's sector, outside the payload's length
* and CRC (an older version reads the payload as before and never sees them; its save erases them). The tail checks
* itself (upreset.c: a magic and a CRC) */
static const void *st_tail; /* the next save's tail (0: none), for one save */
static uint32_t st_tail_len;
_Static_assert(sizeof(st_hdr_t) <= ST_SIDE_OFF, "the side record starts after the header");
/* the current copy's side bytes (n <= ST_SIDE_MAX) into dst: 0, or -1 (no valid copy) */
static int st_side_load(uint32_t obj, void *dst, uint32_t n)
@@ -142,6 +147,15 @@ static int st_side_load(uint32_t obj, void *dst, uint32_t n)
return -1;
return st_read(st_sector(obj, (uint32_t)c) + ST_SIDE_OFF, dst, n) ? -1 : 0;
}
/* (1.0) the current copy's tail (n bytes after its payload) into dst: 0, or -1 (no valid copy, no room) */
static int st_tail_load(uint32_t obj, void *dst, uint32_t n)
{
st_hdr_t h;
int c = st_current(obj, &h);
if (c < 0 || h.len + n > ST_PAYLOAD_MAX)
return -1;
return st_read(st_sector(obj, (uint32_t)c) + ST_PAYLOAD_OFF + h.len, dst, n) ? -1 : 0;
}
/* an object in up to three parts, src then src2 then src3 (SLOOP 2.5: the settings and the SYN kits after them; SLOOP
* 2.6: then its MIDI settings, which Clipper keeps as they are: project.c set_tail) */
@@ -164,12 +178,17 @@ static int st_save3(uint32_t obj, const void *src, uint32_t len, const void *src
for (off = 0; off < len3; off++)
st_buf[len + off] = ((const uint8_t *)src3)[off];
len += len3;
if ((rc = st_erase(base)) != 0)
return rc;
for (off = 0; off < len; off += 256u) {
uint32_t n = len - off > 256u ? 256u : len - off;
if ((rc = st_prog(base + ST_PAYLOAD_OFF + off, st_buf + off, n)) != 0)
{ /* (1.0) the tail right after the payload, programmed with it (whole pages: none wraps) */
uint32_t tl = st_tail && st_tail_len && len + st_tail_len <= ST_PAYLOAD_MAX ? st_tail_len : 0u, all = len + tl;
for (off = 0; off < tl; off++)
st_buf[len + off] = ((const uint8_t *)st_tail)[off];
if ((rc = st_erase(base)) != 0)
return rc;
for (off = 0; off < all; off += 256u) {
uint32_t n = all - off > 256u ? 256u : all - off;
if ((rc = st_prog(base + ST_PAYLOAD_OFF + off, st_buf + off, n)) != 0)
return rc;
}
}
if (st_side && st_side_len && st_side_len <= ST_SIDE_MAX) { /* (0.7) the side record, before the header */
uint8_t sb[ST_SIDE_MAX];
+1 -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.9" /* the synthesizer firmware for the FM-1 (from SLOOP 2.5, based on Felucca) */
#define FELUCCA_VERSION "CLIPPER 1.0" /* 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);
+17 -12
View File
@@ -51,7 +51,7 @@ static const param_desc_t XD[X_COUNT] = {
[X_RNDWHAT] = PE("WHAT", N_RNDWHAT, 1),
[X_RNDGO] = PE("RAND", N_GO, 0),
[X_RNDBACK] = PE("BACK", N_GO, 0),
[X_MSLOT] = PD("SLOT", F_INT, 1, 6, 1),
[X_MSLOT] = PD("SLOT", F_INT, 1, 12, 1), /* (1.0: 12) */
[X_FOP] = PD("OP", F_INT, 1, 6, 1),
[X_FWAVE] = PE("WAVE", N_FMX_WAVE, 0),
[X_FMODE] = PE("MODE", N_FMX_MODE, 0),
@@ -133,7 +133,8 @@ typedef struct {
syn_snap_t s;
fmx_patch_t fx; /* (the part's FMX patch, eng_fmx.c fmx_cur) */
} hist_t;
static hist_t hist[HIST_N]; /* a ring: hist_n steps back, then hist_r steps forward */
static hist_t hist[HIST_N] __attribute__((section(".pool"))); /* a ring: hist_n steps back, then hist_r steps
* forward (1.0: in the pool, RAM is near full) */
static hist_t hist_cur, hist_orig, hist_cmp; /* the step now (committed), the sound as loaded, the edits */
static uint32_t hist_head, hist_n, hist_r, hist_t0; /* hist_head: the next free place; hist_t0: the last change */
static uint8_t hist_pend, hist_ready, hist_cmp_on, hist_edited, hist_load_req;
@@ -386,7 +387,8 @@ static void syn_rnd_range(uint32_t i, const param_desc_t *d, int32_t *lo, int32_
case P_DIST: *hi = 70; break;
default: break;
}
if (i >= P_M1SRC && i <= P_M6AMT) { /* a matrix slot's amount: moderate, the pitch finer */
uint32_t mf;
if (mx_slot_of(i, &mf) >= 0) { /* a matrix slot's amount: moderate, the pitch finer */
int32_t r = trk[0].p[i - 1u] == MT_PITCH ? 6 : 40;
*lo = -r;
*hi = r;
@@ -400,8 +402,10 @@ static int syn_rnd_in(uint32_t i, uint32_t what)
{
int edit = i >= P_E0 && i <= P_E7;
int env = (i >= P_ATK && i <= P_REL) || (i >= P_ED_FLT && i <= P_ED_SHP) || (i >= P_E2ATK && i <= P_E2REL);
uint32_t mf;
int mod = (i >= P_LRATE && i <= P_LD_AMP) || i == P_VELF || (i >= P_L2RATE && i <= P_L2MODE) ||
(i >= P_M1SRC && i <= P_M6AMT && (i - P_M1SRC) % 3u == 2u && trk[0].p[i - 2u] != MS_OFF && trk[0].p[i - 1u] != MT_OFF);
(i >= P_L3RATE && i <= P_L3MODE) || /* (1.0: LFO 3, slots 7..12) */
(mx_slot_of(i, &mf) >= 0 && mf == 2u && trk[0].p[i - 2u] != MS_OFF && trk[0].p[i - 1u] != MT_OFF);
int fx = (i >= P_DIST && i <= P_REV) || (trk[0].p[P_ITYPE] && i >= P_IA && i <= P_IMIX); /* (0.7: the INSERT's
* values, its TYPE kept) */
switch (what) {
@@ -587,7 +591,7 @@ static const param_desc_t *syn_desc(uint32_t id, int16_t **valp)
case X_MSRC:
case X_MDST:
case X_MAMT: { /* the slot's own values, the selected sound's */
uint32_t pid = P_M1SRC + 3u * (uint32_t)(clamp(xv[X_MSLOT], 1, 6) - 1) + (id - X_MSRC);
uint32_t pid = mx_pid((uint32_t)(clamp(xv[X_MSLOT], 1, (int32_t)MX_SLOTS) - 1)) + (id - X_MSRC);
*valp = &TSEL->p[pid];
return track_desc(TSEL, pid);
}
@@ -978,18 +982,19 @@ static void graph_mseq(void)
static void graph_matrix(void)
{
const track_t *t = TSEL;
uint32_t k, sel = (uint32_t)clamp(xv[X_MSLOT], 1, 6) - 1u;
for (k = 0; k < MX_SLOTS; k++) {
uint32_t id = P_M1SRC + 3u * k;
uint32_t k, sel = (uint32_t)clamp(xv[X_MSLOT], 1, (int32_t)MX_SLOTS) - 1u, k0 = sel / 6u * 6u; /* (1.0: the six
* of the selected one: 1..6 or 7..12) */
for (k = k0; k < k0 + 6u; k++) {
uint32_t id = mx_pid(k);
int32_t sr = clamp(t->p[id], 0, MS_NSRC - 1), ds = clamp(t->p[id + 1u], 0, MT_COUNT - 1), a = t->p[id + 2u];
const param_desc_t *dd = track_desc(t, id + 1u);
int on = sr && ds && a;
uint16_t c = k == sel ? C_WHITE : on ? C_GRAY : C_DIM;
char nb[2] = {(char)('1' + k), 0}, val[12];
char nb[3] = {k >= 9u ? '1' : (char)('1' + k), k >= 9u ? (char)('0' + k - 9u) : 0, 0}, val[12];
const char *unit = 0;
int32_t y = 2 + (int32_t)k * 14;
cv_text(8, y, &FONT_S, nb, k == sel ? C_HI : C_DIM);
cv_text(24, y, &FONT_S, N_MSRC[sr], c);
int32_t y = 2 + (int32_t)(k - k0) * 14;
cv_text(k >= 9u ? 2 : 10, y, &FONT_S, nb, k == sel ? C_HI : C_DIM); /* (1.0: 10..12 right-aligned) */
cv_text(28, y, &FONT_S, N_MSRC[sr], c);
cv_text(84, y, &FONT_S, ">", C_DIM);
cv_text(98, y, &FONT_S, dd->names[ds], c);
param_format(&TP[id + 2u], a, val, &unit);
+61 -2
View File
@@ -54,7 +54,7 @@ _Static_assert(P_COUNT < 128, "user preset record: P_COUNT");
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 + 1 == P_MSRATE &&
P_SLOOP == P_E0 - 1, "the packed parameters, in order");
P_SLOOP == P_SPREAD - 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)
@@ -74,6 +74,8 @@ static void up_xpack(int16_t *p, const int16_t *x) /* x: P_L2RATE .. P_IMIX ->
p[UP_PMAX - 1u] = UP_XMAGIC6;
for (i = 0; i < UP_NX; i++) {
uint32_t v = (uint32_t)clamp(x[i] - TP[UP_E0V + i].min, 0, (1 << UP_XW[i]) - 1);
if (UP_E0V + i >= P_M1SRC && UP_E0V + i <= P_M6AMT && (UP_E0V + i - P_M1SRC) % 3u == 0u)
v = (uint32_t)clamp(x[i], 0, MS_NSRC - 1) & 15u; /* (1.0: a source's fifth bit in the tail) */
for (j = 0; j < UP_XW[i]; j++, bit++)
if ((v >> j) & 1u) {
int16_t *w = up_xword(p, bit, &sh);
@@ -110,7 +112,7 @@ static up_bank_t up_bank[UP_SLOTS / UP_PER_BANK] __attribute__((section(".pool")
* 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 */
/* 0.9: + VINTAGE and LOOP (UP_NS 8): a slot's v[0] 2; 0.8's side (UPS8, 8 bytes a slot, v[0] 1, 6 values) still read */
#define UP_NS ((uint32_t)P_E0 - P_MSRATE)
#define UP_NS ((uint32_t)P_SPREAD - P_MSRATE)
#define UP_NS8 6u /* (0.8's) */
#define UP_SIDE_MAGIC 0x39535055u /* "UPS9" */
#define UP_SIDE_MAGIC8 0x38535055u /* "UPS8" (0.8) */
@@ -127,6 +129,28 @@ typedef struct {
_Static_assert(UP_NS == 8u && sizeof(up_side_t) == 168u && sizeof(up_side8_t) == 136u, "the user presets' side record");
static up_side_t up_side[UP_SLOTS / UP_PER_BANK];
static uint8_t up_xs[10]; /* the side bytes of the record up_rec_set made last (up_put's) */
/* 1.0: SPREAD .. the matrix's slot 12 (UP_NT values) ride in the bank's tail (storage.c st_tail: after the payload, in
* the rest of its sector: SLOOP and older versions never see it, their save erases it), with the fifth bit of slots
* 1..6's sources (the record keeps four: LFO 3 and the macros are 15..19). A slot's bytes: v[0] 1 (set), v[1] the
* fifth bits (slot k: bit k), then each value - its minimum; a slot without them loads their defaults */
#define UP_NT ((uint32_t)P_E0 - P_SPREAD)
#define UP_TAIL_MAGIC 0x30315055u /* "UP10" */
typedef struct {
uint32_t magic;
uint8_t v[UP_PER_BANK][UP_NT + 2u];
uint32_t crc;
} up_tail_t;
_Static_assert(UP_NT == 27u && sizeof(up_tail_t) + sizeof(up_bank_t) <= 3840u, "the user presets' tail fits the sector");
static up_tail_t up_tail[UP_SLOTS / UP_PER_BANK] __attribute__((section(".pool")));
static uint8_t up_xt[UP_NT + 2u]; /* the tail bytes of the record up_rec_set made last */
static const uint8_t *up_tail_of(const up_rec_t *r) /* a record's tail 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_tail[b].magic == UP_TAIL_MAGIC && up_tail[b].v[r - up_bank[b].r][0] == 1u ? up_tail[b].v[r - up_bank[b].r] : 0;
return up_xt[0] == 1u ? up_xt : 0;
}
static const uint8_t *up_side_of(const up_rec_t *r) /* a record's side bytes, 0 = none */
{
uint32_t b;
@@ -193,6 +217,13 @@ static void up_rec_set(up_rec_t *r, const int16_t *v)
up_xs[0] = 2;
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);
up_xt[0] = 1; /* (1.0) the tail's */
up_xt[1] = 0;
for (i = 0; i < MX_SLOTS6; i++)
if (clamp(v[mx_pid(i)], 0, MS_NSRC - 1) & 16)
up_xt[1] |= (uint8_t)(1u << i);
for (i = 0; i < UP_NT; i++)
up_xt[2u + i] = (uint8_t)clamp(v[P_SPREAD + i] - TP[P_SPREAD + i].min, 0, 255);
#else
r->np = P_COUNT;
for (i = 0; i < P_COUNT; i++)
@@ -220,6 +251,15 @@ static void up_params(const up_rec_t *r, int16_t *out, const int16_t *def)
for (i = 0; i < UP_NS; i++)
out[P_MSRATE + i] = i < nv ? (int16_t)(sd[1u + i] + TP[P_MSRATE + i].min) : def[P_MSRATE + i];
}
{
const uint8_t *tl = up_xrec(r) ? up_tail_of(r) : 0; /* (1.0) SPREAD .. slot 12, the sources' fifth bits */
for (i = 0; i < UP_NT; i++)
out[P_SPREAD + i] = tl ? (int16_t)(tl[2u + i] + TP[P_SPREAD + i].min) : def[P_SPREAD + i];
if (tl)
for (i = 0; i < MX_SLOTS6; i++)
if ((tl[1] >> i) & 1u)
out[mx_pid(i)] = (int16_t)(out[mx_pid(i)] | 16);
}
#endif
}
@@ -237,6 +277,7 @@ static int up_bank_import(uint32_t b, const uint8_t *src, int len)
{
up_bank_t *bk = &up_bank[b];
const up_bank_t *h = (const up_bank_t *)src;
memset(&up_tail[b], 0, sizeof up_tail[b]); /* (1.0: the tail is the sector's; up_boot loads it after) */
if (len == (int)(8u + UP_PER_BANK * UP_RSIZE_04) && h->magic == UP_BANK_MAGIC && h->rsize == UP_RSIZE_04 &&
h->nslot == UP_PER_BANK) {
uint32_t k, i;
@@ -395,6 +436,10 @@ static void up_boot(void) /* persist_boot: the banks from f
}
}
}
memset(&up_tail[b], 0, sizeof up_tail[b]); /* (1.0) the tail, when it is ours and whole */
if (flash_ok && (st_tail_load(OBJ_UPRESET0 + b, &up_tail[b], sizeof up_tail[b]) ||
up_tail[b].magic != UP_TAIL_MAGIC || up_tail[b].crc != st_crc32(&up_tail[b], sizeof up_tail[b] - 4u)))
memset(&up_tail[b], 0, sizeof up_tail[b]);
#else
up_bank_check(b, flash_ok ? st_load(OBJ_UPRESET0 + b, &up_bank[b], sizeof up_bank[b]) : -1);
#endif
@@ -424,6 +469,17 @@ static int up_put(uint32_t k, const up_rec_t *r)
memset(sd->v[k % UP_PER_BANK], 0, sizeof sd->v[0]);
sd->crc = st_crc32(sd, sizeof *sd - 4u);
}
{ /* (1.0) its tail bytes the same */
up_tail_t *tl = &up_tail[k / UP_PER_BANK];
if (tl->magic != UP_TAIL_MAGIC)
memset(tl, 0, sizeof *tl);
tl->magic = UP_TAIL_MAGIC;
if (r)
memcpy(tl->v[k % UP_PER_BANK], up_xt, sizeof up_xt);
else
memset(tl->v[k % UP_PER_BANK], 0, sizeof tl->v[0]);
tl->crc = st_crc32(tl, sizeof *tl - 4u);
}
#endif
if (!r) {
uint32_t i;
@@ -438,9 +494,12 @@ static int up_put(uint32_t k, const up_rec_t *r)
#if CLIPPER_SYNTH
st_side = &up_side[k / UP_PER_BANK];
st_side_len = sizeof(up_side_t);
st_tail = &up_tail[k / UP_PER_BANK];
st_tail_len = sizeof(up_tail_t);
#endif
rc = st_save(OBJ_UPRESET0 + k / UP_PER_BANK, bk, sizeof *bk);
st_side = 0;
st_tail = 0;
return rc ? 2 : 0;
}
#endif
+97 -11
View File
@@ -316,10 +316,12 @@ static void voice_start(track_t *t, voice_t *v, uint32_t note, uint32_t vel, int
v->env2 = 0;
v->e2st = 1;
v->l2ph = 0;
v->l3ph = 0; /* (1.0) LFO 3 KEY: from the note's start */
seed = seed * 1664525u + 1013904223u;
v->rnd = (int16_t)(seed >> 16);
seed = seed * 1664525u + 1013904223u;
v->l2rnd = (int16_t)(seed >> 16);
v->l3rnd = v->l2rnd;
v->ch = mpe_cur_ch;
}
#endif
@@ -884,6 +886,9 @@ static int32_t env2_tick(const int16_t *p, voice_t *v)
break;
case 2:
v->env2 += mulq16(((int32_t)p[P_E2SUS] << 17) - v->env2, ENV_EXP[p[P_E2DEC] & 127]);
if (p[P_E2LOOP] && v->env2 - ((int32_t)p[P_E2SUS] << 17) < (1 << 18))
v->e2st = 1; /* (1.0) LOOP: close to the sustain, the attack again (from
* there: no jump), until the note is let go */
break;
case 3:
v->env2 -= mulq16(v->env2, ENV_EXP[p[P_E2REL] & 127]);
@@ -914,7 +919,8 @@ static void mx_load(const int16_t *p, mx_t *x)
uint32_t k;
x->n = x->srcs = x->dsts = 0;
for (k = 0; k < MX_SLOTS; k++) {
int32_t sr = p[P_M1SRC + 3u * k], ds = p[P_M1DST + 3u * k], a = p[P_M1AMT + 3u * k];
uint32_t id = mx_pid(k); /* (1.0: 12 slots, 7..12 at P_M7SRC) */
int32_t sr = p[id], ds = p[id + 1u], a = p[id + 2u];
if (sr <= MS_OFF || sr >= MS_NSRC || ds <= MT_OFF || ds >= MT_COUNT || !a)
continue;
if (ds == MT_L2RATE && sr == MS_LFO2)
@@ -1065,6 +1071,33 @@ static voice_t *vsl_v[NVOICE]; /* the late ones and their
static vmod_t vsl_m[NVOICE];
static int16_t vsl_p[NVOICE][8];
static uint32_t vsl_n;
/* (1.0) SPREAD: each voice's place in the stereo field. The part renders its voices' sum (the mid, as before: bit for
* bit without SPREAD) and, when SPREAD is up, part_side: each voice times its gain (its place x SPREAD, gliding
* through the block), which fx.c mix_part1 adds to the left and takes from the right. A voice alone into a scratch
* first (vs_tmp, one per core: engines.c C1_IX) */
static int32_t part_side[CTL], vs_side1[CTL];
static uint8_t part_side_on, vs_side1_on;
static int32_t vs_g0[NVOICE], vs_g1[NVOICE], vsl_g0[NVOICE], vsl_g1[NVOICE];
/* the places, Q15: neighbours (the voices one note after the other take) left and right, the outer ones first */
static const int16_t VS_POS[16] = {-32767, 32767, -16384, 16384, -24576, 24576, -8192, 8192,
-29491, 29491, -19661, 19661, -11469, 11469, -3277, 3277};
static void vrender(track_t *t, const engine_t *e, voice_t *v, int32_t *out, uint32_t n, const vmod_t *m, int32_t g0,
int32_t g1, int32_t *side, int32_t *tmp)
{
uint32_t i;
if (!g0 && !g1) {
e->render(t, v, out, n, m);
return;
}
for (i = 0; i < n; i++)
tmp[i] = 0;
e->render(t, v, tmp, n, m);
for (i = 0; i < n; i++) {
int32_t g = g0 + (((g1 - g0) * (int32_t)i) >> CTL_LOG2);
out[i] += tmp[i];
side[i] += ((tmp[i] >> 4) * g) >> 11; /* (>> 4 first: 32 bits) */
}
}
static struct { track_t *t; const engine_t *e; uint32_t n, a, b; } vsj;
static uint32_t vs_jobs, vs_split; /* (console, tests: blocks handed over, voices rendered there) */
static void vs_job(uint32_t arg) /* on core 1 */
@@ -1072,9 +1105,12 @@ static void vs_job(uint32_t arg) /* on core 1 */
uint32_t i;
(void)arg;
for (i = 0; i < vsj.n; i++)
vs_buf[i] = 0;
for (i = vsj.a; i < vsj.b; i++)
vsj.e->render(vsj.t, vs_v[i], vs_buf, vsj.n, &vs_m[i]);
vs_buf[i] = vs_side1[i] = 0;
vs_side1_on = 0;
for (i = vsj.a; i < vsj.b; i++) {
vs_side1_on |= vs_g0[i] || vs_g1[i];
vrender(vsj.t, vsj.e, vs_v[i], vs_buf, vsj.n, &vs_m[i], vs_g0[i], vs_g1[i], vs_side1, vs_tmp[1]);
}
}
static int vs_ok(const engine_t *e) /* its render may run on two cores at once, for two voices */
{
@@ -1094,14 +1130,17 @@ static void vs_finish(track_t *t, const engine_t *e, int32_t *out, uint32_t n)
h = vs_n;
}
for (k = 0; k < h; k++)
e->render(t, vs_v[k], out, n, &vs_m[k]);
vrender(t, e, vs_v[k], out, n, &vs_m[k], vs_g0[k], vs_g1[k], part_side, vs_tmp[0]);
if (handed) {
if (cpu1_wait() < 0) { /* late: held from now on (cpu1.c); its voices here */
for (k = h; k < vs_n; k++)
e->render(t, vs_v[k], out, n, &vs_m[k]);
vrender(t, e, vs_v[k], out, n, &vs_m[k], vs_g0[k], vs_g1[k], part_side, vs_tmp[0]);
} else {
for (i = 0; i < n; i++)
out[i] += vs_buf[i];
if (vs_side1_on)
for (i = 0; i < n; i++)
part_side[i] += vs_side1[i];
vs_jobs++;
vs_split += vs_n - h;
}
@@ -1113,7 +1152,7 @@ static void vs_finish(track_t *t, const engine_t *e, int32_t *out, uint32_t n)
keep[j] = t->p[P_E0 + j];
t->p[P_E0 + j] = vsl_p[k][j];
}
e->render(t, vsl_v[k], out, n, &vsl_m[k]);
vrender(t, e, vsl_v[k], out, n, &vsl_m[k], vsl_g0[k], vsl_g1[k], part_side, vs_tmp[0]);
for (j = 0; j < 8u; j++)
t->p[P_E0 + j] = keep[j];
}
@@ -1143,8 +1182,14 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
vib = osc_sine(vib_ph[(uint32_t)(t - trk) % NPART]);
/* Clipper 0.4: the matrix (mx_load); sv: its sources (the part's here, the voice's in the loop) */
mx_t mx;
int32_t sv[MS_NSRC], l2free, pan_new = 0, vint = clamp(t->p[P_VINT], 0, 127);
int32_t sv[MS_NSRC], l2free, l3free, pan_new = 0, vint = clamp(t->p[P_VINT], 0, 127);
uint32_t pan_age = 0, catr = part_ctl[pc].at;
/* (1.0) the macros: BRITE (the cutoff, +-) and TIMBR (the shape, +-), MOTN (a vibrato and LFO 3 on the cutoff),
* SPACE (fx.c: the reverb and delay sends, and SPREAD); SPREAD: the voices' gains from the last block's to this
* one's */
int32_t mac1 = clamp(t->p[P_MAC1], -64, 63), mac2 = clamp(t->p[P_MAC2], -64, 63), mac3 = clamp(t->p[P_MAC3], 0, 127);
int32_t spr = clamp(t->p[P_SPREAD] + clamp(t->p[P_MAC4], 0, 127) / 2, 0, 127), spr0 = t->spr;
int sided = (uint32_t)(t - trk) < NPART && (spr || spr0);
#endif
/* TUNE in cents: whole 1/16 semitones in the pitch, the rest as a fine factor (no dead zone) */
int32_t tune = song.g[G_TUNE] >= 0 ? song.g[G_TUNE] * 16 / 100 : -((-song.g[G_TUNE] * 16 + 99) / 100);
@@ -1154,6 +1199,11 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
#if CLIPPER_SYNTH
int split = vs_ok(e) && cpu1_units != 0 && cpu1_on(); /* (0.7) the voices on both cores */
vs_n = vsl_n = 0;
part_side_on = (uint8_t)sided;
if (sided)
for (i = 0; i < n; i++)
part_side[i] = 0;
t->spr = (int16_t)spr;
#endif
for (i = 0; i < n; i++)
out[i] = 0;
@@ -1179,6 +1229,16 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
t->l2rnd = (int16_t)(rng() >> 16);
l2free = lfo_wave_n(p[P_L2WAVE], t->l2ph, t->l2rnd);
}
{ /* (1.0) LFO 3 FREE, and the macros as sources */
uint32_t old = t->l3ph;
t->l3ph += LFO_INC[clamp(p[P_L3RATE], 0, 127)];
if (t->l3ph < old)
t->l3rnd = (int16_t)(rng() >> 16);
l3free = lfo_wave_n(p[P_L3WAVE], t->l3ph, t->l3rnd);
sv[MS_LFO3] = l3free;
sv[MS_MAC1] = mac1 * 512, sv[MS_MAC2] = mac2 * 512;
sv[MS_MAC3] = mac3 * 258, sv[MS_MAC4] = clamp(p[P_MAC4], 0, 127) * 258;
}
#endif
if (e->block) /* the engine's per-part work (DRAWBAR: bars, rotor) */
e->block(t);
@@ -1235,6 +1295,15 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
} else {
sv[MS_LFO2] = l2free;
}
if (p[P_L3MODE] == L2_KEY && (mx.srcs & (1u << MS_LFO3))) { /* (1.0) LFO 3 KEY: the note's own */
uint32_t old = v->l3ph;
v->l3ph += LFO_INC[clamp(p[P_L3RATE], 0, 127)];
if (v->l3ph < old)
v->l3rnd = (int16_t)(rng() >> 16);
sv[MS_LFO3] = lfo_wave_n(p[P_L3WAVE], v->l3ph, v->l3rnd);
} else {
sv[MS_LFO3] = l3free;
}
for (k = 0; k < mx.n; k++) {
int32_t x = sv[mx.src[k]] * mx.amt[k] >> 6; /* Q15 x AMT / 64 */
uint32_t d = mx.dst[k];
@@ -1305,6 +1374,8 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
if (vd)
q += (vib * (vd > 127 ? 127 : vd)) >> 11;
q += clamp(mpit, -24 * 4096, 24 * 4096); /* the matrix */
if (mac3) /* (1.0) MOTN: a vibrato up to +-35 cents */
q += (vib * mac3) >> 12;
if (mpe) /* MPE: the note's own bend */
q += (mpe_bend[v->ch & 15u] * (int32_t)MPE_RANGE[mpe_mode % MPE_MODES]) >> 3;
if (tun_on) /* (0.9) the TUNING: the note's own pitch (glides too) */
@@ -1344,6 +1415,10 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
if (p[P_ATDST] == MD_SHP)
m.shape += a * 128;
m.cutoff += clamp(mcut, -32767, 32767); /* the matrix */
m.cutoff += mac1 * 160; /* (1.0) BRITE: +-40 steps (about +-2.5 octaves) */
if (mac3) /* .. MOTN: LFO 3 on the cutoff, up to +-24 steps */
m.cutoff += (l3free * mac3) >> 10;
m.shape = clamp(m.shape + mac2 * 128, 0, 127 << 8); /* .. TIMBR: +-32 steps of the shape */
if (vint) /* (0.9) VINTAGE: each voice's filter a little off */
m.cutoff += ((vcard((uint32_t)(t - trk) * NVOICE + i, 1u) * 400) >> 15) * vint >> 7;
if (mshp)
@@ -1360,7 +1435,10 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
vsl_p[vsl_n][k] = (int16_t)clamp(t->p[P_E0 + k] + ((clamp(med[k], -32767, 32767) * (d->max - d->min)) >> 15),
d->min, d->max);
}
vsl_v[vsl_n] = v, vsl_m[vsl_n] = m, vsl_n++;
vsl_v[vsl_n] = v, vsl_m[vsl_n] = m;
vsl_g0[vsl_n] = sided ? (VS_POS[i % 16u] * spr0 * 23) >> 12 : 0;
vsl_g1[vsl_n] = sided ? (VS_POS[i % 16u] * spr * 23) >> 12 : 0;
vsl_n++;
nr++;
continue;
}
@@ -1374,17 +1452,25 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
t->p[P_E0 + k] = (int16_t)clamp(keep[k] + ((clamp(med[k], -32767, 32767) * (d->max - d->min)) >> 15),
d->min, d->max);
}
e->render(t, v, out, n, &m);
vrender(t, e, v, out, n, &m, sided ? (VS_POS[i % 16u] * spr0 * 23) >> 12 : 0,
sided ? (VS_POS[i % 16u] * spr * 23) >> 12 : 0, part_side, vs_tmp[0]);
for (k = 0; k < 8u; k++)
t->p[P_E0 + k] = keep[k];
nr++;
continue;
}
if (split) { /* (0.7) rendered after the loop, on both cores */
vs_v[vs_n] = v, vs_m[vs_n] = m, vs_n++;
vs_v[vs_n] = v, vs_m[vs_n] = m;
vs_g0[vs_n] = sided ? (VS_POS[i % 16u] * spr0 * 23) >> 12 : 0;
vs_g1[vs_n] = sided ? (VS_POS[i % 16u] * spr * 23) >> 12 : 0;
vs_n++;
nr++;
continue;
}
vrender(t, e, v, out, n, &m, sided ? (VS_POS[i % 16u] * spr0 * 23) >> 12 : 0,
sided ? (VS_POS[i % 16u] * spr * 23) >> 12 : 0, part_side, vs_tmp[0]);
nr++;
continue;
#endif
e->render(t, v, out, n, &m);
nr++;
+18 -1
View File
@@ -6,7 +6,8 @@
* a sound loaded (every engine's first presets, one into the next), VOICE steals (12 notes on 8 voices), MUTE on and
* off, LEVEL and PAN jumped, the INSERT's TYPE turned through every type, the master FILT jumped, MODEL (the duck),
* CHOR of JUNO, the MOD SEQ's SMTH to the cutoff, LFO 2 KEY, VINTAGE turned up, the TUNING changed (a pitch step:
* the phase goes on), the LAYER turned on and off.
* the phase goes on), the LAYER turned on and off; 1.0: SPREAD, BRITE, TIMBR, MOTN and SPACE jumped, the reverb's
* TYPE (ROOM PLATE HALL SHIMMER) and the delay's MODE (MONO PING TAPE) turned through.
* Bound: the change's mark under 2 x the steady one + 400 (about -38 dB of the limiter's ceiling). */
#define main hostsim_main
#include "hostsim.c"
@@ -136,6 +137,13 @@ static void ch_layer(track_t *t, uint32_t k)
(void)t;
trk[1].p[P_LYMODE] = (int16_t)(k & 1u ? LY_OFF : LY_LAYER);
}
static void ch_spread(track_t *t, uint32_t k) { t->p[P_SPREAD] = (int16_t)(k & 1u ? 0 : 127); } /* (1.0) */
static void ch_brite(track_t *t, uint32_t k) { t->p[P_MAC1] = (int16_t)(k & 1u ? -64 : 63); }
static void ch_timbr(track_t *t, uint32_t k) { t->p[P_MAC2] = (int16_t)(k & 1u ? -64 : 63); }
static void ch_motn(track_t *t, uint32_t k) { t->p[P_MAC3] = (int16_t)(k & 1u ? 0 : 127); }
static void ch_space(track_t *t, uint32_t k) { t->p[P_REV] = 60; t->p[P_DLY] = 60; t->p[P_MAC4] = (int16_t)(k & 1u ? 0 : 127); }
static void ch_rtype(track_t *t, uint32_t k) { t->p[P_REV] = 100; song.g[G_RTYPE] = (int16_t)((k + 1u) % 4u); }
static void ch_dmode(track_t *t, uint32_t k) { t->p[P_DLY] = 100; song.g[G_DFDBK] = 90; song.g[G_DMODE] = (int16_t)((k + 1u) % 3u); }
static void ch_mseq(track_t *t, uint32_t k)
{
t->p[P_M1SRC] = MS_SEQ2, t->p[P_M1DST] = MT_CUT, t->p[P_M1AMT] = 40;
@@ -210,6 +218,15 @@ int main(void)
check("HYBRID: the LAYER on and off", ENGI_HYBRID, 1, ch_layer, 6, 40);
trk[1].p[P_LYMODE] = LY_OFF;
check("JUNO: the MOD SEQ (SMTH 60 / 120) on the cutoff", ENGI_JUNO, 0, ch_mseq, 6, 60);
check("ANALOG: SPREAD jumped 0 / 127 (1.0)", 0, 13, ch_spread, 6, 40);
check("ANALOG: BRITE jumped -64 / +63 (1.0)", 0, 13, ch_brite, 6, 40);
check("WAVE: TIMBR jumped -64 / +63 (1.0)", ENGI_WAVE, 2, ch_timbr, 6, 40);
check("ANALOG: MOTN jumped 0 / 127 (1.0)", 0, 13, ch_motn, 6, 40);
check("ANALOG: SPACE jumped 0 / 127 (REV, DLY sends on) (1.0)", 0, 13, ch_space, 6, 40);
check("ANALOG: the reverb's TYPE through ROOM PLATE HALL SHIMMER (1.0)", 0, 13, ch_rtype, 8, 40);
song.g[G_RTYPE] = GP[G_RTYPE].def;
check("ANALOG: the delay's MODE through MONO PING TAPE (1.0)", 0, 13, ch_dmode, 6, 60);
song.g[G_DMODE] = GP[G_DMODE].def, song.g[G_DFDBK] = GP[G_DFDBK].def;
printf("clean: %d cases\n", cases);
printf(fails ? "clean: %d FAILED\n" : "clean: all passed\n", fails);
return fails;
+2 -2
View File
@@ -131,8 +131,8 @@ int main(int argc, char **argv)
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)");
ok(!strcmp(N_MSRC[MS_SEQ1], "SEQ1") && !strcmp(N_MSRC[MS_SEQ4], "SEQ4") && MS_SEQ4 < 16 &&
MS_NSRC <= 32, "MATRIX: SEQ1..SEQ4 among the sources (4 bits in the stores; 1.0: a fifth in the tail)");
}
{ /* JUNO and VECTOR in the browser and the engine list */
uint32_t total, n, juno = 0, vec = 0;
+6 -1
View File
@@ -180,8 +180,13 @@ run "Clipper 0.9: the filter MODELs (SVF MOOG MS20 DIODE SEM NOTCH BP HP: bounde
if $SYN_UB -o "$OUT/synth9_ub" tests/synth9_test.c -lm 2>/dev/null; then
run "Clipper 0.9 under ASan + UBSan" sh -c "'$OUT/synth9_ub' >/dev/null && echo clean"
fi
$SYN -o "$OUT/synth10_test" tests/synth10_test.c -lm
run "Clipper 1.0: SPREAD (left = right at 0, the middle kept), the matrix's 12 slots, LFO 3, ENV 2 LOOP, the MACROS (and CC 16..19), HALL and SHIMMER, the delay's PING and TAPE (a change of MODE: no click), projects and user presets (the tail), the pages" "$OUT/synth10_test"
if $SYN_UB -o "$OUT/synth10_ub" tests/synth10_test.c -lm 2>/dev/null; then
run "Clipper 1.0 under ASan + UBSan" sh -c "'$OUT/synth10_ub' >/dev/null && echo clean"
fi
$SYN -o "$OUT/clean_test" tests/clean_test.c -lm
run "Clipper 0.9 audio: no click or crackle (46 cases: presets of every engine, steals, mute, level, pan, INSERT, DIST, the sends, FILT, MODL, CHOR, VINTAGE, delay TIME, reverb SIZE, EQ, WAVE TABL, FMX PTCH, engine switch, TUNING, LAYER, MOD SEQ)" "$OUT/clean_test"
run "Clipper 1.0 audio: no click or crackle (55 cases: presets of every engine, steals, mute, level, pan, INSERT, DIST, the sends, FILT, MODL, CHOR, VINTAGE, delay TIME and MODE, reverb SIZE and TYPE, EQ, WAVE TABL, FMX PTCH, engine switch, TUNING, LAYER, MOD SEQ, SPREAD, the MACROS)" "$OUT/clean_test"
if $SYN_UB -o "$OUT/clean_ub" tests/clean_test.c -lm 2>/dev/null; then
run "Clipper 0.9 audio under ASan + UBSan" sh -c "'$OUT/clean_ub' >/dev/null && echo clean"
fi
+4
View File
@@ -137,6 +137,10 @@ int main(int argc, char **argv)
}
for (i = 0; i < NROLL; i++)
assert(!roll[i].on); /* every roll ended with its key */
#if CLIPPER_SYNTH
for (b = 0; b < 15u * FS / CTL; b++) /* (1.0: HALL's tail, up to ~10 s) */
mix_block(out, CTL);
#endif
{
int32_t quiet = 0; /* silence (the reverb / delay tails done) */
for (b = 0; b < FS / CTL; b++) {
+9 -3
View File
@@ -3,7 +3,8 @@
/* Clipper 0.7, the voices on both cores (voice.c track_render, vs_finish): every preset of every engine, a chord of
* six notes at six velocities, held then released, rendered with the split (cpu1_units -1) and without (0): the same
* output, bit for bit. Half the cases with a matrix slot moving an EDIT value (the late voices: after the wait; such a
* part stays on this core), the others handed over (ACID: one voice, never).
* part stays on this core), the others handed over (ACID: one voice, never). (1.0) Half with SPREAD (the voices'
* side, rendered on either core), the matrix cases with the macros and LFO 3 in slot 7.
* Run under every mode of the host double of core 1 (tests/cpu1_host.c): CORES=1 (inline at the wait), CORES=2 (a
* thread; with -fsanitize=thread: no race), CHAOS=N (an erratic thread), CPU1_TIMEOUT_AT=K (a lost job: held, its
* voices rendered here, once). Each case in a child process: the same state from power-on for both renders.
@@ -31,7 +32,12 @@ static uint64_t render_case(uint32_t e, uint32_t pi, int matrix, int32_t units,
trk[0].p[P_M1SRC] = MS_LFO1, trk[0].p[P_M1DST] = MT_E1 + 1, trk[0].p[P_M1AMT] = 40;
trk[0].p[P_M2SRC] = MS_VEL, trk[0].p[P_M2DST] = MT_E1 + 4, trk[0].p[P_M2AMT] = -30;
trk[0].p[P_LRATE] = 90;
trk[0].p[P_MAC1] = 30, trk[0].p[P_MAC3] = 90; /* (1.0: the macros, LFO 3, slot 7) */
trk[0].p[P_M7SRC] = MS_LFO3, trk[0].p[P_M7DST] = MT_E1 + 2, trk[0].p[P_M7AMT] = 25;
trk[0].p[P_L3RATE] = 70;
}
if (pi & 2u) /* (1.0) SPREAD: each voice's side, on either core */
trk[0].p[P_SPREAD] = 110;
cpu1_units = units;
for (b = 0; b < 4u; b++)
mix_block(o, CTL);
@@ -92,8 +98,8 @@ int main(int argc, char **argv)
cases++;
if (a != b || !a) {
bad++;
printf("split: %s preset %u (%s)%s: %016llx vs %016llx\n", en->name, pi, en->presets[pi].name,
matrix ? " +matrix" : "", (unsigned long long)a, (unsigned long long)b);
printf("split: %s preset %u (%s)%s%s: %016llx vs %016llx\n", en->name, pi, en->presets[pi].name,
matrix ? " +matrix" : "", (pi & 2u) ? " +spread" : "", (unsigned long long)a, (unsigned long long)b);
}
if (jb && jb != 0xFFFFFFFFu)
handed++, split_cases++;
+28
View File
@@ -142,5 +142,33 @@ int main(void)
!memcmp(back, ff, sizeof ff));
bad += check("0.7 side record: none bigger than its room", st_side_load(OBJ_SETTINGS, got, ST_SIDE_MAX + 1u) < 0);
}
{ /* Clipper 1.0: a tail after the payload (user presets: 3080 B + 472), the payload's length and CRC as before;
* an older save (none) leaves it erased; no tail past the sector */
static uint8_t big[3080], tail[472], back[472], ff[472], gb[3600];
uint32_t i;
for (i = 0; i < sizeof big; i++)
big[i] = (uint8_t)(i * 7u + 3u);
for (i = 0; i < sizeof tail; i++)
tail[i] = (uint8_t)(i * 13u + 1u);
memset(ff, 0xFF, sizeof ff);
st_tail = tail;
st_tail_len = sizeof tail;
bad += check("1.0 tail: saved after the payload (no page wraps)", st_save(OBJ_SETTINGS, big, sizeof big) == 0);
st_tail = 0;
n = st_load(OBJ_SETTINGS, gb, sizeof gb);
bad += check("1.0 tail: the payload as before (length, CRC)", n == (int)sizeof big && !memcmp(gb, big, sizeof big));
bad += check("1.0 tail: read back as written",
st_tail_load(OBJ_SETTINGS, back, sizeof back) == 0 && !memcmp(back, tail, sizeof tail));
bad += check("1.0 tail: an older save (none) leaves it erased",
st_save(OBJ_SETTINGS, big, sizeof big) == 0 && st_tail_load(OBJ_SETTINGS, back, sizeof back) == 0 &&
!memcmp(back, ff, sizeof ff));
bad += check("1.0 tail: none past the sector", st_tail_load(OBJ_SETTINGS, back, ST_PAYLOAD_MAX) < 0);
st_tail = tail;
st_tail_len = sizeof tail;
memcpy(gb, big, sizeof big);
bad += check("1.0 tail: a payload too big for it: saved without", st_save(OBJ_SETTINGS, gb, 3500) == 0 &&
st_load(OBJ_SETTINGS, gb, sizeof gb) == 3500 && st_tail_load(OBJ_SETTINGS, back, sizeof back) < 0);
st_tail = 0;
}
return bad != 0;
}
+674
View File
@@ -0,0 +1,674 @@
/* SPDX-License-Identifier: GPL-3.0-only
* Copyright (C) 2026 3dSam (Clipper) */
/* Clipper 1.0 (CLIPPER_SYNTH 1): SPREAD, the matrix's 12 slots, LFO 3, ENV 2 LOOP, the MACROS, HALL and SHIMMER,
* the delay's PING and TAPE, and where they are kept.
* SPREAD 0: left = right, bit for bit; up: the voices apart (left != right), the middle ((L + R) / 2) as at 0
* MATRIX slots 7..12 move the sound; an AMT of 0 there: bit for bit as no slot; the sources LFO 3 and MAC1..4
* LFO 3 in a slot to the level: the level swings (FREE), and from each note's start (KEY)
* ENV 2 LOOP: past its sustain the attack again (the level keeps moving); ONE: it settles
* MACROS BRITE brighter / darker, TIMBR moves the shape, MOTN a vibrato, SPACE more reverb; CC 16..19 (every
* engine but HYBRID, whose own four they stay)
* REVERB ROOM, PLATE, HALL, SHIMMER: bounded, dying away; HALL longer than PLATE; SHIMMER an octave up in its tail
* DELAY PING: the first echo left (TIME), the second right (2 x TIME); TAPE: bounded at full feedback, its echoes
* swung (not MONO's); a change of MODE under a sounding line: no click
* STORE projects (every 1.0 value of both sounds, the delay's MODE; with track 3's steps there: their defaults, the
* steps' nudges kept; a 0.9 project: the defaults); user presets (every value back, the sources 16..19 of
* slots 1..6 by their fifth bit; the record SLOOP reads the same with or without the 1.0 values; no tail:
* the defaults)
* PAGES VOICE 3, LFO 3, ENV 2 LOOP, MACROS, DLY 2, the matrix's slots 7..12
* FIX the JUNO chorus on a loud chord (8 voices at 127): no crack */
#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("synth10: %-96s %s\n", what, c ? "ok" : "FAIL");
fails += !c;
}
#define NCAP (4096u * 24u)
static int32_t cl[NCAP], cr[NCAP];
static uint32_t ncap;
static uint64_t hash;
static void run(uint32_t nb)
{
static int32_t o[CTL * 2];
uint32_t b, i;
ncap = 0;
hash = 1469598103934665603ull;
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];
}
hash = (hash ^ (uint32_t)o[2 * i]) * 1099511628211ull;
hash = (hash ^ (uint32_t)o[2 * i + 1]) * 1099511628211ull;
}
}
}
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)
{
uint32_t k;
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_VINT] = 0, t->p[P_FMODEL] = FM_SVF;
t->p[P_ITYPE] = 0, t->p[P_IMIX] = 127;
for (k = 0; k < MX_SLOTS; k++)
t->p[mx_pid(k) + 2u] = 0;
for (k = P_SPREAD; k < P_E0; k++)
t->p[k] = TP[k].def;
}
static double rms_of(const int32_t *x, uint32_t a, uint32_t n)
{
double e = 0;
uint32_t i;
for (i = a; i < a + n && i < ncap; i++)
e += (double)x[i] * x[i];
return sqrt(e / n);
}
static double rms(uint32_t a, uint32_t n) { return rms_of(cl, a, n); }
static double drms(uint32_t a, uint32_t n) /* the first difference's: the top end */
{
double e = 0;
uint32_t i;
for (i = a + 1u; i < a + n && i < ncap; i++)
e += (double)(cl[i] - cl[i - 1]) * (cl[i] - cl[i - 1]);
return sqrt(e / n);
}
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;
}
/* the block levels' largest / smallest over [a, a + n) (blocks of 512): how much the level swings */
static double swing(uint32_t a, uint32_t n)
{
double mx = 0, mn = 1e30;
uint32_t b;
for (b = a; b + 512u <= a + n; b += 512u) {
double r = rms(b, 512);
mx = r > mx ? r : mx;
mn = r < mn ? r : mn;
}
return mx / (mn + 1.0);
}
static const uint8_t CH[4] = {48, 55, 60, 64};
static void chord(track_t *t)
{
uint32_t i;
for (i = 0; i < 4u; i++)
trk_note_on(t, CH[i], 100);
}
static void t_spread(void)
{
track_t *t = &trk[0];
static int32_t ml[NCAP];
double m0, mid, side;
uint32_t i, same = 1, apart = 0;
quiet();
plain(t, 0, 0);
chord(t);
run(80);
for (i = 0; i < ncap; i++) {
same &= cl[i] == cr[i];
ml[i] = cl[i];
}
ok(same, "SPREAD 0: left = right, bit for bit");
m0 = rms_of(ml, 2048, ncap - 2048);
quiet();
plain(t, 0, 0);
t->p[P_SPREAD] = 127;
chord(t);
run(80);
{
double e = 0, s = 0;
for (i = 2048; i < ncap; i++) {
double mm = 0.5 * ((double)cl[i] + cr[i]), d = 0.5 * ((double)cl[i] - cr[i]);
e += mm * mm, s += d * d;
apart += cl[i] != cr[i];
}
mid = sqrt(e / (ncap - 2048)), side = sqrt(s / (ncap - 2048));
}
printf("synth10: SPREAD: mid %.0f (at 0: %.0f), side %.0f\n", mid, m0, side);
ok(apart > (ncap - 2048) / 2u && side > 0.15 * mid && bounded(), "SPREAD 127: the voices apart (left != right)");
ok(fabs(20 * log10(mid / m0)) < 1.0, "SPREAD 127: the middle as at 0 (within 1 dB)");
{ /* SPREAD down again: the side gone, no jump */
t->p[P_SPREAD] = 0;
run(600); /* (the master's per-channel state settling) */
run(20);
same = 1;
for (i = 0; i < ncap; i++)
same &= abs(cl[i] - cr[i]) <= 2;
{
int32_t mx = 0;
uint32_t first = ncap;
for (i = 0; i < ncap; i++) {
int32_t d = abs(cl[i] - cr[i]);
if (d && first == ncap)
first = i;
mx = d > mx ? d : mx;
}
printf("synth10: SPREAD back to 0: largest |L - R| %d, from sample %u\n", mx, first);
}
ok(same, "SPREAD back to 0: left = right again (the master's state settled: within 2 of 2^23)");
}
trk_all_off(t);
}
static void t_matrix(void)
{
track_t *t = &trk[0];
static track_t save;
static int32_t ref[CTL * 96], out[CTL * 96];
uint32_t k, i, moved = 1, zero = 1, rs;
quiet();
plain(t, 0, 0);
t->p[P_LRATE] = 100;
trk_note_on(t, 57, 100), run(2);
save = *t, rs = rng_state; /* (the part rendered from the same state each time) */
for (i = 0; i < 96u; i++)
track_render(t, ref + i * CTL, CTL);
for (k = MX_SLOTS6; k < MX_SLOTS; k++) {
uint32_t id = mx_pid(k), a, same = 1;
for (a = 0; a < 2u; a++) {
*t = save, rng_state = rs;
t->p[id] = MS_LFO1, t->p[id + 1u] = MT_PITCH, t->p[id + 2u] = (int16_t)(a ? 50 : 0);
for (i = 0; i < 96u; i++)
track_render(t, out + i * CTL, CTL);
same = 1;
for (i = 0; i < CTL * 96u; i++)
same &= out[i] == ref[i];
if (a)
moved &= !same;
else
zero &= same;
}
}
*t = save, rng_state = rs;
ok(zero, "MATRIX: slots 7..12 at AMT 0: bit for bit as no slot");
ok(moved, "MATRIX: slots 7..12 move the sound (LFO 1 > PITCH)");
ok(MX_SLOTS == 12u && MS_NSRC == 20u && !strcmp(N_MSRC[MS_LFO3], "LFO3") && !strcmp(N_MSRC[MS_MAC4], "MAC4"),
"MATRIX: 12 slots; LFO 3 and MAC1..4 among the sources");
{ /* a macro as a source: MAC3 > AMP, its level follows the knob */
double lo, hi;
quiet();
plain(t, 0, 0);
t->p[P_M12SRC] = MS_MAC3, t->p[P_M12DST] = MT_AMP, t->p[P_M12AMT] = -63;
t->p[P_MAC3] = 0;
trk_note_on(t, 57, 100);
run(60);
lo = rms(1024, ncap - 1024);
t->p[P_MAC3] = 0; /* (MOTN's own vibrato aside: MAC3 0 vs 127 under AMT) */
quiet();
plain(t, 0, 0);
t->p[P_M12SRC] = MS_MAC3, t->p[P_M12DST] = MT_AMP, t->p[P_M12AMT] = -63;
t->p[P_MAC3] = 127;
trk_note_on(t, 57, 100);
run(60);
hi = rms(1024, ncap - 1024);
printf("synth10: MAC3 > AMP -63: %.0f at 0, %.0f at 127\n", lo, hi);
ok(hi < 0.7 * lo, "MATRIX: MAC3 in slot 12 (to AMP, -63): the level down as the knob goes up");
}
trk_all_off(t);
}
static void t_lfo3_env2(void)
{
track_t *t = &trk[0];
double s0, s1, s2;
quiet();
plain(t, 0, 0);
t->p[P_M7SRC] = MS_LFO3, t->p[P_M7DST] = MT_AMP, t->p[P_M7AMT] = 0, t->p[P_L3RATE] = 90;
trk_note_on(t, 57, 100);
run(2500);
s0 = swing(4096, ncap - 4096);
quiet();
plain(t, 0, 0);
t->p[P_M7SRC] = MS_LFO3, t->p[P_M7DST] = MT_AMP, t->p[P_M7AMT] = 63, t->p[P_L3RATE] = 90;
trk_note_on(t, 57, 100);
run(2500);
s1 = swing(4096, ncap - 4096);
quiet();
plain(t, 0, 0);
t->p[P_M7SRC] = MS_LFO3, t->p[P_M7DST] = MT_AMP, t->p[P_M7AMT] = 63, t->p[P_L3RATE] = 90, t->p[P_L3MODE] = L2_KEY;
trk_note_on(t, 57, 100);
run(2500);
s2 = swing(4096, ncap - 4096);
printf("synth10: LFO 3 > AMP: swing %.2f (AMT 0), %.2f (FREE), %.2f (KEY)\n", s0, s1, s2);
ok(s0 < 1.15 && s1 > 1.6 && s2 > 1.6 && bounded(), "LFO 3: in slot 7 to AMP the level swings (FREE and KEY)");
{ /* ENV 2 LOOP: ENV 2 > AMP (-63: the level dips as it rises), an attack and a decay to a low sustain */
double one, loop;
uint32_t lp;
for (lp = 0; lp < 2u; lp++) {
quiet();
plain(t, 0, 0);
t->p[P_E2ATK] = 50, t->p[P_E2DEC] = 60, t->p[P_E2SUS] = 10, t->p[P_E2REL] = 30, t->p[P_E2LOOP] = (int16_t)lp;
t->p[P_M8SRC] = MS_ENV2, t->p[P_M8DST] = MT_AMP, t->p[P_M8AMT] = -63;
trk_note_on(t, 57, 100);
run(3000);
if (lp)
loop = swing(ncap / 2u, ncap / 2u);
else
one = swing(ncap / 2u, ncap / 2u);
}
printf("synth10: ENV 2 > AMP, second half: swing %.2f (ONE), %.2f (LOOP)\n", one, loop);
ok(one < 1.15 && loop > 1.5 && bounded(), "ENV 2 LOOP: the level keeps moving (ONE: it settles)");
}
trk_all_off(t);
}
static void t_macros(void)
{
track_t *t = &trk[0];
double dark, bright, r0, r1;
uint64_t h0;
quiet();
plain(t, 0, 0);
t->p[P_E4] = 60;
t->p[P_MAC1] = -64;
chord(t);
run(80);
dark = drms(2048, ncap - 2048) / (rms(2048, ncap - 2048) + 1);
quiet();
plain(t, 0, 0);
t->p[P_E4] = 60;
t->p[P_MAC1] = 63;
chord(t);
run(80);
bright = drms(2048, ncap - 2048) / (rms(2048, ncap - 2048) + 1);
printf("synth10: BRITE: top end %.3f (-64), %.3f (+63)\n", dark, bright);
ok(bright > 1.5 * dark && bounded(), "MACROS: BRITE +63 brighter than -64");
quiet();
plain(t, 0, 0);
chord(t);
run(60);
h0 = hash;
quiet();
plain(t, 0, 0);
t->p[P_MAC2] = 50;
chord(t);
run(60);
ok(hash != h0 && bounded(), "MACROS: TIMBR moves the sound");
quiet();
plain(t, 0, 0);
t->p[P_MAC3] = 127;
chord(t);
run(60);
ok(hash != h0 && bounded(), "MACROS: MOTN moves the sound (vibrato, LFO 3 on the cutoff)");
{ /* SPACE: the reverb send up: more tail after the notes */
uint32_t s;
double tail[2];
for (s = 0; s < 2u; s++) {
quiet();
plain(t, 0, 0);
t->p[P_REV] = 20, t->p[P_MAC4] = (int16_t)(s ? 127 : 0);
song.g[G_RTYPE] = RT_PLATE, song.g[G_RSIZE] = 90;
chord(t);
run(40);
trk_all_off(t);
run(60);
tail[s] = rms(1024, 40u * CTL);
(void)r0, (void)r1;
}
printf("synth10: SPACE: tail %.0f (0), %.0f (127)\n", tail[0], tail[1]);
ok(tail[1] > 2.0 * tail[0], "MACROS: SPACE 127: more reverb in the tail");
}
{ /* CC 16..19 */
track_t *h = &trk[0];
t = &trk[1];
int16_t e4 = h->p[P_E4];
t->eng_req = 0;
part_ctl_cc(t, 16, 127), part_ctl_cc(t, 17, 0), part_ctl_cc(t, 18, 90), part_ctl_cc(t, 19, 5);
ok(t->p[P_MAC1] == 63 && t->p[P_MAC2] == -64 && t->p[P_MAC3] == 90 && t->p[P_MAC4] == 5,
"MACROS: CC 16..19 turn them (BRITE TIMBR centred at 64)");
h->eng_req = ENGI_HYBRID;
h->p[P_MAC1] = 0;
part_ctl_cc(h, 16, 100);
ok(h->p[P_E4] == 100 && h->p[P_MAC1] == 0, "MACROS: HYBRID's CC 16..19 its own four, as before");
h->p[P_E4] = e4;
t = h;
}
trk_all_off(t);
}
/* the buses alone: an input into one send, the wet out */
#define FXN (FS * 7u)
static int32_t wl[FXN], wr[FXN];
static void fx_run(uint32_t nblk, const int32_t *din, const int32_t *rin, uint32_t at)
{
static int32_t z[CTL], d[CTL], r[CTL];
uint32_t b, i;
for (b = 0; b < nblk; b++) {
for (i = 0; i < CTL; i++) {
uint32_t s = b * CTL + i;
d[i] = din && s >= at && s - at < FXN ? din[s - at] : 0;
r[i] = rin && s >= at && s - at < FXN ? rin[s - at] : 0;
}
fx_buses(z, d, r, wl + b * CTL, wr + b * CTL, CTL);
}
}
static double erg(const int32_t *x, uint32_t a, uint32_t n)
{
double e = 0;
uint32_t i;
for (i = a; i < a + n; i++)
e += (double)x[i] * x[i];
return e / n;
}
static double goertzel(const int32_t *x, uint32_t a, uint32_t n, double f)
{
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);
re += x[a + i] * w * cos(2 * M_PI * f * i / FS);
im += x[a + i] * w * sin(2 * M_PI * f * i / FS);
}
return sqrt(re * re + im * im) / n;
}
static int32_t inb[FXN];
static void t_reverb(void)
{
static const char *const NM[4] = {"ROOM", "PLATE", "HALL", "SHIMMER"};
double late[4], oct[4];
uint32_t ty, i, good = 1;
song.g[G_DMIX] = 0, song.g[G_DFDBK] = 0, song.g[G_CDEPTH] = 0;
song.g[G_RSIZE] = 90, song.g[G_RDAMP] = 30, song.g[G_RPRE] = 10;
memset(inb, 0, sizeof inb);
for (i = 0; i < FS / 5u; i++) /* a 440 Hz burst, 0.2 s */
inb[i] = (int32_t)(12000.0 * sin(2 * M_PI * 440.0 * i / FS) * (i < 200u ? i / 200.0 : 1.0));
for (ty = RT_ROOM; ty <= RT_SHIMMER; ty++) {
uint32_t b0 = FS / CTL, nb = FXN / CTL;
double e1, e3;
song.g[G_RTYPE] = (int16_t)ty;
fx_run(b0, 0, 0, 0); /* (a change of family: its fade, then silence) */
fx_run(nb, 0, inb, 0);
for (i = 0; i < nb * CTL; i++)
good &= wl[i] < (1 << 23) && wl[i] > -(1 << 23) && wr[i] < (1 << 23) && wr[i] > -(1 << 23);
e1 = erg(wl, FS / 2u, FS / 2u);
e3 = erg(wl, FS * 3u, FS / 2u);
late[ty] = 10 * log10((e3 + 1) / (e1 + 1));
oct[ty] = goertzel(wl, FS * 2u, 8192, 880.0) / (goertzel(wl, FS * 2u, 8192, 440.0) + 1e-9);
printf("synth10: %-8s 3 s vs 0.5 s: %6.1f dB; at 2 s, 880 / 440 Hz: %.3f\n", NM[ty], late[ty], oct[ty]);
good &= late[ty] < -3.0;
}
ok(good, "REVERB: ROOM PLATE HALL SHIMMER bounded, dying away");
ok(late[RT_HALL] > late[RT_PLATE] + 3.0, "REVERB: HALL's tail longer than PLATE's (the same SIZE)");
ok(oct[RT_SHIMMER] > 3.0 * oct[RT_HALL] && oct[RT_SHIMMER] > 0.1, "REVERB: SHIMMER an octave up in its tail");
{ /* the worst case: SIZE 127, DAMP 0 (SHIMMER: the octave line must not keep the tank going) */
uint32_t nb = FXN / CTL;
good = 1;
song.g[G_RSIZE] = 127, song.g[G_RDAMP] = 0, song.g[G_RPRE] = 0;
for (ty = RT_HALL; ty <= RT_SHIMMER; ty++) {
double e2, e6;
song.g[G_RTYPE] = (int16_t)ty;
fx_run(FS / CTL, 0, 0, 0);
fx_run(nb, 0, inb, 0);
e2 = erg(wl, FS * 2u, FS), e6 = erg(wl, FS * 6u, FS - CTL);
printf("synth10: %-8s SIZE 127 DAMP 0: 6 s vs 2 s %6.1f dB\n", NM[ty], 10 * log10((e6 + 1) / (e2 + 1)));
good &= e6 < 0.1 * e2;
}
ok(good, "REVERB: HALL and SHIMMER at SIZE 127, DAMP 0: still dying away (no runaway)");
song.g[G_RSIZE] = 90, song.g[G_RDAMP] = 30;
}
song.g[G_RTYPE] = RT_PLATE;
fx_run(FS / CTL, 0, 0, 0);
}
static uint32_t peak_at(const int32_t *x, uint32_t a, uint32_t n)
{
uint32_t i, at = a;
int32_t m = -1;
for (i = a; i < a + n; i++)
if ((x[i] < 0 ? -x[i] : x[i]) > m)
m = x[i] < 0 ? -x[i] : x[i], at = i;
return at;
}
static void t_delay(void)
{
uint32_t dl, nb = FXN / CTL, i;
song.g[G_RTYPE] = RT_PLATE;
song.g[G_BPM] = 120, song.g[G_DTIME] = 1, song.g[G_DMIX] = 127, song.g[G_DFDBK] = 0, song.g[G_DCOLOR] = 127;
dl = delay_samples();
memset(inb, 0, sizeof inb);
inb[0] = inb[1] = 20000;
song.g[G_DMODE] = DM_PING;
fx_run(FS / CTL, 0, 0, 0);
fx_run(nb / 2u, inb, 0, 0);
{
uint32_t l1 = peak_at(wl, dl / 2u, dl), r1 = peak_at(wr, dl + dl / 2u, dl);
double el = erg(wl, l1 - 8u, 16), er = erg(wr, l1 - 8u, 16), el2 = erg(wl, r1 - 8u, 16);
printf("synth10: PING: TIME %u: left's echo at %u, right's at %u\n", dl, l1, r1);
ok(l1 + 4u >= dl && l1 <= dl + 4u && r1 + 4u >= 2u * dl && r1 <= 2u * dl + 4u && er < 0.01 * el && el2 < 0.01 * el,
"DELAY: PING: the first echo left at TIME, the second right at 2 x TIME");
}
{ /* TAPE at full feedback: bounded; its echoes swung, not MONO's */
static int32_t mono[FXN];
uint32_t m, good = 1, diff = 0;
for (i = 0; i < FXN; i++)
inb[i] = i < FS / 4u ? (int32_t)(15000.0 * sin(2 * M_PI * 660.0 * i / FS)) : 0;
for (m = DM_MONO; m <= DM_TAPE; m += DM_TAPE) {
song.g[G_DMODE] = (int16_t)m, song.g[G_DFDBK] = 127;
fx_run(2u * FS / CTL, 0, 0, 0);
fx_run(nb, inb, 0, 0);
for (i = 0; i < nb * CTL; i++) {
good &= wl[i] < (1 << 22) && wl[i] > -(1 << 22);
if (m == DM_MONO)
mono[i] = wl[i];
else
diff += abs(wl[i] - mono[i]) > 200;
}
}
ok(good && diff > FS / 2u, "DELAY: TAPE: bounded at full feedback, its echoes swung (not MONO's)");
}
{ /* a change of MODE under a sounding line: no click */
int32_t dmax = 0, dsw = 0;
song.g[G_DFDBK] = 100, song.g[G_DMODE] = DM_MONO;
for (i = 0; i < FXN; i++)
inb[i] = (int32_t)(12000.0 * sin(2 * M_PI * 220.0 * i / FS));
fx_run(FS / CTL, inb, 0, 0);
for (i = delay_samples() + 2000u; i < FS; i++) { /* (past the echo's onset) */
int32_t d = wl[i] - 2 * wl[i - 1] + wl[i - 2];
d = d < 0 ? -d : d;
dmax = d > dmax ? d : dmax;
}
song.g[G_DMODE] = DM_PING;
fx_run(FS / 4u / CTL, inb + FS, 0, 0);
for (i = 2; i < FS / 4u - FS / 4u % CTL; i++) {
int32_t d = wl[i] - 2 * wl[i - 1] + wl[i - 2];
d = d < 0 ? -d : d;
dsw = d > dsw ? d : dsw;
}
printf("synth10: MODE change: largest 2nd difference %d (steady %d)\n", dsw, dmax);
ok(dsw < 3 * dmax + 200, "DELAY: MONO to PING under a sounding line: no click");
}
song.g[G_DMODE] = DM_MONO, song.g[G_DMIX] = 0, song.g[G_DFDBK] = 0;
fx_run(3u * FS / CTL, 0, 0, 0);
}
/* (1.0, a fix) the JUNO chorus on a loud chord: its products wrapped round past 2^16 (a crack at a chord change) */
static void t_juno_loud(void)
{
static const uint8_t c1[8] = {45, 52, 57, 60, 64, 67, 69, 72}, c2[8] = {41, 48, 53, 57, 60, 65, 69, 72};
int32_t worst[2], pk = 0;
uint32_t ch, i;
for (ch = 0; ch < 2u; ch++) {
track_t *t = &trk[0];
int32_t w = 0;
quiet();
for (i = 0; i < P_E0; i++)
t->p[i] = TP[i].def;
host_preset(t, ENGI_JUNO, 0); /* (JUNO 106 PAD: CHOR I) */
t->p[P_REV] = 0, t->p[P_DLY] = 0, t->p[P_ATK] = 0, t->p[P_SUS] = 127;
if (!ch)
t->p[P_E7] = 0;
for (i = 0; i < 8u; i++)
trk_note_on(t, c1[i], 127);
run(1400);
for (i = 0; i < 8u; i++)
trk_note_off(t, c1[i]), trk_note_on(t, c2[i], 127);
run(2800);
for (i = 2; i < ncap; i++) {
int32_t d = abs(cl[i] - 2 * cl[i - 1] + cl[i - 2]);
w = d > w ? d : w;
pk = abs(cl[i]) > pk ? abs(cl[i]) : pk;
}
worst[ch] = w;
trk_all_off(t);
}
printf("synth10: JUNO 106 PAD, 8 voices at 127, a chord change: largest 2nd difference %d (CHOR OFF: %d), peak %d\n",
worst[1], worst[0], pk);
ok(worst[1] < 2 * worst[0] + 400, "JUNO chorus: a loud chord changed: no crack (its products in 64 bits)");
}
static project_t pj;
static void t_store(void)
{
track_t *a = &trk[0], *b = &trk[1];
int16_t va[P_COUNT], vb[P_COUNT];
uint32_t i, k, same = 1, dflt = 1;
quiet();
for (i = 0; i < NSTEP; i++)
trk[2].step[i].n = 0;
for (i = P_SPREAD; i < P_E0; i++) {
const param_desc_t *d = &TP[i];
a->p[i] = va[i] = (int16_t)(d->min + (int32_t)(i * 7u + 3u) % (d->max - d->min + 1));
b->p[i] = vb[i] = (int16_t)(d->min + (int32_t)(i * 5u + 1u) % (d->max - d->min + 1));
}
song.g[G_DMODE] = DM_TAPE;
proj_capture(&pj);
for (i = P_SPREAD; i < P_E0; i++)
a->p[i] = b->p[i] = TP[i].def;
song.g[G_DMODE] = DM_MONO;
proj_apply(&pj, 1);
for (i = P_SPREAD; i < P_E0; i++)
same &= a->p[i] == va[i] && b->p[i] == vb[i];
for (i = 0; i < NSTEP; i++)
same &= trk[2].micro[i] == 0;
ok(same && song.g[G_DMODE] == DM_TAPE && sizeof pj == 3840u,
"project: every 1.0 value of both sounds and the delay's MODE kept (track 3's nudges: none), the size unchanged");
trk[2].step[5].n = 1, trk[2].step[5].note[0] = 60, trk[2].micro[5] = -7;
proj_capture(&pj);
proj_apply(&pj, 1);
for (i = P_SPREAD; i < P_E0; i++)
dflt &= a->p[i] == TP[i].def && b->p[i] == TP[i].def;
ok(dflt && trk[2].micro[5] == -7 && trk[2].step[5].n == 1 && song.g[G_DMODE] == DM_MONO,
"project: track 3 with steps: its nudges kept, the 1.0 values at their defaults");
trk[2].step[5].n = 0, trk[2].micro[5] = 0;
proj_capture(&pj);
memset(pj.t[2].micro, 0, sizeof pj.t[2].micro); /* (as 0.9 wrote it) */
for (i = P_SPREAD; i < P_E0; i++)
a->p[i] = va[i];
proj_apply(&pj, 1);
dflt = 1;
for (i = P_SPREAD; i < P_E0; i++)
dflt &= a->p[i] == TP[i].def;
ok(dflt, "project: a 0.9 project: the 1.0 values at their defaults");
{ /* user presets */
up_rec_t r, r2;
int16_t v[P_COUNT], v2[P_COUNT], out[P_COUNT], def[P_COUNT];
uint32_t good = 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));
for (k = 0; k < MX_SLOTS; k++) /* (the new sources, in slots 1..6 and 7..12) */
v[mx_pid(k)] = (int16_t)(k % 2u ? MS_LFO3 + k % 5u : k % 3u);
memset(&r, 0, sizeof r);
r.used = UP_USED, r.ver = UP_VER, r.name[0] = 'T';
up_rec_set(&r, v);
up_params(&r, out, def);
for (i = 0; i < P_COUNT; i++)
good &= out[i] == v[i];
ok(good && r.np == 61u && sizeof r == 192u, "user presets: every value back, LFO 3 and the macros as sources in all 12 slots");
memcpy(v2, v, sizeof v2);
for (i = P_SPREAD; i < P_E0; i++)
v2[i] = TP[i].def;
for (k = 0; k < MX_SLOTS6; k++)
v2[mx_pid(k)] &= 15;
memset(&r2, 0, sizeof r2);
r2.used = UP_USED, r2.ver = UP_VER, r2.name[0] = 'T';
up_rec_set(&r2, v2);
ok(!memcmp(&r, &r2, sizeof r), "user presets: the record SLOOP reads the same with or without the 1.0 values");
up_rec_set(&r, v);
up_xt[0] = 0; /* (no tail: an older save) */
up_params(&r, out, def);
good = 1;
for (i = P_SPREAD; i < P_E0; i++)
good &= out[i] == def[i];
for (k = 0; k < MX_SLOTS6; k++)
good &= out[mx_pid(k)] == (v[mx_pid(k)] & 15);
ok(good, "user presets: no tail: the 1.0 values at their defaults, the sources' four bits");
}
}
static int has_page(const char *t, uint32_t id)
{
uint32_t i, k;
for (i = 0; i < NELEM(PAGES); i++)
if (!strcmp(PAGES[i].title, t)) {
for (k = 0; k < 4u; k++)
if (PAGES[i].id[k] == id)
return 1;
}
return 0;
}
static void t_pages(void)
{
ok(has_page("VOICE 3", P_SPREAD) && has_page("LFO 3", P_L3RATE) && has_page("LFO 3", P_L3MODE) &&
has_page("ENV 2 LOOP", P_E2LOOP) && has_page("MACROS", P_MAC1) && has_page("MACROS", P_MAC4) &&
has_page("DLY 2", G_DMODE),
"PAGES: VOICE 3 (SPREAD), LFO 3, ENV 2 LOOP, MACROS, DLY 2 (MODE)");
ok(!strcmp(TP[P_MAC1].label, "BRITE") && !strcmp(TP[P_MAC4].label, "SPACE") && !strcmp(GP[G_DMODE].label, "MODE") &&
!strcmp(TP[P_SPREAD].label, "SPRED"), "PAGES: the names (BRITE .. SPACE, SPRED, MODE)");
}
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_spread();
t_matrix();
t_lfo3_env2();
t_macros();
t_reverb();
t_delay();
t_juno_loud();
t_store();
t_pages();
printf(fails ? "synth10: %d FAILED\n" : "synth10: all passed\n", fails);
return fails;
}
+2 -2
View File
@@ -518,7 +518,7 @@ static void t_pages4(void)
uint32_t k;
ok(page_idx("LFO 2") >= 0 && page_idx("ENV 2") >= 0 && page_idx("MATRIX") >= 0, "0.4: the pages LFO 2, ENV 2, MATRIX");
for (k = 0; k < MX_SLOTS; k++)
t->p[P_M1SRC + 3u * k] = MS_OFF, t->p[P_M1DST + 3u * k] = MT_OFF, t->p[P_M1AMT + 3u * k] = 0;
t->p[mx_pid(k)] = MS_OFF, t->p[mx_pid(k) + 1u] = MT_OFF, t->p[mx_pid(k) + 2u] = 0;
go_page("MATRIX");
knob(1, 2), knob(2, 2), knob(3, 30);
snprintf(w, sizeof w, "MATRIX: slot 1 turned to LFO2 > CUT +30 (%d %d %d)", t->p[P_M1SRC], t->p[P_M1DST], t->p[P_M1AMT]);
@@ -539,7 +539,7 @@ static void t_pages4(void)
ok(t->p[P_E2SUS] > 0, w);
ppm("synth4-env2");
for (k = 0; k < MX_SLOTS; k++)
t->p[P_M1SRC + 3u * k] = MS_OFF, t->p[P_M1DST + 3u * k] = MT_OFF, t->p[P_M1AMT + 3u * k] = 0;
t->p[mx_pid(k)] = MS_OFF, t->p[mx_pid(k) + 1u] = MT_OFF, t->p[mx_pid(k) + 2u] = 0;
t->p[P_L2MODE] = L2_FREE;
mpe_mode = 4;
k = lights_word();
+12 -6
View File
@@ -98,11 +98,11 @@ static void slots_off(track_t *t)
{
uint32_t k;
for (k = 0; k < MX_SLOTS; k++)
t->p[P_M1SRC + 3u * k] = MS_OFF, t->p[P_M1DST + 3u * k] = MT_OFF, t->p[P_M1AMT + 3u * k] = 0;
t->p[mx_pid(k)] = MS_OFF, t->p[mx_pid(k) + 1u] = MT_OFF, t->p[mx_pid(k) + 2u] = 0;
}
static void slot(track_t *t, uint32_t k, uint32_t src, uint32_t dst, int32_t amt)
{
t->p[P_M1SRC + 3u * k] = (int16_t)src, t->p[P_M1DST + 3u * k] = (int16_t)dst, t->p[P_M1AMT + 3u * k] = (int16_t)amt;
t->p[mx_pid(k)] = (int16_t)src, t->p[mx_pid(k) + 1u] = (int16_t)dst, t->p[mx_pid(k) + 2u] = (int16_t)amt;
}
/* ANALOG, plain: a saw (E0 0) or a sine (3) through the filter at cut, no effects, no modulation, full sustain */
static void analog(uint32_t wave, int32_t cut)
@@ -365,6 +365,12 @@ static int16_t xval(uint32_t j, uint32_t k)
const param_desc_t *d = &TP[PROJ_E0 + k];
return (int16_t)(d->min + (int32_t)(k * (j ? 5u : 7u) + (j ? 1u : 3u)) % (d->max - d->min + 1));
}
static int16_t xv04(uint32_t j, uint32_t k) /* (0.4's: its sources were 0..15) */
{
uint32_t f;
int16_t v = xval(j, k);
return (int16_t)(mx_slot_of(PROJ_E0 + k, &f) >= 0 && f == 0u ? v & 15 : v);
}
static void t_project(void)
{
track_t *a = &trk[0], *b = &trk[1];
@@ -414,7 +420,7 @@ static void t_project(void)
{ /* the first 0.4 build's projects (0xC4: in tracks 3 and 4's p[]) */
proj_capture(&pj);
pj.rsv[0] = CLIPPER_PROJ_MARK_04;
for (k = 0; k < PROJ_NX; k++)
for (k = 0; k < P_ITYPE - PROJ_E0; k++) /* (0.4's 25: LFO 2, ENV 2, the matrix) */
pj.t[2].p[k] = xval(1, k), pj.t[3].p[k] = xval(0, k); /* (swapped: tell them apart) */
proj_apply(&pj, 1);
for (k = 0, same = 1; k < PROJ_NX; k++) /* (0.6's INSERT: not in them, at its defaults) */
@@ -424,7 +430,7 @@ static void t_project(void)
}
proj_capture(&pj);
pj.rsv[0] = 0xC3; /* as Clipper 0.3 wrote it: tracks 3 and 4 its own values */
for (k = 0; k < PROJ_NX; k++)
for (k = 0; k < NELEM(pj.t[2].p); k++) /* (1.0: PROJ_NX passed the record's 61) */
pj.t[2].p[k] = TP[k].max, pj.t[3].p[k] = TP[k].min;
proj_apply(&pj, 1);
for (k = 0, same = 1; k < PROJ_NX; k++)
@@ -537,7 +543,7 @@ static void t_userbank(void)
o[0] = k % 3u ? UP_USED : 0u, o[1] = UP_VER, o[2] = (uint8_t)(k % NENGINES), o[3] = 86u; /* (0.4: P_COUNT 86, */
snprintf((char *)o + 4, 12, "OLD %u", k); /* P_E0 78) */
for (i = 0; i < 86u; i++)
p[i] = (int16_t)(i < PROJ_E0 ? k * 100u + i : i < 78u ? xval(k & 1u, i - PROJ_E0) : k * 100u + i - 78u + P_E0);
p[i] = (int16_t)(i < PROJ_E0 ? k * 100u + i : i < 78u ? xv04(k & 1u, i - PROJ_E0) : k * 100u + i - 78u + P_E0);
memcpy(o + 16, p, sizeof p);
for (i = 0; i < 16u; i++)
o[16 + 184 + i] = (uint8_t)(40u + k + i), o[32 + 184 + i] = (uint8_t)(i & 7u);
@@ -551,7 +557,7 @@ static void t_userbank(void)
good &= up_valid(r) && r->np == 61 && r->engine == k % NENGINES && r->note[5] == 45u + k && r->flags[7] == 7u;
up_params(r, out, def);
for (i = 0; i < P_COUNT; i++)
good &= out[i] == (int16_t)(i < PROJ_E0 ? k * 100u + i : i < P_ITYPE ? xval(k & 1u, i - PROJ_E0) :
good &= out[i] == (int16_t)(i < PROJ_E0 ? k * 100u + i : i < P_ITYPE ? xv04(k & 1u, i - PROJ_E0) :
i < P_E0 ? TP[i].def : k * 100u + i);
{
char nm[13];
+1
View File
@@ -66,6 +66,7 @@ static void plain(track_t *t, uint32_t eng, uint32_t pi)
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_SPREAD] = 0; /* (1.0: the pads come with some) */
t->p[P_AMODE] = 0;
t->p[P_ITYPE] = 0, t->p[P_IMIX] = 127;
}
+1
View File
@@ -66,6 +66,7 @@ static void plain(track_t *t, uint32_t eng, uint32_t pi)
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_SPREAD] = 0; /* (1.0: the pads come with some) */
t->p[P_AMODE] = 0, t->p[P_VINT] = 0, t->p[P_FMODEL] = FM_SVF;
t->p[P_ITYPE] = 0, t->p[P_IMIX] = 127;
}
+18
View File
@@ -504,6 +504,24 @@ a scale sent here (a Scala .scl file: the editor reads it):
- rc 0 ok, 1 bad request (a system / root out of range, n 0 or above 48, the bytes not as n says, degrees not rising).
TUNE_PUT keeps the scale even when another system plays (USER plays it); the settings are written a few seconds later.
## Clipper 1.0: the same protocol (14), a larger layout
No new command: INFO still ends with 14 and reports the layout. 1.0 adds 27 parameters before P_E0 and one global:
| ids | what |
|---|---|
| 91 | SPREAD (VOICE 3, 0..127: each voice's place in the stereo field) |
| 92..94 | LFO 3: RATE, WAVE (SIN TRI SAW SQR S&H), MODE (FREE, KEY) |
| 95 | ENV 2 LOOP (ONE, LOOP) |
| 96..99 | the MACROS: BRITE, TIMBR (-64..63), MOTN, SPACE (0..127) |
| 100..117 | the matrix's slots 7..12 (SRC, DST, AMT each, as slots 1..6 at 60..77) |
| global 33 | G_DMODE, the delay's MODE (DLY 2: MONO, PING, TAPE) |
P_E0 is 118, P_COUNT 126, G_COUNT 34. The matrix's sources gain LFO3 (15) and MAC1..MAC4 (16..19), in every slot. The
reverb's TYPE (global 28) goes ROOM, PLATE, HALL, SHIMMER (0..3). A sound of an older layout maps by count (the editor's
patchByCount: the common values by place up to the older P_E0, the engine's 8 by theirs, the rest left as the device has
them). UP_PUT carries P_COUNT values as before (126).
## Notes for the editor
- **One request at a time.** Wait for the reply, about 10–50 ms, before sending the next.
+19 -9
View File
@@ -4706,7 +4706,8 @@ function selfLoad() {
const stepEdit = new Map(); /* index -> time of the last edit */
/* parameter ids (firmware/src/core.h); used only when P_COUNT / G_COUNT match */
const EXPECT = { pcount: 61, gcount: [32, 33], pe0: 53 }; /* gcount 33: 2.5's drum DLY (G_DRDLY) */
const EXPECT = { pcount: 61, gcount: [32, 33, 34], pe0: 53 }; /* gcount 33: 2.5's drum DLY (G_DRDLY); 34: Clipper 1.0's
delay MODE (G_DMODE) */
/* Clipper 0.4: 25 parameters more just before P_E0 (core.h): LFO 2 (53..55), ENV 2 (56..59), the matrix (60..77) */
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) */
@@ -4715,22 +4716,31 @@ const EXPECT_06 = { pcount: 91, pe0: 83 };
const EXPECT_08 = { pcount: 97, pe0: 89 };
/* Clipper 0.9: 2 more: VINTAGE (89), LOOP (90) */
const EXPECT_09 = { pcount: 99, pe0: 91 };
/* Clipper 1.0: 27 more: SPREAD (91), LFO 3 (92..94), ENV 2 LOOP (95), the MACROS (96..99), the matrix's slots 7..12
(100..117) */
const EXPECT_10 = { pcount: 126, pe0: 118 };
const layoutKnown = (info) => EXPECT.gcount.includes(info.gcount) &&
[EXPECT, EXPECT_04, EXPECT_06, EXPECT_08, EXPECT_09].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]]);
[EXPECT, EXPECT_04, EXPECT_06, EXPECT_08, EXPECT_09, EXPECT_10].some((x) => info.pcount === x.pcount && info.pe0 === x.pe0);
/* the matrix's slots: 1..6 at 60, (1.0) 7..12 at 100 */
const mxId = (k) => (k <= 6 ? 57 + 3 * k : 79 + 3 * k);
const MX_PAGES = (pe0) => Array.from({ length: pe0 >= 118 ? 12 : 6 }, (_, i) => ["MATRIX " + (i + 1), 0, [mxId(i + 1), mxId(i + 1) + 1, mxId(i + 1) + 2]]);
const P = { LEVEL: 0, SLEN: 29, CHORD: 49 };
/* Clipper (pe0 >= 78) as its device pages (params.c PAGES, CLIPPER_SYNTH): the slicer's slots are LFO > MOD (VEL>F MW>
AT>) and FX > FILTER's MODL; the drum globals the master EQ+COMP, DUCK / ROLL the reverb's TYPE / PRE; no MUTE (one
instrument). SYSTEM: MIDI OUT, SYNC, MIDI IN (kept with the FM-1's settings) */
const LAYOUT = (pe0) => pe0 >= 78 ? [
{ t: "ENV", pages: [["ENV", 0, [1, 2, 3, 4]], ["ENV DEST", 0, [5, 6, 7, 8]], ["ENV 2", 0, [56, 57, 58, 59]]] },
{ t: "LFO", pages: [["LFO", 0, [9, 10, 11, 12]], ["LFO DEST", 0, [13, 14, 15, 16]], ["MOD", 0, [45, 47, 48]], ["LFO 2", 0, [53, 54, 55]]] },
{ t: "LFO", title: "MATRIX", pages: MX_PAGES },
{ t: "ENV", pages: [["ENV", 0, [1, 2, 3, 4]], ["ENV DEST", 0, [5, 6, 7, 8]], ["ENV 2", 0, [56, 57, 58, 59]],
...(pe0 >= 118 ? [["ENV 2 LOOP", 0, [95]]] : [])] },
{ t: "LFO", pages: [["LFO", 0, [9, 10, 11, 12]], ["LFO DEST", 0, [13, 14, 15, 16]], ["MOD", 0, [45, 47, 48]], ["LFO 2", 0, [53, 54, 55]],
...(pe0 >= 118 ? [["LFO 3", 0, [92, 93, 94]]] : [])] },
{ t: "LFO", title: "MATRIX", pages: MX_PAGES(pe0) },
...(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, pe0 >= 91 ? [43, 44, 39, 89] : [43, 44, 39]]] },
...(pe0 >= 118 ? [{ t: "EDIT", title: "MACROS", pages: [["MACROS", 0, [96, 97, 98, 99]]] }] : []),
{ t: "VOICE", pages: [["LEVEL", 0, [0]], ["VOICE", 0, [37, 38, 41, 42]], ["VOICE 2", 0, pe0 >= 91 ? [43, 44, 39, 89] : [43, 44, 39]],
...(pe0 >= 118 ? [["VOICE 3", 0, [91]]] : [])] },
{ t: "FX", pages: [["FX", 0, [33, 34, 35, 36]], ["FILTER", 0, [50, 46]], ...(pe0 >= 83 ? [["INSERT", 0, [78, 79, 80, 81]], ["INSERT 2", 0, [82]]] : []),
["DLY", 1, [4, 5, 6, 7]], ["REVERB", 1, [28, 8, 9, 30]], ["CHORUS", 1, [10, 11]]] },
["DLY", 1, [4, 5, 6, 7]], ...(pe0 >= 118 ? [["DLY 2", 1, [33]]] : []), ["REVERB", 1, [28, 8, 9, 30]], ["CHORUS", 1, [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]], ...(pe0 >= 89 ? [["SPICE", 0, pe0 >= 91 ? [87, 88, 90] : [87, 88]]] : [])] },
{ t: "SEQ PATTERN", tab: "seqgroups", pages: [["PATTERN", 0, [29, 30, 31, 32]]] },
@@ -4769,7 +4779,7 @@ const INS_NTYPE = 12, AM_TURING = 15; /* (params.c N_ITYPE: OFF
function synDesc(id, d, info = dev && dev.info, p = dev && dev.dump && dev.dump.p, pdesc = dev && dev.pdesc) {
if (!d || !info || info.pe0 < 78 || !p) return d;
const pe0 = info.pe0;
if (id >= 60 && id <= 77 && (id - 60) % 3 === 1 && d.names.length >= 15) {
if (((id >= 60 && id <= 77 && (id - 60) % 3 === 1) || (pe0 >= 118 && id >= 100 && id <= 117 && (id - 100) % 3 === 1)) && d.names.length >= 15) {
const names = d.names.slice();
for (let k = 0; k < 8; k++) { const e = pdesc && pdesc[pe0 + k]; if (e && e.label && e.label[0] !== "-") names[7 + k] = e.label; }
return { ...d, names };
+12 -12
View File
@@ -66,13 +66,13 @@
<!--BANNER-->
<h1 data-t="kicker"></h1>
<section data-l="en">
<p class="lead">Clipper turns the FM-1 into a deep polyphonic synthesizer: 23 synthesis engines and 409 sounds, from HYBRID (three oscillators, two filters, a 16-slot matrix) to FM, wavetables, vector, wave sequencing, a Juno with its chorus and physical models; a modulation matrix and sequencer on every sound, eight filter models, microtuning with Scala scales, and every parameter editable in your browser.</p>
<p class="lead">Clipper turns the FM-1 into a deep polyphonic synthesizer: 23 synthesis engines and 409 sounds, from HYBRID (three oscillators, two filters, a 16-slot matrix) to FM, wavetables, vector, wave sequencing, a Juno with its chorus and physical models; a 12-slot modulation matrix, four macros, a modulation sequencer and stereo voices on every sound, hall and shimmer reverbs, eight filter models, microtuning with Scala scales, and every parameter editable in your browser.</p>
</section>
<section data-l="fr">
<p class="lead">Clipper fait de la FM-1 un vrai synthétiseur polyphonique : 23 moteurs de synthèse et 409 sons, de HYBRID (trois oscillateurs, deux filtres, une matrice de 16 slots) à la FM, aux tables d'ondes, au vectoriel, au wave sequencing, à un Juno avec son chorus et aux modèles physiques ; une matrice et un séquenceur de modulation sur chaque son, huit modèles de filtre, le micro-accordage avec les gammes Scala, et chaque paramètre éditable dans ton navigateur.</p>
<p class="lead">Clipper fait de la FM-1 un vrai synthétiseur polyphonique : 23 moteurs de synthèse et 409 sons, de HYBRID (trois oscillateurs, deux filtres, une matrice de 16 slots) à la FM, aux tables d'ondes, au vectoriel, au wave sequencing, à un Juno avec son chorus et aux modèles physiques ; une matrice de modulation de 12 slots, quatre macros, un séquenceur de modulation et des voix stéréo sur chaque son, des réverbs hall et shimmer, huit modèles de filtre, le micro-accordage avec les gammes Scala, et chaque paramètre éditable dans ton navigateur.</p>
</section>
<section data-l="ja">
<p class="lead">Clipper は FM-1 を本格的なポリフォニック・シンセサイザーに変えます。23 の音源エンジンと 409 の音色:HYBRID(3 オシレーター、2 フィルター、16 スロットのマトリクス)から FM、ウェーブテーブル、ベクター、ウェーブ・シーケンス、コーラス付きの Juno、物理モデリングまで。すべての音色にモジュレーション・マトリクスとシーケンサー、8 種類のフィルター・モデル、Scala 音階によるマイクロチューニング。すべてのパラメーターをブラウザから編集できます。</p>
<p class="lead">Clipper は FM-1 を本格的なポリフォニック・シンセサイザーに変えます。23 の音源エンジンと 409 の音色:HYBRID(3 オシレーター、2 フィルター、16 スロットのマトリクス)から FM、ウェーブテーブル、ベクター、ウェーブ・シーケンス、コーラス付きの Juno、物理モデリングまで。すべての音色に 12 スロットのモジュレーション・マトリクス、4 つのマクロ、モジュレーション・シーケンサー、ステレオ・ボイス。ホールとシマーのリバーブ、8 種類のフィルター・モデル、Scala 音階によるマイクロチューニング。すべてのパラメーターをブラウザから編集できます。</p>
</section>
<div class="tiles">
<div class="tile" style="--c: var(--blue)"><b>23</b><span data-t="tEng"></span></div>
@@ -121,16 +121,16 @@
<li>An arpeggiator with 15 modes, among them a Turing machine (TURNG) that loops and mutates a melody from the held notes; SPICE and DICE vary the arp's and the sequencer's notes the same way each time round.</li>
<li>A step sequencer with chords and recording, scales and chords on the keys, KBD HOLD.</li>
<li>Undo and compare on the FM-1, favourites, morph between two versions of a sound (MIDI CC 20), a randomizer by section.</li>
<li>MPE (per-note bend, pressure and slide), and MIDI over USB and TRS: pitch bend, mod wheel, expression, sustain pedal, channel and polyphonic aftertouch, the four HYBRID macros on CC 16 to 19.</li>
<li>MPE (per-note bend, pressure and slide), and MIDI over USB and TRS: pitch bend, mod wheel, expression, sustain pedal, channel and polyphonic aftertouch, the four macros on CC 16 to 19.</li>
<li>The FM-1 is also a USB audio interface: record it straight into your computer.</li>
</ul>
<h2>Sound</h2>
<ul>
<li>44.1 kHz. Band-limited oscillators everywhere: polyBLEP saws and pulses, polyBLAMP triangles, a band-limited hard sync, FM, feedback and wavefolding held below 20 kHz.</li>
<li>Zero-delay-feedback filters: a 24 dB Moog ladder that self-oscillates, SVFs whose resonance saturates softly, and on ANALOG, WAVE and VECTOR eight models to choose from (SVF, Moog, MS-20, diode ladder, SEM, notch, band-pass, high-pass).</li>
<li>Modulation on every engine: a six-slot matrix, a second LFO and envelope, and the MOD SEQ, a four-lane modulation sequencer. VINTAGE gives each voice its own small tuning, filter offset and drift, like an analog poly.</li>
<li>Modulation on every engine: a twelve-slot matrix, a second and third LFO, a second envelope that can loop, four macros (BRITE, TIMBR, MOTN, SPACE, also on CC 16 to 19), and the MOD SEQ, a four-lane modulation sequencer. VINTAGE gives each voice its own small tuning, filter offset and drift, like an analog poly; SPREAD gives each voice its own place in the stereo field.</li>
<li>Tunings: equal, just, Pythagorean, meantone, Werckmeister III, Kirnberger III, the maqams Rast and Bayati, slendro, pelog, 19, 24 and 31-EDO, and any Scala (.scl) scale sent from the editor.</li>
<li>Effects: an insert per sound (drive, fuzz, fold, crush, phaser, flanger, chorus, the Juno chorus), distortion, stereo chorus, tempo-synced delay, room and plate reverbs (after Dattorro). A master 3-band EQ, a bus compressor, a look-ahead limiter. Level-matched presets; settings glide instead of clicking.</li>
<li>Effects: an insert per sound (drive, fuzz, fold, crush, phaser, flanger, chorus, the Juno chorus), distortion, stereo chorus, a tempo-synced delay (mono, ping-pong, tape), room, plate, hall and shimmer reverbs (after Dattorro). A master 3-band EQ, a bus compressor, a look-ahead limiter. Level-matched presets; settings glide instead of clicking.</li>
<li>A web editor for every parameter: the whole HYBRID and FMX patches, the MOD SEQ, tunings and .scl files, DX7 banks, wavetables and samples, your sound library, backups.</li>
</ul>
</section>
@@ -168,16 +168,16 @@
<li>Un arpégiateur à 15 modes, dont une machine de Turing (TURNG) qui fait tourner et muter une mélodie à partir des notes tenues ; SPICE et DICE font varier les notes de l'arpège et du séquenceur, de la même façon à chaque tour.</li>
<li>Un séquenceur pas à pas avec accords et enregistrement, gammes et accords sur les touches, KBD HOLD.</li>
<li>Undo et comparaison sur la FM-1, favoris, morph entre deux versions d'un son (MIDI CC 20), randomiseur par section.</li>
<li>MPE (bend, pression et slide par note), et MIDI par USB et TRS : pitch bend, molette, expression, pédale de sustain, aftertouch par canal et polyphonique, les quatre macros HYBRID sur les CC 16 à 19.</li>
<li>MPE (bend, pression et slide par note), et MIDI par USB et TRS : pitch bend, molette, expression, pédale de sustain, aftertouch par canal et polyphonique, les quatre macros sur les CC 16 à 19.</li>
<li>La FM-1 devient aussi une interface audio USB : enregistre-la directement dans ton ordinateur.</li>
</ul>
<h2>Le son</h2>
<ul>
<li>44,1 kHz. Oscillateurs à bande limitée partout : dents de scie et pulses polyBLEP, triangles polyBLAMP, hard sync à bande limitée, FM, feedback et wavefolding tenus sous 20 kHz.</li>
<li>Filtres à retour sans délai (ZDF) : un ladder Moog 24 dB qui auto-oscille, des SVF dont la résonance sature en douceur, et sur ANALOG, WAVE et VECTOR huit modèles au choix (SVF, Moog, MS-20, ladder à diodes, SEM, notch, passe-bande, passe-haut).</li>
<li>La modulation sur tous les moteurs : une matrice de 6 slots, un 2e LFO et une 2e enveloppe, et le MOD SEQ, un séquenceur de modulation à 4 pistes. VINTAGE donne à chaque voix son petit écart d'accord et de filtre et sa dérive, comme un vrai polyphonique analogique.</li>
<li>La modulation sur tous les moteurs : une matrice de 12 slots, un 2e et un 3e LFO, une 2e enveloppe qui peut boucler, quatre macros (BRITE, TIMBR, MOTN, SPACE, aussi sur les CC 16 à 19), et le MOD SEQ, un séquenceur de modulation à 4 pistes. VINTAGE donne à chaque voix son petit écart d'accord et de filtre et sa dérive, comme un vrai polyphonique analogique ; SPREAD donne à chaque voix sa place dans la stéréo.</li>
<li>Accordages : égal, juste, Pythagore, mésotonique, Werckmeister III, Kirnberger III, les maqams Rast et Bayati, slendro, pelog, 19, 24 et 31-EDO, et toute gamme Scala (.scl) envoyée depuis l'éditeur.</li>
<li>Effets : un insert par son (saturation, fuzz, fold, crush, phaser, flanger, chorus, le chorus Juno), distorsion, chorus stéréo, delay synchronisé au tempo, réverbs room et plate (d&#39;après Dattorro). Sur le master, un EQ 3 bandes, un compresseur de bus et un limiteur. Presets de niveau égal ; les réglages glissent au lieu de claquer.</li>
<li>Effets : un insert par son (saturation, fuzz, fold, crush, phaser, flanger, chorus, le chorus Juno), distorsion, chorus stéréo, delay synchronisé au tempo (mono, ping-pong, bande), réverbs room, plate, hall et shimmer (d&#39;après Dattorro). Sur le master, un EQ 3 bandes, un compresseur de bus et un limiteur. Presets de niveau égal ; les réglages glissent au lieu de claquer.</li>
<li>Un éditeur web pour chaque paramètre : les patchs HYBRID et FMX en entier, le MOD SEQ, les accordages et fichiers .scl, les banques DX7, tables d'ondes et samples, ta bibliothèque de sons, les sauvegardes.</li>
</ul>
</section>
@@ -215,16 +215,16 @@
<li>15 モードのアルペジエーター。押さえた音からメロディーをループさせ変化させるチューリング・マシン(TURNG)も。SPICE と DICE がアルペジエーターとシーケンサーの音を毎回同じように変化させます。</li>
<li>和音と録音に対応したステップシーケンサー、鍵盤上のスケールとコード、KBD HOLD。</li>
<li>FM-1 本体でアンドゥと比較、お気に入り、音色の 2 つのバージョン間のモーフィング(MIDI CC 20)、セクション別ランダマイザー。</li>
<li>MPE(ノートごとのベンド、プレッシャー、スライド)。USB と TRS の MIDI:ピッチベンド、モジュレーション、エクスプレッション、サスティン、チャンネル/ポリ・アフタータッチ、CC 16〜19 の HYBRID マクロ。</li>
<li>MPE(ノートごとのベンド、プレッシャー、スライド)。USB と TRS の MIDI:ピッチベンド、モジュレーション、エクスプレッション、サスティン、チャンネル/ポリ・アフタータッチ、CC 16〜19 の 4 つのマクロ。</li>
<li>FM-1 は USB オーディオ・インターフェースにもなり、そのままパソコンに録音できます。</li>
</ul>
<h2>サウンド</h2>
<ul>
<li>44.1 kHz。すべて帯域制限オシレーター:polyBLEP のノコギリ波とパルス、polyBLAMP の三角波、帯域制限ハードシンク、20 kHz 以下に抑えた FM・フィードバック・ウェーブフォールド。</li>
<li>ゼロディレイ・フィードバック・フィルター:自己発振する 24 dB Moog ラダー、レゾナンスがやわらかく飽和する SVF。ANALOG、WAVE、VECTOR では 8 種類のモデル(SVF、Moog、MS-20、ダイオード・ラダー、SEM、ノッチ、BP、HP)から選べます。</li>
<li>全エンジンでモジュレーション:6 スロットのマトリクス、2 つ目の LFO とエンベロープ、4 レーンのモジュレーション・シーケンサー MOD SEQ。VINTAGE はボイスごとに少しずつ違うチューニング、フィルター、ドリフトを与え、アナログ・ポリのように鳴らします。</li>
<li>全エンジンでモジュレーション:12 スロットのマトリクス、2 つ目と 3 つ目の LFO、ループもできる 2 つ目のエンベロープ、4 つのマクロ(BRITE、TIMBR、MOTN、SPACE。CC 16〜19 でも)、4 レーンのモジュレーション・シーケンサー MOD SEQ。VINTAGE はボイスごとに少しずつ違うチューニング、フィルター、ドリフトを与え、アナログ・ポリのように鳴らします。SPREAD は各ボイスをステレオの別々の位置に置きます。</li>
<li>チューニング:平均律、純正律、ピタゴラス、ミーントーン、ヴェルクマイスター III、キルンベルガー III、マカーム(ラースト、バヤーティー)、スレンドロ、ペロッグ、19・24・31 平均律、そしてエディタから送る Scala(.scl)音階。</li>
<li>エフェクト:音色ごとのインサート(ドライブ、ファズ、フォールド、クラッシュ、フェイザー、フランジャー、コーラス、Juno コーラス)、ディストーション、ステレオ・コーラス、テンポ同期ディレイ、ルームとプレート(Dattorro 方式)のリバーブ。マスターに 3 バンド EQ、バス・コンプレッサー、ルックアヘッド・リミッター。音量をそろえたプリセット。設定はクリックせずになめらかに変わります。</li>
<li>エフェクト:音色ごとのインサート(ドライブ、ファズ、フォールド、クラッシュ、フェイザー、フランジャー、コーラス、Juno コーラス)、ディストーション、ステレオ・コーラス、テンポ同期ディレイ(モノ、ピンポン、テープ)、ルーム、プレート、ホール、シマー(Dattorro 方式)のリバーブ。マスターに 3 バンド EQ、バス・コンプレッサー、ルックアヘッド・リミッター。音量をそろえたプリセット。設定はクリックせずになめらかに変わります。</li>
<li>すべてのパラメーターを編集できるウェブ・エディタ:HYBRID と FMX の音色全体、MOD SEQ、チューニングと .scl、DX7 バンク、ウェーブテーブルとサンプル、音色ライブラリ、バックアップ。</li>
</ul>
</section>
+22 -10
View File
@@ -802,10 +802,12 @@ async function editorV7() {
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_MSRATE === 83 && sy.P_MSKEY === 86 && sy.P_SPICE === 87 && sy.P_DICE === 88 && sy.P_VINT === 89 && sy.P_SLOOP === 90
&& sy.P_E0 === 91 && sy.P_COUNT === 99
&& E.lockable(sy.P_E0, 91) && E.lockable(sy.P_E7, 91) && !E.lockable(sy.P_L2RATE, 91) && !E.lockable(sy.P_M6AMT, 91)
&& !E.lockable(sy.P_ITYPE, 91) && !E.lockable(sy.P_IMIX, 91) && !E.lockable(sy.P_MSRATE, 91) && !E.lockable(sy.P_DICE, 91) && !E.lockable(sy.P_SLOOP, 91),
"v7: Clipper's layout (LFO 2 53, ENV 2 56, MATRIX 60, INSERT 78, 0.8's MOD SEQ 83, SPICE 87, 0.9's VINTAGE 89 LOOP 90, P_E0 91): its EDIT values lockable, the rest not");
&& sy.P_SPREAD === 91 && sy.P_L3RATE === 92 && sy.P_E2LOOP === 95 && sy.P_MAC1 === 96 && sy.P_MAC4 === 99 && sy.P_M7SRC === 100
&& sy.P_M12AMT === 117 && sy.P_E0 === 118 && sy.P_COUNT === 126
&& E.lockable(sy.P_E0, 118) && E.lockable(sy.P_E7, 118) && !E.lockable(sy.P_L2RATE, 118) && !E.lockable(sy.P_M6AMT, 118)
&& !E.lockable(sy.P_ITYPE, 118) && !E.lockable(sy.P_IMIX, 118) && !E.lockable(sy.P_MSRATE, 118) && !E.lockable(sy.P_DICE, 118)
&& !E.lockable(sy.P_SLOOP, 118) && !E.lockable(sy.P_SPREAD, 118) && !E.lockable(sy.P_MAC1, 118) && !E.lockable(sy.P_M12AMT, 118),
"v7: Clipper's layout (LFO 2 53, ENV 2 56, MATRIX 60, INSERT 78, 0.8's MOD SEQ 83, SPICE 87, 0.9's VINTAGE 89 LOOP 90, 1.0's SPREAD 91, LFO 3 92, ENV 2 LOOP 95, MACROS 96, slots 7..12 100, P_E0 118): 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();
@@ -1295,7 +1297,7 @@ function editorClipperPages() {
const P = {}; 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)) P[nm] = k++;
const G = {}; k = 0;
for (const nm of (/enum \{\s*\/\* global parameters \*\/([^}]*)\}/.exec(ch) || [])[1].replace(/\/\*[\s\S]*?\*\//g, "").split(",").map((x) => x.trim()).filter(Boolean)) G[nm] = k++;
for (const nm of (/enum \{\s*\/\* global parameters \*\/([^}]*)\}/.exec(ch) || [])[1].replace(/#(if|endif)[^\n]*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").split(",").map((x) => x.trim()).filter(Boolean)) G[nm] = k++;
for (const [, a, b] of ch.matchAll(/#define ([PG]_\w+) ([PG]_\w+)/g)) (a[0] === "P" ? P : G)[a] = (b[0] === "P" ? P : G)[b];
/* PAGES as the synth build has it: #if CLIPPER_SYNTH kept, its #else and #if !CLIPPER_SYNTH dropped */
const src = pc.slice(pc.indexOf("static const page_t PAGES[]"), pc.indexOf("#define NPAGES"));
@@ -1315,14 +1317,18 @@ function editorClipperPages() {
const devG = pages.filter((x) => x[1] === "SC_GLOBAL").flatMap((x) => x[2]).filter((id) => ![G.G_INFO, G.G_SLOT, G.G_LOAD, G.G_SAVE, G.G_CLRSEQ, G.G_INITSND, G.G_NEWPRJ].includes(id));
const missP = [...devP].filter((id) => !p0.has(id)), missG = devG.filter((id) => !g1.has(id));
const notOn = Array.from({ length: P.P_COUNT }, (_, i) => i).filter((i) => !p0.has(i));
ok(pages.length > 20 && P.P_E0 === 91 && P.P_COUNT === 99 && X.layoutKnown({ pcount: 99, pe0: 91, gcount: G.G_COUNT })
ok(pages.length > 20 && P.P_E0 === 118 && P.P_COUNT === 126 && G.G_COUNT === 34 && G.G_DMODE === 33
&& X.layoutKnown({ pcount: 126, pe0: 118, gcount: G.G_COUNT }) && X.layoutKnown({ pcount: 99, pe0: 91, gcount: 33 })
&& !missP.length && !missG.length && js(notOn) === js([P.P_MUTE]) && all0.length === new Set(all0).size,
`editor: Clipper 0.9's pages hold every value of the device's (params.c PAGES; not on one: MUTE${missP.length || missG.length ? `; missing P ${missP} G ${missG}` : ""}${notOn.length !== 1 ? `; off the pages ${notOn}` : ""})`);
`editor: Clipper 1.0's pages hold every value of the device's (params.c PAGES; not on one: MUTE${missP.length || missG.length ? `; missing P ${missP} G ${missG}` : ""}${notOn.length !== 1 ? `; off the pages ${notOn}` : ""})`);
const title = (id, s) => (L.flatMap((g) => g.pages).find((x) => x[1] === s && x[2].includes(id)) || [])[0];
ok(title(P.P_FMODEL, 0) === "FILTER" && title(P.P_VELF, 0) === "MOD" && title(P.P_VINT, 0) === "VOICE 2" && title(P.P_SLOOP, 0) === "SPICE"
&& title(G.G_RTYPE, 1) === "REVERB" && title(G.G_RPRE, 1) === "REVERB" && title(G.G_EQLOW, 1) === "EQ+COMP" && title(G.G_SYNC, 1) === "SYSTEM"
&& !L.some((g) => g.pages.some((x) => x[0] === "SLICER" || x[0] === "DRUMS")),
"editor: ... grouped as the device (FILTER MODL, LFO > MOD, VOICE 2 VINTG, SPICE LOOP, REVERB TYPE PRE, EQ+COMP, SYSTEM)");
&& !L.some((g) => g.pages.some((x) => x[0] === "SLICER" || x[0] === "DRUMS"))
&& title(P.P_SPREAD, 0) === "VOICE 3" && title(P.P_L3MODE, 0) === "LFO 3" && title(P.P_E2LOOP, 0) === "ENV 2 LOOP"
&& title(P.P_MAC3, 0) === "MACROS" && title(P.P_M7SRC, 0) === "MATRIX 7" && title(P.P_M12AMT, 0) === "MATRIX 12"
&& title(G.G_DMODE, 1) === "DLY 2" && X.LAYOUT(91).flatMap((g) => g.pages).filter((x) => /^MATRIX/.test(x[0])).length === 6,
"editor: ... grouped as the device (FILTER MODL, LFO > MOD, VOICE 2 VINTG, SPICE LOOP, REVERB TYPE PRE, EQ+COMP, SYSTEM; 1.0: VOICE 3 SPREAD, LFO 3, ENV 2 LOOP, MACROS, MATRIX 7..12, DLY 2 MODE; 0.9's: 6 slots)");
/* the labels the device shows and DESC does not (params.c track_desc) */
const pcs = (re) => ((re.exec(pc) || [])[1] || "").match(/"[^"]*"/g).map((x) => x.slice(1, -1));
const amode = pcs(/N_AMODE\[\] = \{([^}]*)\}/), itype = pcs(/N_ITYPE\[\] = \{([^}]*)\}/), irate = pcs(/N_IRATE\[\] = \{([^}]*)\}/);
@@ -1344,12 +1350,18 @@ function editorClipperPages() {
ok(d1.names[7] === "CUT" && d1.names[8] === "E2" && d1.names[14] === "PTCH" && dst.names[7] === "E1"
&& crB.label === "BITS" && E.fmtValue(crB, 0)[0] === "1" && E.fmtValue(crB, 127)[0] === "16" && E.fmtValue(crB, 64)[0] === "9"
&& crR.label === "RATE" && E.fmtValue(crR, 127).join() === "44k,Hz" && ju.label === "WIDTH" && ju.def === 127 && off === insA
&& mu.label === "MUTAT" && sd.label === "SEED" && ch14 === spice && X.synDesc(87, spice, { pe0: 53 }, p, pd) === spice,
&& mu.label === "MUTAT" && sd.label === "SEED" && ch14 === spice && X.synDesc(87, spice, { pe0: 53 }, p, pd) === spice
&& X.synDesc(101, dst, info, p, pd) === dst && (() => { const q1 = []; q1[118] = { label: "CUT" };
return X.synDesc(101, dst, { pe0: 118 }, new Array(126).fill(0), q1).names[7] === "CUT" && X.synDesc(116, dst, { pe0: 118 }, new Array(126).fill(0), q1).names[7] === "CUT"; })(),
"editor: Clipper's labels: a matrix DST as the engine's values, the INSERT's A B C by TYPE (CRUSH BITS 1..16), TURNG's MUTAT SEED");
/* a Clipper 0.8 sound (97 values, P_E0 89) into 0.9 (99, 91): VINTAGE and LOOP left as the device has them */
const v8 = Array.from({ length: 97 }, (_, i) => 3000 + i), q = E.patchByCount(v8, 89, 99, 91), r = E.patchByCount(q.map((x) => x ?? 0), 91, 97, 89);
ok(q[88] === 3088 && q[89] === null && q[90] === null && q[91] === 3089 && q[98] === 3096 && r[88] === 3088 && r[89] === 3089 && r[96] === 3096,
"patchByCount: Clipper 0.8 <-> 0.9: up to DICE by place, the engine's 8 by theirs, VINTAGE and LOOP left out");
/* a Clipper 0.9 sound (99 values, P_E0 91) into 1.0 (126, 118): SPREAD .. slot 12 left as the device has them */
const v9 = Array.from({ length: 99 }, (_, i) => 4000 + i), q9 = E.patchByCount(v9, 91, 126, 118), r9 = E.patchByCount(q9.map((x) => x ?? 0), 118, 99, 91);
ok(q9[90] === 4090 && q9[91] === null && q9[117] === null && q9[118] === 4091 && q9[125] === 4098 && r9[90] === 4090 && r9[91] === 4091 && r9[98] === 4098,
"patchByCount: Clipper 0.9 <-> 1.0: up to LOOP by place, the engine's 8 by theirs, 1.0's 27 left out");
}
/* ------------------------------------------------- editor icons (Fukiai) --- */