mirror of
https://github.com/illuminus5/skiff.git
synced 2026-12-05 12:24:45 +01:00
Skiff 1.3.2: a stereo HALL reverb, Skiff in your browser, update mode on the screen and a finer vibrato
- HALL is Felucca's stereo HALL now: eight lines that feed each other, with their own left and right (#19). - Try Skiff in your browser at https://illuminus5.github.io/skiff/try/: the firmware compiled to WebAssembly on a drawn FM-1 (#18). - The update loader shows UPDATE MODE and the way out, WRITING with a bar, and UPDATE FAILED; the README's "If the FM-1 does not start" begins with update mode. - LFO DEST PITCH's depth is squared: +1 % was already a 19-cent vibrato; now the low end is fine and the vibrato smooth. The factory sounds with a vibrato are retuned to sound as before. - MENU's STEP PREVIEW and SCREEN OFF show a new value at once; the README's sound-type counts add up again.
This commit is contained in:
1 parent
ddd855cf43
commit
c4bb2b4e90
28 files changed
+1071
-262
No files matched your search
+4
-3
@@ -83,14 +83,15 @@ at the note's pitch instead, and the screen says NO SAMPLE.
|
||||
```
|
||||
./build.sh
|
||||
web/emu/build.sh
|
||||
python3 -m http.server -d build/emu 8790 # open http://localhost:8790/
|
||||
python3 -m http.server -d build 8790 # open http://localhost:8790/emu/ (the page loads ../panel.js)
|
||||
```
|
||||
|
||||
`web/emu/felucca_web.c` builds the firmware's sources as the host tests do, against a simulated FM-1, and
|
||||
Emscripten compiles it to WebAssembly (`build/emu/felucca.wasm`, with `index.html`, `worklet.js` and the font in `fonts/`). The page
|
||||
keeps the flash's storage sectors (projects, user presets, settings) in the browser. Not emulated: USB (audio,
|
||||
MIDI out, the editor, updates), TRS MIDI and the user sample slots. (Felucca's build of it, which runs Felucca:
|
||||
<https://hugelton.github.io/Felucca/webapp/try/>.)
|
||||
MIDI out, the editor, updates), TRS MIDI and the user sample slots. The site has it at
|
||||
<https://illuminus5.github.io/skiff/try/> (`web/make_site.py` copies `build/emu` there: build it with `EMU_PREVIEW=0` after
|
||||
the release build). It is Felucca's, after X0X's: <https://hugelton.github.io/Felucca/webapp/try/> runs Felucca.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@ synths and drums, patterns and songs, live performance, and a screen that shows
|
||||
<img src="https://img.shields.io/badge/hardware-M--VAVE%20FM--1-555" alt="Hardware: M-VAVE FM-1">
|
||||
</p>
|
||||
|
||||
<p align="center"><b>New in 1.3.1:</b> a 320 MHz CPU CLOCK to choose (the chip's rated clock), and fixes from your
|
||||
comments · <a href="https://github.com/illuminus5/skiff/releases/tag/v1.3.1">the release notes</a><br>
|
||||
<p align="center"><b>New in 1.3.2:</b> a stereo HALL reverb, <a href="https://illuminus5.github.io/skiff/try/">Skiff in
|
||||
your browser</a>, update mode on the screen and a finer vibrato ·
|
||||
<a href="https://github.com/illuminus5/skiff/releases/tag/v1.3.2">the release notes</a><br>
|
||||
<b>New in 1.3:</b> the FM-1's second core (BETA: 12 voices), MIDI LEARN and a channel per track,
|
||||
an INSERT effect, LFO sync, SPREAD and more from Felucca 1.6.1 ·
|
||||
<a href="https://github.com/illuminus5/skiff/releases/tag/v1.3">the release notes</a></p>
|
||||
@@ -24,7 +25,9 @@ an INSERT effect, LFO sync, SPREAD and more from Felucca 1.6.1 ·
|
||||
<a href="https://youtu.be/c0HFI7AvN1M">▶ Watch the 1.3 tour on YouTube (3:38)</a></p>
|
||||
|
||||
<p align="center"><b>New to Skiff?</b> <a href="https://illuminus5.github.io/skiff/learn/">Learn Skiff</a>: the manual in chapters, each
|
||||
with a video that shows every press on the unit. Start with <a href="https://illuminus5.github.io/skiff/learn/#first-beat">your first beat</a>.</p>
|
||||
with a video that shows every press on the unit. Start with <a href="https://illuminus5.github.io/skiff/learn/#first-beat">your first beat</a>.<br>
|
||||
<b>Try it first:</b> <a href="https://illuminus5.github.io/skiff/try/">Skiff in your browser</a>, the firmware itself on a
|
||||
drawn FM-1, played with the mouse, a touch screen or the computer keyboard.</p>
|
||||
|
||||

|
||||
|
||||
@@ -48,12 +51,12 @@ Custom firmware, at your own risk; the way back to the official firmware is belo
|
||||
connect the FM-1 by USB and follow it. The same page takes the FM-1 back to the official V15 firmware, saving a
|
||||
complete backup of your music first.
|
||||
|
||||
**With Python 3:** download `skiff-1.3.1.fwsc` from the [latest release](https://github.com/illuminus5/skiff/releases/latest)
|
||||
**With Python 3:** download `skiff-1.3.2.fwsc` from the [latest release](https://github.com/illuminus5/skiff/releases/latest)
|
||||
and, with this repository's `tools/` folder,
|
||||
|
||||
```
|
||||
pip install mido python-rtmidi
|
||||
python tools/fm1_install.py skiff-1.3.1.fwsc
|
||||
python tools/fm1_install.py skiff-1.3.2.fwsc
|
||||
```
|
||||
|
||||
It takes about two minutes and the FM-1 restarts on Skiff.
|
||||
@@ -74,7 +77,7 @@ Edge, over USB MIDI).
|
||||
| **Patterns and songs** | a pool of 64 patterns shared by every project; each track a list of 16 entries (A–P), each a pattern played 1–16 times; SONG walks each track down its list |
|
||||
| **Performance** | PERFORM: launch any track's entries and stage mutes on LOOP, BAR, BEAT or NOW; 16 scenes; throws (CUTOFF, REVERB, DELAY, DIST) that glide back; the FX layer: repeat, reverse, filter sweeps, tape stop, freeze, harmonizer, gate, dub echo, flanger, vinyl, cuts |
|
||||
| **Sound** | per track: an envelope (in milliseconds or note values) and a second one for modulation (ENV 2), an LFO with depths per destination (free or synced to the tempo), a 4-slot modulation matrix, DIST in four types (SOFT, HARD, FOLD, BITS) with a TONE, an INSERT (drives, a bitcrusher, phaser, flanger, chorus) with MIX, the SLICER (16 patterns), DUCK (sidechain), SPREAD (the voices across the stereo field); a drum kit's lanes tuned and their decay set one by one; arpeggiator (14 modes), chord keys (9 chords, 5 voicings), 16 scales; MONO, LEGATO, UNISON, glide |
|
||||
| **Effects** | chorus (CHORUS, FLANGER or PHASER, with FEEDBACK), delay and reverb (ROOM, SPRING or HALL) as sends |
|
||||
| **Effects** | chorus (CHORUS, FLANGER or PHASER, with FEEDBACK), delay and reverb (ROOM, SPRING or a stereo HALL) as sends |
|
||||
| **Memory** | 4 projects, 32 user sounds, 3 user sample slots; the music comes back at power-on (RESTORE LAST); 8 levels of undo |
|
||||
| **Screen** | 240 × 240 colour; a graph on every page; HOME held shows every control's job; 6 themes; LARGE mode with tall cards |
|
||||
| **MIDI and USB** | USB MIDI in and out, TRS MIDI in; clock from inside, USB or TRS; each track its own channel (1–6 by default); MIDI LEARN for any knob; Program Change; a stereo USB audio input to record the master on a computer |
|
||||
@@ -95,7 +98,7 @@ a bass, list the basses and step through them, across every engine, until one fi
|
||||
|
||||
1. **Pick the track** with ALGORITHM, say track 2.
|
||||
2. **Tap SAVE** for SAVE › PRESETS (turn SELECT to it if another SAVE page opens) and turn **KNOB 4, LIST,** to
|
||||
**BASS**. The list now holds only the basses: 18 of them, from eight engines.
|
||||
**BASS**. The list now holds only the basses: 19 of them, from eight engines.
|
||||
3. **Turn PRESETS** (or KNOB 1): each bass plays on the track as you reach it. One from another engine switches the
|
||||
track to that engine; its notes, its mix and its effects stay as they are.
|
||||
4. **Stop on the one that fits.** Gone past the sound you had? **SAVE held** brings it back: a run of PRESETS turns
|
||||
@@ -113,16 +116,16 @@ engine, so you can browse from whichever page you are on. For track 3's pad: ALG
|
||||
- **FAV** lists your favourites. On SAVE › PRESETS, turn **KNOB 3, FAV,** right to mark the sound playing, left to
|
||||
unmark it. Your own sounds (SAVE › USER) are listed on ALL and FAV.
|
||||
- **KNOB 2, ENG,** jumps to the next engine's first sound, whatever the LIST.
|
||||
- Tracks 5 and 6 leave PHYS and GRAIN out of every list, since they don't play them: 17 basses there.
|
||||
- Tracks 5 and 6 leave PHYS and GRAIN out of every list, since they don't play them: 18 basses there.
|
||||
|
||||
| Type | Sounds | From |
|
||||
| --- | ---: | --- |
|
||||
| BASS | 18 | ANALOG 6, FM6 4, LOFI 2, TRIO 2, PHASE, VOICE, WHEEL, PHYS |
|
||||
| LEAD | 23 | ANALOG 6, LOFI 4, PHASE 3, SAMPLE 3, TRIO 3, VOICE 2, FM6, WHEEL |
|
||||
| BASS | 19 | ANALOG 7, FM6 4, LOFI 2, TRIO 2, PHASE, VOICE, WHEEL, PHYS |
|
||||
| LEAD | 24 | ANALOG 7, LOFI 4, PHASE 3, SAMPLE 3, TRIO 3, VOICE 2, FM6, WHEEL |
|
||||
| PAD | 22 | ANALOG 6, GRAIN 6, VOICE 4, PHYS 2, FM6, PHASE, SAMPLE, TRIO |
|
||||
| KEYS | 23 | FM6 7, WHEEL 6, PHASE 3, PHYS 3, SAMPLE 2, ANALOG, TRIO |
|
||||
| PLUCK | 11 | PHYS 3, LOFI 2, SAMPLE 2, ANALOG, FM6, PHASE, TRIO |
|
||||
| DRUM | 31 | DRUM 10, DRUM-X 10, SLICE 8, PHYS 2, ANALOG |
|
||||
| DRUM | 34 | DRUM 13, DRUM-X 10, SLICE 8, PHYS 2, ANALOG |
|
||||
| FX | 15 | NOISE 8, ANALOG 2, GRAIN 2, VOICE, TRIO, SLICE |
|
||||
|
||||
A DRUM-X kit preset loads its whole kit, the project's one kit for every DRUM-X track; SAVE held brings the kit back
|
||||
@@ -285,8 +288,8 @@ FM6 patches from `.syx` files and saves complete backups.
|
||||
- **Lane mutes** (1.3): on a DRUM or DRUM-X track the EDIT layer's black keys 1–8 mute its lanes
|
||||
- **DUCK** (FX › DUCK): a track dips under another track's hits, the sidechain pump
|
||||
- **Effects:** per track DIST, in four types on FX › DRIVE (SOFT, HARD, FOLD, BITS) with a TONE, and the SLICER;
|
||||
the buses on GLO: chorus (CHORUS, FLANGER or PHASER, with FEEDBACK), delay and reverb (ROOM, SPRING or HALL); the
|
||||
FX layer (hold FX): fourteen effects on the white keys and cuts on the black ([the keys](#the-fx-layers-keys));
|
||||
the buses on GLO: chorus (CHORUS, FLANGER or PHASER, with FEEDBACK), delay and reverb (ROOM, SPRING or a stereo
|
||||
HALL); the FX layer (hold FX): fourteen effects on the white keys and cuts on the black ([the keys](#the-fx-layers-keys));
|
||||
new in 1.2: DRIVE's types and TONE, the chorus's modes, HALL, and GATE, DUB, FLANGE and VINYL on the FX layer;
|
||||
new in 1.3: **FX › INSERT**, a second effect per track after DRIVE (SOFT, HARD, FOLD, FUZZ, CRUSH, PHASR, FLANG or
|
||||
CHOR, its A, B and C named by the type, INSERT 2's MIX), and the delay's dotted times (1/8D, 1/16D, 1/4D)
|
||||
@@ -569,9 +572,15 @@ and control behaves, rule by rule: [DESIGN.md](DESIGN.md). The editor's protocol
|
||||
|
||||
## If the FM-1 does not start
|
||||
|
||||
If an update is interrupted and the FM-1 stays black, check whether a computer sees it as a USB device named
|
||||
**WL80UBOOT** (or a USB mass-storage device with ID 4C4A:8057). That is the chip's built-in boot mode, and
|
||||
the FM-1 can be brought back:
|
||||
**The screen says UPDATE MODE, or stays black while a computer sees a USB MIDI device named "Felucca
|
||||
Update":** an install was cut off, and the FM-1 waits in Skiff's update loader at every power-on. Nothing is
|
||||
lost. Connect it by USB and run the [Skiff installer](https://illuminus5.github.io/skiff/webapp/installer/) again
|
||||
(or `python tools/fm1_install.py skiff-1.3.2.fwsc`): it finishes the install. M-VAVE's own updater does not see
|
||||
the FM-1 in this state. (Since 1.3.2 the loader says UPDATE MODE on the screen; one an older Skiff left there
|
||||
keeps it black.)
|
||||
|
||||
**A computer sees a USB device named WL80UBOOT** (or a USB mass-storage device with ID 4C4A:8057): that is the
|
||||
chip's built-in boot mode, and the FM-1 can be brought back:
|
||||
|
||||
- First try another USB data cable, and close every other app that uses MIDI, then run `tools/fm1_install.py`
|
||||
again: it finishes an interrupted update.
|
||||
@@ -579,6 +588,9 @@ the FM-1 can be brought back:
|
||||
writes the FM-1's flash from a Mac through a Seeed XIAO RP2040 (three wires to the FM-1's USB lines). Back up
|
||||
the flash first, then write the official firmware (M-VAVE's FM-1.fwsc).
|
||||
|
||||
**A computer sees nothing at all:** try another USB cable (a charge-only cable has no data lines) and another
|
||||
port, with the FM-1 charged. FM-1 Transporter (above) reaches the chip's boot mode by itself.
|
||||
|
||||
## Support
|
||||
|
||||
Skiff stands on Felucca. If it is useful to you, support Felucca's author:
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||
/* Skiff: the update loader's screen (loader.c; tests/ldr_screen_test.c). A unit whose install was cut off comes back
|
||||
* to the loader at every power-on, and showed a black screen while M-Upgrade can't see "Felucca Update": UPDATE MODE
|
||||
* and what it waits for, then WRITING and a bar while the app area is written. Drawn with the loader's own 5 x 7
|
||||
* letters (the app area may be half written: never read), before USB starts (USB is polled: the panel's ~0.3 s init
|
||||
* would leave the host's enumeration unanswered) */
|
||||
static const char LDR_CH[] = "ABCDEFGHIKLMNOPRSTUW"; /* the letters the screens use; others: a space */
|
||||
static const uint8_t LDR_FONT[sizeof LDR_CH - 1u][7] = { /* rows, bit 4 the left dot */
|
||||
{0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11}, {0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E}, /* A B */
|
||||
{0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E}, {0x1E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1E}, /* C D */
|
||||
{0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F}, {0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10}, /* E F */
|
||||
{0x0E, 0x11, 0x10, 0x17, 0x11, 0x11, 0x0F}, {0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11}, /* G H */
|
||||
{0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E}, {0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11}, /* I K */
|
||||
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F}, {0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11}, /* L M */
|
||||
{0x11, 0x11, 0x19, 0x15, 0x13, 0x11, 0x11}, {0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E}, /* N O */
|
||||
{0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10}, {0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11}, /* P R */
|
||||
{0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E}, {0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, /* S T */
|
||||
{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E}, {0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A}, /* U W */
|
||||
};
|
||||
#define LDR_INK 0xFFFFu
|
||||
#define LDR_TITLE 0x2616u /* teal, #22C3B4: calm (the orange read as an error) */
|
||||
#define LDR_BAR 0x2616u /* teal, #22C3B4 */
|
||||
#define LDR_DIM 0x2104u /* the bar's track */
|
||||
#define LDR_BAR_X 20u
|
||||
#define LDR_BAR_Y 190u
|
||||
#define LDR_BAR_W 200u
|
||||
|
||||
static uint32_t ldr_missing; /* letters drawn as gaps: 0 (ldr_screen_test) */
|
||||
static void ldr_text(uint32_t y, uint32_t s, uint16_t c, const char *t) /* centred, a dot s x s px */
|
||||
{
|
||||
uint32_t n = 0, x, r, k, i, b;
|
||||
while (t[n])
|
||||
n++;
|
||||
if (!n)
|
||||
return;
|
||||
for (x = (240u - (n * 6u - 1u) * s) / 2u; *t; t++, x += 6u * s) {
|
||||
for (k = 0; LDR_CH[k] && LDR_CH[k] != *t; k++)
|
||||
;
|
||||
if (!LDR_CH[k]) {
|
||||
ldr_missing += *t != ' '; /* (a letter the font lacks: a gap) */
|
||||
continue;
|
||||
}
|
||||
for (r = 0; r < 7u; r++)
|
||||
for (i = 0; i < 5u; i = b) { /* each run of dots in the row: one fill */
|
||||
for (; i < 5u && !(LDR_FONT[k][r] >> (4u - i) & 1u); i++)
|
||||
;
|
||||
for (b = i; b < 5u && (LDR_FONT[k][r] >> (4u - b) & 1u); b++)
|
||||
;
|
||||
if (b > i)
|
||||
lcd_fill(x + i * s, y + r * s, (b - i) * s, s, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
static void ldr_lines(const char *a, const char *b, const char *c) /* the three lines under the title */
|
||||
{
|
||||
lcd_fill(0, 106, 240, 66, 0);
|
||||
ldr_text(110, 2, LDR_INK, a);
|
||||
ldr_text(130, 2, LDR_INK, b);
|
||||
ldr_text(150, 2, LDR_INK, c);
|
||||
}
|
||||
static void ldr_screen(void)
|
||||
{
|
||||
lcd_init(); /* (the panel cleared, on) */
|
||||
ldr_text(70, 3, LDR_TITLE, "UPDATE MODE");
|
||||
ldr_lines("WAITING FOR THE", "SKIFF INSTALLER", "KEEP USB CONNECTED"); /* (an install on its way, or one cut
|
||||
* off: words for both, no alarm) */
|
||||
lcd_sync();
|
||||
}
|
||||
static uint32_t ldr_bar_w; /* the bar's px drawn */
|
||||
static uint8_t ldr_writing; /* WRITING is on the screen */
|
||||
static void ldr_bar(uint32_t done, uint32_t total)
|
||||
{
|
||||
uint32_t w = done * LDR_BAR_W / total; /* (the app area: below 2^32 / 200) */
|
||||
if (!ldr_writing || w < ldr_bar_w) { /* a write starts (again) */
|
||||
ldr_lines("WRITING", "DO NOT SWITCH OFF", "");
|
||||
lcd_fill(LDR_BAR_X, LDR_BAR_Y, LDR_BAR_W, 8, LDR_DIM);
|
||||
ldr_bar_w = 0;
|
||||
ldr_writing = 1;
|
||||
}
|
||||
if (w > ldr_bar_w) {
|
||||
lcd_fill(LDR_BAR_X + ldr_bar_w, LDR_BAR_Y, w - ldr_bar_w, 8, LDR_BAR);
|
||||
ldr_bar_w = w;
|
||||
}
|
||||
lcd_sync();
|
||||
}
|
||||
static void ldr_failed(void) /* a session that wrote nothing or stopped: the way out */
|
||||
{
|
||||
ldr_lines("UPDATE FAILED", "INSTALL AGAIN WITH", "THE SKIFF INSTALLER");
|
||||
lcd_fill(LDR_BAR_X, LDR_BAR_Y, LDR_BAR_W, 8, 0);
|
||||
lcd_sync();
|
||||
ldr_writing = 0;
|
||||
}
|
||||
@@ -22,8 +22,14 @@
|
||||
* [0x97000, 0xE0000) (user data, never a record: ldr_core.c) */
|
||||
#define FL_RANGE_OK(off, n) (FL_IN(off, n, 0x4000u, 0x97000u) || FL_IN(off, n, 0xE0000u, 0xFC000u))
|
||||
#include "fm1_flash.h"
|
||||
#define fm1_irq_off() ((void)0) /* (lcd.c's, around port A: interrupts are off for the whole loader) */
|
||||
#define fm1_irq_on() ((void)0)
|
||||
#include "fm1_lcd_hw.h"
|
||||
#include "../src/libc.c"
|
||||
#include "../src/usb.c"
|
||||
#include "../src/lcd.c"
|
||||
|
||||
#include "ldr_screen.c" /* (Skiff) the screen: UPDATE MODE, WRITING */
|
||||
|
||||
static uint32_t ldr_ms(void) /* monotonic ms; survives the TIMER4 wrap (178.9 s) */
|
||||
{
|
||||
@@ -74,7 +80,11 @@ static void ldr_record_clear(void)
|
||||
{
|
||||
fm1_updata_parm_clear(); /* CRC 0: the SPL ignores it on a warm reset */
|
||||
}
|
||||
static void ldr_progress(uint32_t done, uint32_t total) { (void)done; (void)total; ldr_poll(); }
|
||||
static void ldr_progress(uint32_t done, uint32_t total)
|
||||
{
|
||||
ldr_bar(done, total);
|
||||
ldr_poll();
|
||||
}
|
||||
#include "ldr_core.c"
|
||||
|
||||
extern uint32_t _bss_start[], _bss_end[];
|
||||
@@ -83,6 +93,8 @@ void ldr_main(void)
|
||||
{
|
||||
fm1_wdt_arm(0x0D); /* ~8 s, fed by ldr_poll */
|
||||
fm1_time_init();
|
||||
ldr_screen(); /* (Skiff) before USB: see ldr_screen */
|
||||
fm1_wdt_feed();
|
||||
usb_start();
|
||||
for (;;) {
|
||||
ldr_poll();
|
||||
@@ -101,6 +113,7 @@ void ldr_main(void)
|
||||
fm1_delay_ms(30);
|
||||
fm1_core_reset(); /* the SPL boots the new app */
|
||||
}
|
||||
ldr_failed(); /* (Skiff) the host may try again */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ typedef struct { /* per-voice control-rate modulation, computed
|
||||
int32_t cutoff; /* 0..127 << 8 */
|
||||
int32_t shape; /* 0..127 << 8 */
|
||||
int32_t envq15; /* env value (for engines that use it as a mod source) */
|
||||
int32_t fine; /* the residual below 1/16 semitone in inc: unison detune, TUNE, bend (1/4096) */
|
||||
int32_t fine; /* the residual below 1/16 semitone in inc: unison detune, TUNE, bend, (Skiff 1.3.2) the LFO's vibrato (1/4096) */
|
||||
} vmod_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -184,18 +184,18 @@ static const preset_t ANALOG_PRESETS[] = {
|
||||
{"SYNTH PLUCK", {0, 8, 50, 0, 30, 40, 0, 64}, {0, 88, 0, 60}, 55, 0, FX(0, 20, 50, 30), TAG(PT_PLUCK)},
|
||||
{"SYNTH BRASS", {0, 10, 64, 0, 45, 20, 10, 64}, {35, 70, 90, 45}, 40, 0, FX(0, 20, 20, 40), TAG(PT_LEAD)},
|
||||
{"WIND SWEEP", {0, 0, 0, 90, 30, 90, 0, 0}, {60, 90, 60, 80}, 50, 0, FX(0, 30, 30, 70), TAG(PT_FX)},
|
||||
{"STRINGS", {4, 6, 64, 0, 92, 8, 0, 48}, {48, 90, 118, 72}, 6, 0, FX(0, 95, 15, 55), MORE({P_LD_SHP, 20}, {P_LRATE, 72}, {P_LD_PIT, 1}, {P_LFADE, 80}), TAG(PT_PAD)}, /* ((Skiff phase 9) as SOFT PAD to the ear: a bright string
|
||||
{"STRINGS", {4, 6, 64, 0, 92, 8, 0, 48}, {48, 90, 118, 72}, 6, 0, FX(0, 95, 15, 55), MORE({P_LD_SHP, 20}, {P_LRATE, 72}, {P_LD_PIT, 8}, {P_LFADE, 80}), TAG(PT_PAD)}, /* ((Skiff phase 9) as SOFT PAD to the ear: a bright string
|
||||
* machine now, its PWM moving, a late vibrato) */
|
||||
/* (Skiff) for the themes: CRYPT (dungeon synth), NEON (synthwave), QUARK (particles) */
|
||||
{"BONE FLUTE", {2, 3, 30, 22, 84, 15, 0, 64}, {56, 80, 110, 64}, 6, 1, FX(0, 15, 30, 85), MORE({P_LRATE, 84}, {P_LFADE, 90}, {P_LD_PIT, 1}), TAG(PT_LEAD)},
|
||||
{"WAR HORN", {0, 5, 64, 4, 42, 12, 20, 64}, {72, 80, 110, 80}, 30, 1, FX(0, 10, 10, 90), MORE({P_LRATE, 80}, {P_LFADE, 96}, {P_LD_PIT, 1}), TAG(PT_LEAD)},
|
||||
{"DARK STRINGS", {1, 4, 64, 6, 40, 34, 22, 40}, {100, 90, 120, 105}, 10, 0, FX(0, 30, 0, 110), MORE({P_LRATE, 30}, {P_LD_FLT, 8}, {P_LD_PIT, 1}, {P_LFADE, 110}), TAG(PT_PAD)}, /* ((phase 9) hollow and dark, a slow swell) */
|
||||
{"BONE FLUTE", {2, 3, 30, 22, 84, 15, 0, 64}, {56, 80, 110, 64}, 6, 1, FX(0, 15, 30, 85), MORE({P_LRATE, 84}, {P_LFADE, 90}, {P_LD_PIT, 8}), TAG(PT_LEAD)},
|
||||
{"WAR HORN", {0, 5, 64, 4, 42, 12, 20, 64}, {72, 80, 110, 80}, 30, 1, FX(0, 10, 10, 90), MORE({P_LRATE, 80}, {P_LFADE, 96}, {P_LD_PIT, 8}), TAG(PT_LEAD)},
|
||||
{"DARK STRINGS", {1, 4, 64, 6, 40, 34, 22, 40}, {100, 90, 120, 105}, 10, 0, FX(0, 30, 0, 110), MORE({P_LRATE, 30}, {P_LD_FLT, 8}, {P_LD_PIT, 8}, {P_LFADE, 110}), TAG(PT_PAD)}, /* ((phase 9) hollow and dark, a slow swell) */
|
||||
{"NIGHT BASS", {0, 7, 64, 0, 40, 35, 15, 64}, {0, 64, 50, 30}, 45, 1, FX(0, 5, 10, 8), TAG(PT_BASS)},
|
||||
{"NEON LEAD", {0, 14, 64, 0, 92, 25, 12, 64}, {6, 70, 110, 55}, 14, 1, FX(0, 25, 55, 40), MORE({P_LRATE, 86}, {P_LFADE, 92}, {P_LD_PIT, 2}, {P_GLIDE, 28}), TAG(PT_LEAD)},
|
||||
{"NEON LEAD", {0, 14, 64, 0, 92, 25, 12, 64}, {6, 70, 110, 55}, 14, 1, FX(0, 25, 55, 40), MORE({P_LRATE, 86}, {P_LFADE, 92}, {P_LD_PIT, 11}, {P_GLIDE, 28}), TAG(PT_LEAD)},
|
||||
{"SUNSET PAD", {4, 9, 55, 0, 74, 15, 0, 48}, {78, 90, 115, 92}, 10, 0, FX(0, 85, 25, 70), MORE({P_LWAVE, 1}, {P_LRATE, 52}, {P_LD_SHP, 48}), TAG(PT_PAD)},
|
||||
{"HERO BRASS", {0, 16, 64, 0, 50, 18, 8, 56}, {50, 75, 95, 55}, 44, 0, FX(0, 45, 20, 45), TAG(PT_PAD)},
|
||||
{"SYN TOM", {3, 0, 0, 6, 127, 0, 25, 0}, {0, 76, 0, 60}, 0, 0, FX(0, 0, 10, 45), MORE({P_ED_PIT, 63}), TAG(PT_DRUM)},
|
||||
{"QUANTA", {3, 0, 0, 0, 127, 0, 0, 0}, {0, 64, 127, 50}, 0, 1, FX(0, 0, 55, 35), MORE({P_LWAVE, 4}, {P_LRATE, 96}, {P_LD_PIT, 40}), TAG(PT_FX)},
|
||||
{"QUANTA", {3, 0, 0, 0, 127, 0, 0, 0}, {0, 64, 127, 50}, 0, 1, FX(0, 0, 55, 35), MORE({P_LWAVE, 4}, {P_LRATE, 96}, {P_LD_PIT, 50}), TAG(PT_FX)},
|
||||
/* (Skiff phase 9) more for every engine: basses, kits */
|
||||
{"REESE", {0, 40, 64, 0, 52, 15, 30, 32}, {0, 64, 127, 30}, 10, 1, FX(10, 20, 5, 10), MORE({P_LRATE, 30}, {P_LD_FLT, 8}), TAG(PT_BASS)},
|
||||
{"DRIVE BASS", {0, 14, 64, 0, 62, 20, 10, 64}, {0, 64, 64, 25}, 24, 1, FX(40, 0, 5, 5), MORE({P_DTYPE, 1}, {P_DTONE, -32}), TAG(PT_BASS)},
|
||||
|
||||
@@ -216,8 +216,8 @@ static const preset_t FORMANT_PRESETS[] = {
|
||||
{"WOW BASS", {95, 0, 68, 0, 100, 0, 80, 0}, {0, 70, 70, 30}, 0, 1, FX(10, 0, 10, 10), TAG(PT_BASS)},
|
||||
{"WHISPER", {0, 95, 88, 3, 50, 120, 50, 0}, {50, 90, 110, 90}, 0, 0, FX(0, 40, 30, 70), TAG(PT_FX)},
|
||||
/* (Skiff) for the themes: CRYPT (dungeon synth), NEON (synthwave), QUARK (particles) */
|
||||
{"CRYPT CHOIR", {112, 0, 0, -3, 34, 30, 64, 14}, {90, 90, 118, 100}, 0, 0, FX(0, 75, 10, 110), MORE({P_LRATE, 70}, {P_LD_PIT, 1}), TAG(PT_PAD)},
|
||||
{"MONK CHANT", {95, 0, 96, -5, 80, 12, 80, 0}, {50, 80, 115, 85}, 0, 1, FX(0, 20, 10, 110), MORE({P_LRATE, 82}, {P_LFADE, 96}, {P_LD_PIT, 1}), TAG(PT_PAD)},
|
||||
{"CRYPT CHOIR", {112, 0, 0, -3, 34, 30, 64, 14}, {90, 90, 118, 100}, 0, 0, FX(0, 75, 10, 110), MORE({P_LRATE, 70}, {P_LD_PIT, 8}), TAG(PT_PAD)},
|
||||
{"MONK CHANT", {95, 0, 96, -5, 80, 12, 80, 0}, {50, 80, 115, 85}, 0, 1, FX(0, 20, 10, 110), MORE({P_LRATE, 82}, {P_LFADE, 96}, {P_LD_PIT, 8}), TAG(PT_PAD)},
|
||||
{"DREAM CHOIR", {0, 20, 0, 3, 55, 45, 55, 8}, {80, 90, 118, 95}, 0, 0, FX(0, 90, 30, 80), TAG(PT_PAD)},
|
||||
/* (Skiff phase 9) more for every engine: basses, kits */
|
||||
{"ROBOT TALK", {20, 100, 40, -12, 110, 4, 90, 30}, {0, 70, 100, 30}, 0, 1, FX(10, 0, 40, 30), TAG(PT_LEAD)},
|
||||
|
||||
@@ -351,7 +351,7 @@ static const preset_t TRIO_PRESETS[] = {
|
||||
{"RING BELL", {13, 0, 18, 6, 1, 96, 30, 64}, {0, 92, 0, 80}, 0, 0, FX(0, 20, 35, 55), TAG(PT_KEYS)},
|
||||
{"CHIP CHOIR", {1, 0, 12, 7, 1, 62, 95, 40}, {70, 90, 110, 85}, 30, 0, FX(0, 50, 20, 65), TAG(PT_PAD)},
|
||||
/* (Skiff) for the themes: CRYPT (dungeon synth), NEON (synthwave), QUARK (particles) */
|
||||
{"TURBO SYNC", {9, 7, 0, 3, 0, 92, 28, 64}, {2, 72, 105, 45}, 20, 1, FX(6, 15, 55, 30), MORE({P_GLIDE, 24}, {P_LRATE, 86}, {P_LFADE, 90}, {P_LD_PIT, 1}), TAG(PT_LEAD)},
|
||||
{"TURBO SYNC", {9, 7, 0, 3, 0, 92, 28, 64}, {2, 72, 105, 45}, 20, 1, FX(6, 15, 55, 30), MORE({P_GLIDE, 24}, {P_LRATE, 86}, {P_LFADE, 90}, {P_LD_PIT, 8}), TAG(PT_LEAD)},
|
||||
{"NEON ARP", {1, 12, 0, 5, 0, 70, 35, 40}, {0, 66, 0, 45}, 36, 0, FX(0, 25, 70, 25), TAG(PT_PLUCK)},
|
||||
{"COLLIDER", {13, 0, 23, 9, 2, 60, 50, 64}, {0, 70, 0, 55}, 0, 0, FX(8, 10, 50, 50), MORE({P_ED_PIT, 36}), TAG(PT_FX)},
|
||||
/* (Skiff phase 9) more for every engine: basses, kits */
|
||||
|
||||
@@ -276,7 +276,7 @@ static const preset_t WHEEL_PRESETS[] = {
|
||||
{"CATHEDRAL", {12, 2, 0, 0, 0, 6, 0, 0}, {48, 64, 127, 72}, 0, 0, FX(0, 0, 0, 110), TAG(PT_KEYS)},
|
||||
/* (Skiff phase 9) more for every engine: basses, kits */
|
||||
{"PEDAL BASS", {14, 4, 0, -4, 0, 20, 10, 0}, {0, 64, 127, 30}, 0, 1, FX(0, 0, 0, 15), TAG(PT_BASS)},
|
||||
{"CLARINET", {9, 0, 2, -5, 0, 0, 14, 1}, {24, 64, 120, 45}, 0, 1, FX(0, 20, 15, 40), MORE({P_LD_PIT, 1}, {P_LRATE, 89}, {P_LFADE, 70}), TAG(PT_LEAD)},
|
||||
{"CLARINET", {9, 0, 2, -5, 0, 0, 14, 1}, {24, 64, 120, 45}, 0, 1, FX(0, 20, 15, 40), MORE({P_LD_PIT, 8}, {P_LRATE, 89}, {P_LFADE, 70}), TAG(PT_LEAD)},
|
||||
};
|
||||
|
||||
static const engine_t ENG_WHEEL = {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define FELUCCA_ID "FM-1_700" /* package identity (build.py: the .fwsc marker string) */
|
||||
#endif
|
||||
#ifndef FELUCCA_VERSION
|
||||
#define FELUCCA_VERSION "v1.3.1" /* Skiff's; shown in the menu, the console and the editor; build.py --release X.Y */
|
||||
#define FELUCCA_VERSION "v1.3.2" /* Skiff's; shown in the menu, the console and the editor; build.py --release X.Y */
|
||||
#endif
|
||||
#if FELUCCA_OTA && !FELUCCA_FLASH
|
||||
#error "FELUCCA_OTA needs FELUCCA_FLASH"
|
||||
|
||||
+255
-46
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only
|
||||
* Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments */
|
||||
/* Effects: per-track DIST insert, then sends into three
|
||||
* shared buses (chorus, tempo delay, reverb). Mono buses, stereo dry mix. */
|
||||
* shared buses (chorus, tempo delay, reverb). Mono buses (HALL with its stereo difference), stereo dry mix. */
|
||||
#define DLY_LEN 65536u /* 1.49 s: 1/4 at 40 BPM fits */
|
||||
#define CHO_LEN 2048u
|
||||
static int16_t dly_buf[DLY_LEN] __attribute__((section(".pool")));
|
||||
@@ -24,7 +24,6 @@ static struct {
|
||||
int32_t sp_lp, sp_hp, sp_he, sp_size; /* .. its loop low-pass, low cut (and its remainder), the loop
|
||||
* length (Q8, glides) */
|
||||
uint32_t sp_ph; /* .. the output tap's wobble */
|
||||
int32_t hall_y; /* (Skiff phase 9) HALL: its last half-rate output (the line between) */
|
||||
int32_t cho_y; /* (Skiff phase 9) the CHORUS bus: its last output (FEEDBACK), */
|
||||
int32_t ph_s[4]; /* .. PHASER's allpasses */
|
||||
} fx;
|
||||
@@ -46,6 +45,53 @@ static struct {
|
||||
* |x - o| < 749000, far past any peak the chain reaches) */
|
||||
_Static_assert(sizeof rev_comb / 2u >= SP_LEN && sizeof rev_u.sp / 4u >= 4u * (SP_N + 1u), "SPRING in ROOM's buffers");
|
||||
|
||||
/* HALL (G_RTYPE 2, 1.2; (Skiff #19) Felucca's, in place of phase 9's ROOM at half the rate, which was mono): a smooth,
|
||||
* dense, stereo reverb, again in ROOM's buffers (its few states and one block
|
||||
* of work in the pool, no .bss). ROOM's 4 combs each ring on their own (the metallic tone); here every echo
|
||||
* goes round 8 lines that all feed each other, and they run at half the rate (22.05 kHz: the same memory holds
|
||||
* twice the time, so twice the resonances, at half the work; the tail stops near 10 kHz, as a hall's air
|
||||
* does). The send (every other sample of it, low-passed 1 2 1; ROOM's level) -> a low cut (~110 Hz: no boom
|
||||
* in a long tail) -> 2 allpass diffusers (rev_ap: a drum's click smeared into a burst) -> into the 8 lines
|
||||
* (rev_comb, mutually prime lengths, 21 .. 34 ms). Lines 1, 2, 4, 7 are read through slow sines (+-HL_MOD
|
||||
* samples, between samples; 0.37 or 0.74 Hz, each in its own phase): the resonances drift instead of ringing.
|
||||
* Lines 0, 3, 5, 6, read at their ends, go through a one-pole low-pass (DAMP: the mixing takes every echo
|
||||
* through them); every
|
||||
* line through its gain (from its length: all decay alike; RT60 below the damping 0.5 s at SIZE 0, 4 s at
|
||||
* 90, 9 s at 127; ~2.4 s heard at 90 with DAMP 60); then the 8 x 8 mixing: a conference matrix (Paley,
|
||||
* order 8: every line feeds the 7 others, +-1 each, none itself: no flutter at a line's own length), with
|
||||
* the send added. Stereo: left lines 0 3 4 -7, right 1 2 5 6 (sums spread over the matrix's rows); the wet
|
||||
* bus (mono) gets left + right, rev_side left - right, which mix_block adds to the left and takes from the
|
||||
* right (rev_side_mix). Back to 44.1 kHz between samples. Rounding: a loud line's gain rounds to the nearest
|
||||
* (the tail decays as it should), a quiet one's towards zero (it ends in exact silence: no limit cycle), and
|
||||
* the low-passes keep their steps' remainders (no offset). */
|
||||
#define HL_NL 8u /* lines */
|
||||
#define HL_NAP 2u /* diffusers */
|
||||
#define HL_NC (CTL / 2u) /* a block at half the rate */
|
||||
#define HL_MOD 8 /* the taps' swing, samples (read 2 .. 18 samples short of the end) */
|
||||
#define HL_LPM 0x69u /* the lines with a low-pass */
|
||||
#define HL_KD(d) (32767 - (d) * 180) /* its coefficient (Q15) for DAMP d: none at 0 .. ~1 kHz at 127 */
|
||||
#define HL_LOUD 32 /* a line this loud (two samples' sum) rounds its gain to the nearest */
|
||||
#define HL_OUT 4 /* the outputs' gain: the level of ROOM's tail */
|
||||
static const uint16_t HL_LEN[HL_NL] = {467, 509, 547, 593, 631, 673, 709, 743}; /* (+1 each: the mirror) */
|
||||
static const uint16_t HL_AP[HL_NAP] = {131, 307};
|
||||
static const int16_t HL_APG[HL_NAP] = {11469, 10240}; /* Q14: 0.7, 0.625 */
|
||||
_Static_assert(467 + 509 + 547 + 593 + 631 + 673 + 709 + 743 + HL_NL <= sizeof rev_comb / 2u &&
|
||||
131 + 307 <= sizeof rev_u.ap / 2u, "HALL in ROOM's buffers");
|
||||
_Static_assert(CTL % 2u == 0u && HL_NC + 2u * HL_MOD + 2u < 467u && HL_NC <= 131u, "HALL: one wrap a block at most");
|
||||
static struct { /* HALL's state (in the pool: no .bss) */
|
||||
uint16_t i[HL_NL], d[HL_NAP]; /* the lines' write indices, the diffusers' */
|
||||
int32_t lp[HL_NL], le[HL_NL]; /* the low-passes and their steps' remainders */
|
||||
int32_t x, m, s, hp, he; /* the send's last sample, its low cut and that step's remainder; the
|
||||
* last mid and side out (half rate) */
|
||||
int16_t g[HL_NL], sz; /* the lines' gains / sqrt(7) (Q14), for SIZE sz - 1 (0: none yet) */
|
||||
uint32_t ph; /* the taps' drift */
|
||||
uint8_t side; /* sd holds this block's stereo difference (HALL running) */
|
||||
int32_t sd[CTL]; /* the block's left minus right (mix_block: rev_side_mix) */
|
||||
int32_t bx[HL_NC], l[HL_NC], r[HL_NC]; /* the block at half the rate: the diffused send, left, right */
|
||||
int16_t y[HL_NL][HL_NC]; /* the lines' ends, then what goes back into them */
|
||||
} hl __attribute__((section(".pool")));
|
||||
#define rev_side (hl.sd)
|
||||
|
||||
/* (Skiff phase 9) FX > DRIVE: DIST's kind (P_DTYPE) at the same drive (P_DIST), and its TONE (P_DTONE, -64..63: the
|
||||
* tone low-pass moved from where the drive puts it; 0 as before). SOFT: the soft clip below, as before. HARD: the
|
||||
* drive into a flat clip at 3/4 of full scale (odd harmonics: a buzz). FOLD: the drive into a triangle wavefolder, a
|
||||
@@ -289,40 +335,177 @@ static __attribute__((noinline)) void rev_room(const int32_t *rev_in, int32_t *o
|
||||
}
|
||||
}
|
||||
|
||||
/* (Skiff phase 9) HALL (G_RTYPE 2): ROOM's combs and allpasses at half the rate, in ROOM's own buffers: every other
|
||||
* sample, the pair's mean in, and from the last output to this one a straight line out. Twice the lengths (combs of
|
||||
* 50 .. 61 ms): a bigger, darker space (nothing above ~11 kHz), each SIZE a longer tail; about half ROOM's work */
|
||||
/* HALL's helpers: m / 2^sh rounded towards zero (a product that feeds back must not floor: a loop of floors
|
||||
* holds an offset and a little noise for ever) */
|
||||
static inline int32_t sh_tz(int32_t m, uint32_t sh) { return (m + ((m >> 31) & ((1 << sh) - 1))) >> sh; }
|
||||
/* 2^-x, x Q16 (0 .. 16): Q15 (32768 at x = 0). 2^-x = 2^u / 2^(i + 1), u = 1 - frac(x); 2^u by a cubic (1e-4) */
|
||||
static uint32_t exp2_neg(uint32_t x)
|
||||
{
|
||||
uint32_t i = x >> 16, u = 32768u - ((x & 0xFFFFu) >> 1), p = 2579u;
|
||||
p = ((p * u) >> 15) + 7409u;
|
||||
p = ((p * u) >> 15) + 22780u;
|
||||
p = ((p * u) >> 15) + 32768u;
|
||||
return i < 15u ? p >> (i + 1u) : 0u;
|
||||
}
|
||||
/* the lines' gains for SIZE s: RT60 = 0.5 s * 2^(s / 30); a line of D samples (22.05 kHz) loses 60 dB in
|
||||
* RT60 * 22050 / D passes: g = 2^(-D * 3 log2(10) / (22050 * RT60)) = 2^(-D * 59.2 / 65536 * 2^(-s / 30)),
|
||||
* at most 0.99, over sqrt(7) (the matrix's rows have 7 entries of +-1: / sqrt(7) makes it orthogonal) */
|
||||
static __attribute__((noinline)) void hall_gains(int32_t s)
|
||||
{
|
||||
uint32_t q = exp2_neg((uint32_t)s * 65536u / 30u), k, g;
|
||||
for (k = 0; k < HL_NL; k++) {
|
||||
g = exp2_neg((HL_LEN[k] * 59u * q) >> 15);
|
||||
hl.g[k] = (int16_t)(((g > 32440u ? 32440u : g) * 6193u) >> 15);
|
||||
}
|
||||
hl.sz = (int16_t)(s + 1);
|
||||
}
|
||||
|
||||
/* an allpass diffuser over x[0 .. n) from q (its next samples, no wrap): its state rounded towards zero */
|
||||
static inline void hall_ap(int16_t *q, int32_t g, int32_t *x, uint32_t n)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n; i++) {
|
||||
int32_t y = q[i], v = x[i] + sh_tz(y * g, 14);
|
||||
q[i] = (int16_t)clamp(v, -32768, 32767);
|
||||
x[i] = y - ((v * g + 8192) >> 14);
|
||||
}
|
||||
}
|
||||
/* a line's end over y[0 .. n) from b (no wrap; b[n] is still the line's: its mirror at the end): between b[i]
|
||||
* and b[i + 1], f / 256 of the way (rounded to the nearest: it stays between the two), times its gain g (Q14).
|
||||
* The gain's product: rounded to the nearest while the line is loud (lo 0: the tail decays as it should; a
|
||||
* truncation would make it die early, the sooner the quieter), towards zero once it is quiet (lo 1: the last
|
||||
* steps of the tail, which then ends in exact silence) */
|
||||
static inline void hall_end(const int16_t *b, int32_t f, int16_t *y, uint32_t n, int32_t g, int lo)
|
||||
{
|
||||
uint32_t i;
|
||||
if (lo)
|
||||
for (i = 0; i < n; i++)
|
||||
y[i] = (int16_t)sh_tz((b[i] + (((b[i + 1u] - b[i]) * f + 128) >> 8)) * g, 14);
|
||||
else
|
||||
for (i = 0; i < n; i++)
|
||||
y[i] = (int16_t)(((b[i] + (((b[i + 1u] - b[i]) * f + 128) >> 8)) * g + 8192) >> 14);
|
||||
}
|
||||
/* a line's end over y[0 .. n) from b (no wrap), through the low-pass (kd, Q15; the state *lp and its step's
|
||||
* remainder *le), times its gain g (rounded as hall_end's) */
|
||||
static inline void hall_end_lp(const int16_t *b, int16_t *y, uint32_t n, int32_t g, int lo, int32_t *lp, int32_t *le,
|
||||
int32_t kd)
|
||||
{
|
||||
uint32_t i;
|
||||
int32_t l = *lp, r = *le, e;
|
||||
if (lo)
|
||||
for (i = 0; i < n; i++) {
|
||||
e = (b[i] - l) * kd + r, r = e & 32767, l += e >> 15;
|
||||
y[i] = (int16_t)sh_tz(l * g, 14);
|
||||
}
|
||||
else
|
||||
for (i = 0; i < n; i++) {
|
||||
e = (b[i] - l) * kd + r, r = e & 32767, l += e >> 15;
|
||||
y[i] = (int16_t)((l * g + 8192) >> 14);
|
||||
}
|
||||
*lp = l;
|
||||
*le = r;
|
||||
}
|
||||
/* the block's HL_NC samples of a circular buffer of len from index d in at most two runs, no wrap inside them:
|
||||
* body with s (the run's start in the block) and k (its length); d moves on */
|
||||
#define HL_RUNS(d, len, k, s, body) \
|
||||
for (s = 0; s < HL_NC; s += k) { \
|
||||
k = (len) - (d) < HL_NC - s ? (len) - (d) : HL_NC - s; \
|
||||
body; \
|
||||
d = (d) + k >= (len) ? 0u : (d) + k; \
|
||||
}
|
||||
|
||||
/* HALL (see the top): a block of the send (n = CTL samples: audio.c) -> the mid added to out, the side into
|
||||
* rev_side. At half the rate (HL_NC samples) in passes over the block, each with few states (every line is
|
||||
* longer than a block: what the lines give in this block was written before it): the send, every other
|
||||
* sample, low cut, diffusers (hl.bx); the lines' ends at their drifting taps, low-passed, scaled (hl.y); the
|
||||
* outputs and the matrix; back into the lines; the outputs back to 44.1 kHz. */
|
||||
#define HL_LFO ((uint32_t)(0.37 * CTL / FS * 4294967296.0)) /* the drift: 0.37 Hz (even lines), 0.74 Hz (odd) */
|
||||
static __attribute__((noinline)) void rev_hall(const int32_t *rev_in, int32_t *out, uint32_t n)
|
||||
{
|
||||
uint32_t i, k;
|
||||
int32_t size = 25000 + song.g[G_RSIZE] * 50, damp = 32767 - song.g[G_RDAMP] * 200;
|
||||
for (i = 0; i + 1u < n; i += 2u) {
|
||||
int32_t a = 0;
|
||||
int16_t *c = rev_comb;
|
||||
int32_t in = mulq15((rev_in[i] + rev_in[i + 1u]) >> 1, 2580);
|
||||
for (k = 0; k < 4u; k++) {
|
||||
int32_t o = c[fx.comb_i[k]];
|
||||
fx.comb_lp[k] = o + mulq15(fx.comb_lp[k] - o, 32767 - damp);
|
||||
c[fx.comb_i[k]] = (int16_t)clamp(in + mulq15(fx.comb_lp[k], size), -32768, 32767);
|
||||
if (++fx.comb_i[k] >= REV_COMB[k])
|
||||
fx.comb_i[k] = 0;
|
||||
a += o;
|
||||
c += REV_COMB[k];
|
||||
}
|
||||
c = rev_ap;
|
||||
for (k = 0; k < 2u; k++) {
|
||||
int32_t o = c[fx.ap_i[k]];
|
||||
int32_t v = a + (o >> 1);
|
||||
c[fx.ap_i[k]] = (int16_t)clamp(v, -32768, 32767);
|
||||
a = o - a;
|
||||
if (++fx.ap_i[k] >= REV_AP[k])
|
||||
fx.ap_i[k] = 0;
|
||||
c += REV_AP[k];
|
||||
}
|
||||
out[i] += (fx.hall_y + a) >> 1;
|
||||
out[i + 1u] += a;
|
||||
fx.hall_y = a;
|
||||
int16_t *b = rev_comb, *a = rev_ap;
|
||||
uint32_t i, k, s, m, d;
|
||||
int32_t kd = HL_KD(song.g[G_RDAMP]);
|
||||
int32_t xp = hl.x, hp = hl.hp, he = hl.he, mp = hl.m, sp = hl.s;
|
||||
(void)n;
|
||||
if (hl.sz != song.g[G_RSIZE] + 1)
|
||||
hall_gains(song.g[G_RSIZE]);
|
||||
for (i = 0; i < HL_NC; i++) {
|
||||
int32_t x = (xp + 2 * rev_in[2u * i] + rev_in[2u * i + 1u]) >> 2, v; /* every other sample, 1 2 1 */
|
||||
xp = rev_in[2u * i + 1u];
|
||||
x = mulq15(clamp(x, -262143, 262143), 2580); /* (ROOM's level) */
|
||||
v = x - hp + he; /* the low cut, its step's remainder kept */
|
||||
he = v & 31;
|
||||
hp += v >> 5;
|
||||
hl.bx[i] = x - hp;
|
||||
}
|
||||
hl.x = xp, hl.hp = hp, hl.he = he;
|
||||
for (k = 0; k < HL_NAP; k++) { /* the diffusers */
|
||||
d = hl.d[k];
|
||||
HL_RUNS(d, HL_AP[k], m, s, hall_ap(a + d, HL_APG[k], hl.bx + s, m));
|
||||
hl.d[k] = (uint16_t)d;
|
||||
a += HL_AP[k];
|
||||
}
|
||||
hl.ph += HL_LFO;
|
||||
for (k = 0; k < HL_NL; k++) { /* the lines' ends */
|
||||
int32_t g = hl.g[k], f = 0, lo;
|
||||
if ((HL_LPM >> k) & 1u)
|
||||
d = hl.i[k]; /* (low-passed: the line's end) */
|
||||
else { /* (drifting: HL_MOD + 2 +- HL_MOD samples short of it) */
|
||||
uint32_t r = (uint32_t)(((HL_MOD + 2) << 8) +
|
||||
((osc_sine(hl.ph * (1u + (k & 1u)) + k * 0x2C000000u) * HL_MOD) >> 7));
|
||||
f = (int32_t)(r & 255u);
|
||||
d = hl.i[k] + (r >> 8);
|
||||
d = d >= HL_LEN[k] ? d - HL_LEN[k] : d;
|
||||
}
|
||||
s = d + HL_LEN[k] / 2u; /* quiet? (two samples half a line apart) */
|
||||
s = s >= HL_LEN[k] ? s - HL_LEN[k] : s;
|
||||
lo = (b[d] < 0 ? -b[d] : b[d]) + (b[s] < 0 ? -b[s] : b[s]) < HL_LOUD;
|
||||
if ((HL_LPM >> k) & 1u) {
|
||||
HL_RUNS(d, HL_LEN[k], m, s, hall_end_lp(b + d, hl.y[k] + s, m, g, lo, &hl.lp[k], &hl.le[k], kd));
|
||||
} else {
|
||||
HL_RUNS(d, HL_LEN[k], m, s, hall_end(b + d, f, hl.y[k] + s, m, g, lo));
|
||||
}
|
||||
b += HL_LEN[k] + 1u;
|
||||
}
|
||||
for (i = 0; i < HL_NC; i++) {
|
||||
int32_t y0 = hl.y[0][i], y1 = hl.y[1][i], y2 = hl.y[2][i], y3 = hl.y[3][i];
|
||||
int32_t y4 = hl.y[4][i], y5 = hl.y[5][i], y6 = hl.y[6][i], y7 = hl.y[7][i], x = hl.bx[i];
|
||||
int32_t t, p0, p1, p2, p3, p4, p5, p6;
|
||||
hl.l[i] = y0 + y3 + y4 - y7; /* the outputs */
|
||||
hl.r[i] = y1 + y2 + y5 + y6;
|
||||
/* the matrix: C = [0 1; -1 Q], Q (7 x 7) = chi(j - i), the quadratic character mod 7 (+1 at distances
|
||||
* 1 2 4, -1 at 3 5 6): row 1 + i of Q y = 2 (the three at +1) - (the sum of the 7) + y_1+i */
|
||||
t = y1 + y2 + y3 + y4 + y5 + y6 + y7;
|
||||
p0 = y2 + y3 + y5, p1 = y3 + y4 + y6, p2 = y4 + y5 + y7, p3 = y5 + y6 + y1;
|
||||
p4 = y6 + y7 + y2, p5 = y7 + y1 + y3, p6 = y1 + y2 + y4;
|
||||
y0 += t;
|
||||
hl.y[0][i] = (int16_t)clamp(t + x, -32768, 32767); /* (+ the send: signs spread over the rows) */
|
||||
hl.y[1][i] = (int16_t)clamp(2 * p0 + y1 - y0 + x, -32768, 32767);
|
||||
hl.y[2][i] = (int16_t)clamp(2 * p1 + y2 - y0 + x, -32768, 32767);
|
||||
hl.y[3][i] = (int16_t)clamp(2 * p2 + y3 - y0 + x, -32768, 32767);
|
||||
hl.y[4][i] = (int16_t)clamp(2 * p3 + y4 - y0 + x, -32768, 32767);
|
||||
hl.y[5][i] = (int16_t)clamp(2 * p4 + y5 - y0 + x, -32768, 32767);
|
||||
hl.y[6][i] = (int16_t)clamp(2 * p5 + y6 - y0 + x, -32768, 32767);
|
||||
hl.y[7][i] = (int16_t)clamp(2 * p6 + y7 - y0 - x, -32768, 32767);
|
||||
}
|
||||
b = rev_comb;
|
||||
for (k = 0; k < HL_NL; k++) { /* back into the lines (and the mirror after a wrap) */
|
||||
d = hl.i[k];
|
||||
HL_RUNS(d, HL_LEN[k], m, s, for (i = 0; i < m; i++) b[d + i] = hl.y[k][s + i]; if (!d) b[HL_LEN[k]] = b[0]);
|
||||
hl.i[k] = (uint16_t)d;
|
||||
b += HL_LEN[k] + 1u;
|
||||
}
|
||||
for (i = 0; i < HL_NC; i++) { /* back to 44.1 kHz, between samples */
|
||||
int32_t mm = (hl.l[i] + hl.r[i]) * HL_OUT, ss = (hl.l[i] - hl.r[i]) * HL_OUT;
|
||||
out[2u * i] += (mp + mm) >> 1;
|
||||
out[2u * i + 1u] += mm;
|
||||
rev_side[2u * i] = (sp + ss) >> 1;
|
||||
rev_side[2u * i + 1u] = ss;
|
||||
mp = mm;
|
||||
sp = ss;
|
||||
}
|
||||
hl.m = mp, hl.s = sp;
|
||||
hl.side = 1;
|
||||
}
|
||||
|
||||
/* SPRING (see the top), added to out */
|
||||
@@ -379,8 +562,10 @@ static void rev_clear(void)
|
||||
rev_u.ap[i] = 0;
|
||||
for (i = 0; i < 4u; i++)
|
||||
fx.comb_lp[i] = 0;
|
||||
for (i = 0; i < HL_NL; i++)
|
||||
hl.lp[i] = hl.le[i] = 0;
|
||||
fx.sp_lp = fx.sp_hp = fx.sp_he = 0;
|
||||
fx.hall_y = 0;
|
||||
hl.x = hl.m = hl.s = hl.hp = hl.he = 0;
|
||||
}
|
||||
static void rev_model(uint32_t m, const int32_t *rev_in, int32_t *out, uint32_t n) /* G_RTYPE m, added to out */
|
||||
{
|
||||
@@ -472,7 +657,25 @@ static int32_t part_buf[CTL]; /* a part's block (mix_
|
||||
#define SM1_b part_buf
|
||||
#endif
|
||||
|
||||
/* process the three buses for one block; sends in, wet stereo-equal out */
|
||||
/* the model changed (to rt): the old one's block fades out (HALL's stereo difference with it), its buffers are
|
||||
* cleared, the new one starts from silence */
|
||||
static __attribute__((noinline)) void rev_switch(const int32_t *rev_in, int32_t *wet, uint32_t n, int32_t rt)
|
||||
{
|
||||
int32_t *t = part_buf, g = 65536, d = 65536 / (int32_t)n;
|
||||
uint32_t i;
|
||||
for (i = 0; i < n; i++)
|
||||
t[i] = 0;
|
||||
rev_model(fx.rtype, rev_in, t, n);
|
||||
for (i = 0; i < n; i++, g -= d) {
|
||||
wet[i] += mulq16(t[i], (uint32_t)g);
|
||||
rev_side[i] = mulq16(rev_side[i], (uint32_t)g); /* (HALL only: hl.side set) */
|
||||
}
|
||||
rev_clear();
|
||||
fx.rtype = (uint8_t)rt;
|
||||
}
|
||||
|
||||
/* process the three buses for one block; sends in, wet out (the same to both sides; HALL's stereo difference in
|
||||
* rev_side, hl.side set) */
|
||||
static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t *rev_in, int32_t *wet,
|
||||
uint32_t n)
|
||||
{
|
||||
@@ -508,18 +711,22 @@ static void fx_buses(const int32_t *cho_in, const int32_t *dly_in, const int32_t
|
||||
wet[i] = y;
|
||||
}
|
||||
rt = song.g[G_RTYPE] == 1 || song.g[G_RTYPE] == 2 ? song.g[G_RTYPE] : 0; /* (phase 9) HALL) */
|
||||
if (rt != fx.rtype) { /* the model changed: the old one's block fades out, */
|
||||
int32_t *t = part_buf, g = 65536, d = 65536 / (int32_t)n; /* its buffers are cleared, the new */
|
||||
for (i = 0; i < n; i++) /* one starts from silence */
|
||||
t[i] = 0;
|
||||
rev_model(fx.rtype, rev_in, t, n);
|
||||
for (i = 0; i < n; i++, g -= d)
|
||||
wet[i] += mulq16(t[i], (uint32_t)g);
|
||||
rev_clear();
|
||||
fx.rtype = (uint8_t)rt;
|
||||
return;
|
||||
hl.side = 0;
|
||||
if (rt != fx.rtype)
|
||||
rev_switch(rev_in, wet, n, rt);
|
||||
else
|
||||
rev_model((uint32_t)rt, rev_in, wet, n);
|
||||
}
|
||||
|
||||
/* after the buses: HALL's stereo difference to the left and from the right of the dry mix (the wet bus adds the
|
||||
* same to both) */
|
||||
static __attribute__((noinline)) void rev_side_mix(int32_t *l, int32_t *r, uint32_t n)
|
||||
{
|
||||
uint32_t i;
|
||||
for (i = 0; i < n; i++) {
|
||||
l[i] += rev_side[i];
|
||||
r[i] -= rev_side[i];
|
||||
}
|
||||
rev_model((uint32_t)rt, rev_in, wet, n);
|
||||
}
|
||||
|
||||
/* one block of the whole mix (shared with hostsim.c): events -> each part (with its modulation matrix)
|
||||
@@ -982,6 +1189,8 @@ static void mix_block(int32_t *out, uint32_t n)
|
||||
if (perf)
|
||||
AUDIO_FAR(perf_pre)(mix_l, mix_r, send_d, send_r, n);
|
||||
fx_buses(send_c, send_d, send_r, wet, n);
|
||||
if (hl.side)
|
||||
rev_side_mix(mix_l, mix_r, n); /* HALL: stereo */
|
||||
if (perf) {
|
||||
AUDIO_FAR(perf_master)(out, n);
|
||||
return;
|
||||
|
||||
+2
-1
@@ -18,7 +18,8 @@
|
||||
* random line, one cycle behind S&H); bipolar. Both per track (one value for every voice)
|
||||
* Destinations:
|
||||
* per voice (vmod_t, like the fixed routings):
|
||||
* PITCH AMT 63 at a full source = +-11.8 semitones (as LFO DEST PIT)
|
||||
* PITCH AMT 63 at a full source = +-11.8 semitones (as LFO DEST PIT at 63; linear here, LFO DEST PIT squared
|
||||
* since Skiff 1.3.2: voice.c lfo_pitch)
|
||||
* CUT m->cutoff, SHP m->shape: AMT 63 = +-63 steps (as ENV DEST); the sums are clamped to what
|
||||
* the fixed routings can reach, so the engines see no new range
|
||||
* AMP a gain <= 1: AMT > 0 the source opens it (AMT 64: silent at 0, full at 1), AMT < 0 closes it
|
||||
|
||||
+9
-11
@@ -413,19 +413,17 @@ static void draw_menu(void)
|
||||
int32_t pos0 = mt.pos;
|
||||
if (ui.menu == 1)
|
||||
mt_follow();
|
||||
sig = ui.menu * 7u + ui.menu_sel * 131u + settings.palette * 1009u + settings.lowcut * 7919u + settings_hold * 3511u +
|
||||
settings_leds * 6151u + ui_prefs * 4099u + song.rec * 65537u + song.sel * 13u +
|
||||
sig = ui.menu * 7u + ui.menu_sel * 131u + ui_prefs * 4099u + song.rec * 65537u + song.sel * 13u +
|
||||
ui_rec_prefs * 92821u +
|
||||
(ui.menu == 2 ? ui.menu_scroll * 48611u : 0u) +
|
||||
/* (1.2.1) the rows' values that live elsewhere: TUNE, CLOCK, MIDI IN, HINTS, and the load SYSTEM > CPU shows, so
|
||||
* a step or a change of the load redraws them (they stayed as drawn until the cursor moved); ((Skiff 1.3) the
|
||||
* CPU row's cores too) */
|
||||
(uint32_t)song.g[G_TUNE] * 24593u + (uint32_t)song.g[G_CLOCK] * 769u + (uint32_t)song.g[G_ROUTE] * 1543u +
|
||||
ui_hints_off * 3079u + menu_get(MI_CPU) * 18451u + song.cpu_q8 * 100u / 256u * 12289u +
|
||||
ml_count() * 2741u + ui.ml.on * 3463u + (uint32_t)(ui_mch(0) + ui_mch(1) * 3u + ui_mch(2) * 7u + ui_mch(3) * 11u +
|
||||
ui_mch(4) * 13u + ui_mch(5) * 17u) * 5101u + /* ((1.3) LEARN's count, the tracks' channels) */
|
||||
(uint32_t)transport_busy() * 40503u + /* ((Skiff 1.3) CPU's STOP / RESTART) */
|
||||
menu_get(MI_CLK) * 30011u; /* ((Skiff) CPU CLOCK) */
|
||||
/* (1.2.1) what the rows show besides their values: the load SYSTEM > CPU shows, so a change of it redraws (the
|
||||
* rows stayed as drawn until the cursor moved); ((1.3) LEARN's count and state; CPU's STOP / RESTART) */
|
||||
song.cpu_q8 * 100u / 256u * 12289u + ml_count() * 2741u + ui.ml.on * 3463u +
|
||||
(uint32_t)transport_busy() * 40503u;
|
||||
for (k = 0; k < MI_VALUES; k++) /* ((Skiff, after 1.3.1) every row's value, wherever it lives, so a
|
||||
* step redraws it: the list of them by hand this replaces had
|
||||
* missed STEP PREVIEW and SCREEN OFF) */
|
||||
sig = sig * 31u + menu_get(k);
|
||||
if (!ui.force && sig == ui.menu_sig) {
|
||||
if (ui.menu == 1 && mt.pos != pos0) { /* only the tabs slid: their strip */
|
||||
cv_begin(240, MP_Y - H_HEAD, T_BG);
|
||||
|
||||
+17
-4
@@ -678,6 +678,17 @@ static __attribute__((noinline)) void spread_sum(int32_t *out, const int32_t *sb
|
||||
for (i = 0; i < n; i++)
|
||||
out[i] += sb[i];
|
||||
}
|
||||
/* (Skiff 1.3.2) LFO DEST PITCH: depth d (-64..63) squared, so its low values are a fine vibrato: at a full LFO
|
||||
* d|d| x 0.762 / 16 semitone, d 63 the +-11.8 semitones it always reached, 8 +-19 cents (1 up to 1.3.1: one step was
|
||||
* +-19 cents, a clear vibrato at "1 %"). In 1/4096 semitone, then whole 1/16 semitones and the rest as TUNE's fine
|
||||
* factor: a smooth wobble, no 6-cent stairs */
|
||||
static void lfo_pitch(int32_t lfo, int32_t d, int32_t *p16, int32_t *fine)
|
||||
{
|
||||
int32_t o = (lfo * ((d * (d < 0 ? -d : d) * 780) >> 6)) >> 15; /* (|lfo| x 49920 < 2^31) */
|
||||
*p16 = o >> 8;
|
||||
*fine = ((o & 255) * 3787 + 32768) >> 16; /* 1/4096 semitone -> 1/4096 of the rate (1 ct = 2.367), to the
|
||||
* nearest (1 is then 0.42 ct, not 0) */
|
||||
}
|
||||
static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
|
||||
{
|
||||
const engine_t *e = ENGINES[t->engine];
|
||||
@@ -700,6 +711,7 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
|
||||
bend16 = bend >> 4; /* (floor(bend / 16), as it was written with a divide: ((1.3) a
|
||||
* shift, no slow path for the ISR budget's static count) */
|
||||
bend_fine = (bend - bend16 * 16) * 2367 / 2560;
|
||||
int32_t lpit, lfine; /* (Skiff 1.3.2) LFO DEST PITCH: lfo_pitch */
|
||||
uint32_t nr = 0, fade = t->xf_on && t->xf;
|
||||
int16_t pe_new[8];
|
||||
int32_t *sb = SPREAD_BUF(t);
|
||||
@@ -719,6 +731,7 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
|
||||
#endif
|
||||
if (MOD(t).on && MOD(t).ldep < 32767) /* ((1.3) the matrix's DEPTH, mod.c) */
|
||||
lfo = mulq15(lfo, MOD(t).ldep);
|
||||
lfo_pitch(lfo, p[P_LD_PIT], &lpit, &lfine); /* ((Skiff 1.3.2) the vibrato: one for every voice) */
|
||||
esync_coef(t); /* ((1.3) this block's envelope steps for env_tick: ENV SYNC) */
|
||||
if (e->block) /* the engine's per-part work (WHEEL: bars, rotor) */
|
||||
e->block(t);
|
||||
@@ -760,12 +773,12 @@ static uint32_t track_render(track_t *t, int32_t *out, uint32_t n)
|
||||
}
|
||||
if (!env && !m.amp0 && v->stage == 2 && !e->sampled)
|
||||
continue; /* held at a silent sustain (SUS 0): nothing to render */
|
||||
pitch = v->pitch_cur + tune + bend16 + ((lfo * p[P_LD_PIT] * 3) >> 15) + ((m.envq15 * p[P_ED_PIT] * 3) >> 15);
|
||||
pitch = v->pitch_cur + tune + bend16 + lpit + ((m.envq15 * p[P_ED_PIT] * 3) >> 15);
|
||||
m.pitch16 = clamp(pitch, 0, 2047);
|
||||
m.inc = pitch_inc(m.pitch16);
|
||||
m.fine = v->fine + tune_fine + bend_fine;
|
||||
if (v->fine + tune_fine + bend_fine) /* residual below 1/16 semitone */
|
||||
m.inc += (uint32_t)((int32_t)(m.inc >> 12) * (v->fine + tune_fine + bend_fine));
|
||||
m.fine = v->fine + tune_fine + bend_fine + lfine;
|
||||
if (m.fine) /* residual below 1/16 semitone */
|
||||
m.inc += (uint32_t)((int32_t)(m.inc >> 12) * m.fine);
|
||||
m.cutoff = ((lfo * p[P_LD_FLT]) >> 7) + ((m.envq15 * p[P_ED_FLT]) >> 7);
|
||||
if (v->vel > 110) /* accent opens the filter with the env */
|
||||
m.cutoff += (m.envq15 * 24) >> 7;
|
||||
|
||||
+12
-12
@@ -11,16 +11,16 @@ preset/ANALOG/07_SUB_BASS 494b91d900b36aec
|
||||
preset/ANALOG/08_SYNTH_PLUCK a8060629ca06fb68
|
||||
preset/ANALOG/09_SYNTH_BRASS 5687cf7b6f558044
|
||||
preset/ANALOG/10_WIND_SWEEP 8a038e70ab813a10
|
||||
preset/ANALOG/11_STRINGS 4833e163ce732de0
|
||||
preset/ANALOG/12_BONE_FLUTE daebafe649c79760
|
||||
preset/ANALOG/13_WAR_HORN cfafd7e4b838e360
|
||||
preset/ANALOG/14_DARK_STRINGS 679a67020d979cb0
|
||||
preset/ANALOG/11_STRINGS a0d8268f3448b104
|
||||
preset/ANALOG/12_BONE_FLUTE fb396185a0679c2c
|
||||
preset/ANALOG/13_WAR_HORN 283e0702d8736da0
|
||||
preset/ANALOG/14_DARK_STRINGS 9b780a870904fe28
|
||||
preset/ANALOG/15_NIGHT_BASS e8a9bc68ad928928
|
||||
preset/ANALOG/16_NEON_LEAD 4bfc30e4ad4a8868
|
||||
preset/ANALOG/16_NEON_LEAD 6d611f869288e5ac
|
||||
preset/ANALOG/17_SUNSET_PAD 27921a121bb4e7d0
|
||||
preset/ANALOG/18_HERO_BRASS 541b50a0a9f18668
|
||||
preset/ANALOG/19_SYN_TOM c890553987662eb0
|
||||
preset/ANALOG/20_QUANTA 02f7ac477c82b808
|
||||
preset/ANALOG/20_QUANTA 2aac1a727bfd326c
|
||||
preset/ANALOG/21_REESE 08822311fe5d8748
|
||||
preset/ANALOG/22_DRIVE_BASS 1c89b6d7a65e634c
|
||||
preset/ANALOG/23_HARD_SYNC 2aa24fbb62594bb8
|
||||
@@ -47,17 +47,17 @@ preset/SAMPLE/01_PIANO 069e63129f9b1ee4
|
||||
preset/SAMPLE/02_FLUTE d5b86b5d1c2aaad4
|
||||
preset/SAMPLE/03_SAX 0e1328e616fdbeec
|
||||
preset/SAMPLE/04_PIANO 069e63129f9b1ee4
|
||||
preset/SAMPLE/05_LOFI_PIANO 0cf88744d9728d34
|
||||
preset/SAMPLE/05_LOFI_PIANO 5d371cdf4c78e310
|
||||
preset/SAMPLE/06_MUSIC_BOX 726278d1cab67c9c
|
||||
preset/SAMPLE/07_FLUTE_PAD a226e96d69324bcc
|
||||
preset/SAMPLE/08_DARK_SAX f34199e60614837c
|
||||
preset/SAMPLE/08_DARK_SAX c2c9d66c25bab8d8
|
||||
preset/SAMPLE/09_KOTO eb902a7995418fac
|
||||
preset/VOICE/00_CHOIR_AAH 2e617411a71be888
|
||||
preset/VOICE/01_VOX_LEAD 5d0b545bf96c234c
|
||||
preset/VOICE/02_WOW_BASS 12ec9334413aab38
|
||||
preset/VOICE/03_WHISPER e0fe82b7e146727c
|
||||
preset/VOICE/04_CRYPT_CHOIR 868e97fc8eecd410
|
||||
preset/VOICE/05_MONK_CHANT 555e516d71ad30c0
|
||||
preset/VOICE/04_CRYPT_CHOIR 05bcb79851ffb320
|
||||
preset/VOICE/05_MONK_CHANT 0cad83eb51a6fdbc
|
||||
preset/VOICE/06_DREAM_CHOIR 0fda1f12f0d2cb5c
|
||||
preset/VOICE/07_ROBOT_TALK 15fd5d5488219d58
|
||||
preset/TRIO/00_FAT_BASS 1306f7d1578d79bc
|
||||
@@ -65,7 +65,7 @@ preset/TRIO/01_ARP_LEAD b5a6b2079bf2e6a4
|
||||
preset/TRIO/02_SYNC_LEAD af824451d88c6aa8
|
||||
preset/TRIO/03_RING_BELL 4972358a4a35b808
|
||||
preset/TRIO/04_CHIP_CHOIR fc6850659a970c68
|
||||
preset/TRIO/05_TURBO_SYNC 8d3d0fbef89c8a98
|
||||
preset/TRIO/05_TURBO_SYNC b8709a85e968f40c
|
||||
preset/TRIO/06_NEON_ARP e3af408d3f268a3c
|
||||
preset/TRIO/07_COLLIDER 39481e18217ec2a4
|
||||
preset/TRIO/08_DIRTY_BASS 4eab1da0a6819ed0
|
||||
@@ -76,7 +76,7 @@ preset/WHEEL/03_SOFT_FLUTE a89099dcede943f8
|
||||
preset/WHEEL/04_ROCK_DRIVE d17130b66bcd1948
|
||||
preset/WHEEL/05_CATHEDRAL d2aa0b1e999393b4
|
||||
preset/WHEEL/06_PEDAL_BASS 1ca897b497c9fb30
|
||||
preset/WHEEL/07_CLARINET c3474a24ccfad0d8
|
||||
preset/WHEEL/07_CLARINET 745b80a01e8c3594
|
||||
preset/GRAIN/00_CLOUD_PAD 8c42fdc8840edf9c
|
||||
preset/GRAIN/01_GLITCH c63664c0638b0e90
|
||||
preset/GRAIN/02_FROZEN 6d546dc1495a7f28
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||
/* Host test of Skiff's update loader screen (firmware/loader/ldr_screen.c) through src/lcd.c, on a fake ST7789: the
|
||||
* window and RAMWR commands into a 240 x 240 frame. UPDATE MODE after boot, WRITING with the bar at 50 %, a second
|
||||
* write starting the bar over, UPDATE FAILED; every letter of their texts in the loader's font, nothing drawn outside
|
||||
* the panel. With a DIR, the three screens as PPM files. tests/ldr_screen_test [DIR] */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static uint16_t fb[240][240]; /* RGB565 as the panel stores it */
|
||||
static uint32_t win[4], cx, cy, cmd, outside;
|
||||
static const uint8_t *pend;
|
||||
static uint32_t pend_n;
|
||||
static void fm1_lcd_hw_init(void) {}
|
||||
static void fm1_lcd_baud(uint32_t b) { (void)b; }
|
||||
static void fm1_lcd_backlight(uint32_t on) { (void)on; }
|
||||
static void fm1_lcd_deselect(void) {}
|
||||
static void fm1_lcd_send_cmd(uint8_t c)
|
||||
{
|
||||
cmd = c;
|
||||
if (c == 0x2C) {
|
||||
cx = win[0];
|
||||
cy = win[2];
|
||||
}
|
||||
}
|
||||
static void fm1_lcd_send_data(const void *p, uint32_t n) { pend = p, pend_n = n; }
|
||||
static void fm1_lcd_wait(void) /* the DMA's bytes land here, as the panel takes them */
|
||||
{
|
||||
uint32_t i;
|
||||
if (!pend_n)
|
||||
return; /* (a command's own byte) */
|
||||
if (cmd == 0x2A || cmd == 0x2B)
|
||||
for (i = 0; i < 2u; i++)
|
||||
win[(cmd == 0x2B) * 2u + i] = (uint32_t)pend[2u * i] << 8 | pend[2u * i + 1u];
|
||||
else if (cmd == 0x2C)
|
||||
for (i = 0; i + 1u < pend_n; i += 2u) {
|
||||
if (cx > 239u || cy > 239u || win[1] > 239u || win[3] > 239u)
|
||||
outside++;
|
||||
else
|
||||
fb[cy][cx] = (uint16_t)(pend[i] << 8 | pend[i + 1u]);
|
||||
if (++cx > win[1]) {
|
||||
cx = win[0];
|
||||
cy++;
|
||||
}
|
||||
}
|
||||
pend_n = 0;
|
||||
}
|
||||
#define fm1_irq_off() ((void)0)
|
||||
#define fm1_irq_on() ((void)0)
|
||||
#include "../firmware/src/lcd.c"
|
||||
#include "../firmware/loader/ldr_screen.c"
|
||||
|
||||
static int bad;
|
||||
static void check(const char *what, int ok)
|
||||
{
|
||||
printf("ldr_screen: %-86s %s\n", what, ok ? "ok" : "FAIL");
|
||||
bad += !ok;
|
||||
}
|
||||
static uint32_t count(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1, uint16_t c) /* pixels of colour c */
|
||||
{
|
||||
uint32_t x, y, n = 0;
|
||||
for (y = y0; y < y1; y++)
|
||||
for (x = x0; x < x1; x++)
|
||||
n += fb[y][x] == c;
|
||||
return n;
|
||||
}
|
||||
static void ppm(const char *dir, const char *name)
|
||||
{
|
||||
char path[512];
|
||||
FILE *f;
|
||||
uint32_t x, y;
|
||||
if (!dir)
|
||||
return;
|
||||
snprintf(path, sizeof path, "%s/%s.ppm", dir, name);
|
||||
if (!(f = fopen(path, "wb")))
|
||||
return;
|
||||
fprintf(f, "P6 240 240 255\n");
|
||||
for (y = 0; y < 240u; y++)
|
||||
for (x = 0; x < 240u; x++) {
|
||||
uint16_t v = fb[y][x];
|
||||
fputc((v >> 11) * 255 / 31, f), fputc((v >> 5 & 63) * 255 / 63, f), fputc((v & 31) * 255 / 31, f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *dir = argc > 1 ? argv[1] : NULL;
|
||||
uint32_t total = 0x93000u - 0x4000u; /* the app area, as ldr_core.c reports it */
|
||||
ldr_screen();
|
||||
ppm(dir, "ldr_update_mode");
|
||||
check("UPDATE MODE: the title in teal, three lines in white, nothing else lit",
|
||||
count(0, 70, 240, 91, LDR_TITLE) > 300u && count(0, 110, 240, 164, LDR_INK) > 900u &&
|
||||
count(0, 0, 240, 240, 0) + count(0, 0, 240, 240, LDR_TITLE) + count(0, 0, 240, 240, LDR_INK) == 240u * 240u);
|
||||
ldr_bar(total / 2u, total);
|
||||
ppm(dir, "ldr_writing");
|
||||
check("WRITING at 50 %: the bar's first 100 px teal, the rest its track",
|
||||
count(LDR_BAR_X, LDR_BAR_Y, LDR_BAR_X + 100u, LDR_BAR_Y + 8u, LDR_BAR) == 800u &&
|
||||
count(LDR_BAR_X + 100u, LDR_BAR_Y, LDR_BAR_X + 200u, LDR_BAR_Y + 8u, LDR_DIM) == 800u);
|
||||
ldr_bar(total, total);
|
||||
ldr_bar(total / 4u, total);
|
||||
check("a second write starts the bar over (25 %)",
|
||||
count(LDR_BAR_X, LDR_BAR_Y, LDR_BAR_X + 200u, LDR_BAR_Y + 8u, LDR_BAR) == 50u * 8u);
|
||||
ldr_failed();
|
||||
ppm(dir, "ldr_failed");
|
||||
check("UPDATE FAILED: the bar gone, the way out again",
|
||||
count(LDR_BAR_X, LDR_BAR_Y, LDR_BAR_X + 200u, LDR_BAR_Y + 8u, 0) == 1600u &&
|
||||
count(0, 110, 240, 164, LDR_INK) > 900u);
|
||||
check("every letter of the texts in the loader's font, nothing outside the panel", !ldr_missing && !outside);
|
||||
printf("%s\n", bad ? "LDR SCREEN TEST FAILED" : "ldr_screen test passed");
|
||||
return bad != 0;
|
||||
}
|
||||
+34
-1
@@ -12,7 +12,8 @@
|
||||
* channel the selected track).
|
||||
* 4. cost: instructions per sample (kernel-counted) of the heaviest PHYS preset and of a 4-part mix with every
|
||||
* slot of every part active, against the same with the matrix off; fails above MOD_COST_MAX.
|
||||
* 5. demos: LFO -> CUT, VEL -> AMP, MODW -> VIB, LFO -> TRIO PW, AT -> WHEEL DRV as WAVs in DEMO_DIR. */
|
||||
* 5. demos: LFO -> CUT, VEL -> AMP, MODW -> VIB, LFO -> TRIO PW, AT -> WHEEL DRV as WAVs in DEMO_DIR.
|
||||
* 6. (Skiff 1.3.2) LFO DEST PITCH squared (voice.c lfo_pitch): its depths, its sign, a smooth wobble. */
|
||||
#define main hostsim_main
|
||||
#include "hostsim.c"
|
||||
#undef main
|
||||
@@ -656,6 +657,37 @@ static void test_env2(void)
|
||||
check(" no slot of it: not run (ENV 2 stays 0)", !t->v[t->m_vi].env2 && t->v[t->m_vi].stage2 == 1u);
|
||||
}
|
||||
|
||||
/* (Skiff 1.3.2) LFO DEST PITCH's curve (voice.c lfo_pitch): squared, 63 the +-11.8 semitones it always reached, 8 the
|
||||
* +-19 cents that 1 was up to 1.3.1, 1 under a cent; deeper with every step, its sign kept; and smooth: across a
|
||||
* cycle the pitch moves by less than half a cent at a time (whole 1/16 semitones alone moved in 6.25-cent stairs) */
|
||||
static double lfo_cents(int32_t lfo, int32_t d)
|
||||
{
|
||||
int32_t p16, fine;
|
||||
lfo_pitch(lfo, d, &p16, &fine);
|
||||
return p16 * 6.25 + fine / 2.367;
|
||||
}
|
||||
static void test_vibrato(void)
|
||||
{
|
||||
char what[200];
|
||||
double c63 = lfo_cents(32767, 63), c8 = lfo_cents(32767, 8), c1 = lfo_cents(32767, 1), cm8 = lfo_cents(32767, -8);
|
||||
double prev = 0, jump = 0;
|
||||
int32_t d, i, up = 1;
|
||||
for (d = 1; d <= 63; d++) {
|
||||
up &= lfo_cents(32767, d) > prev;
|
||||
prev = lfo_cents(32767, d);
|
||||
}
|
||||
prev = lfo_cents(-32767, 4);
|
||||
for (i = -32767; i <= 32767; i += 256) {
|
||||
double c = lfo_cents(i, 4);
|
||||
jump = fabs(c - prev) > jump ? fabs(c - prev) : jump;
|
||||
prev = c;
|
||||
}
|
||||
snprintf(what, sizeof what, "LFO DEST PITCH squared: 63 %.0f ct, 8 %.1f, 1 %.2f, -8 %.1f; every step deeper; "
|
||||
"steps of %.2f ct at 4", c63, c8, c1, cm8, jump);
|
||||
check(what, c63 > 1170 && c63 < 1190 && c8 > 18 && c8 < 20 && c1 > 0 && c1 < 1 && cm8 < -18 && cm8 > -20.5 &&
|
||||
up && jump < 0.5);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
test_off();
|
||||
@@ -663,6 +695,7 @@ int main(int argc, char **argv)
|
||||
test_midi();
|
||||
test_cost();
|
||||
test_env2();
|
||||
test_vibrato();
|
||||
if (argc > 1)
|
||||
check("demos written", demos(argv[1]));
|
||||
printf("%s\n", bad ? "MOD MATRIX TEST FAILED" : "mod matrix test passed");
|
||||
|
||||
+423
-122
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only
|
||||
* Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments */
|
||||
/* The reverb bus's two models (src/fx.c: REVERB TYPE, G_RTYPE) on the Mac, through hostsim.c as regress.c.
|
||||
/* The reverb bus's models (src/fx.c: REVERB TYPE, G_RTYPE: ROOM, SPRING, 1.2's HALL) on the Mac, through hostsim.c
|
||||
* as regress.c.
|
||||
* build/host/reverb_test [DEMODIR] (run_tests.sh: build/fx_demo)
|
||||
* 1. ROOM bit-identical: fx_buses against a copy of the buses as they were before SPRING (chorus, delay and the
|
||||
* 4-comb room in one loop), on noise sends with SIZE / DAMP / the delay and chorus settings changing, sample
|
||||
@@ -16,8 +17,15 @@
|
||||
* tail dies away (no limit cycle, no offset).
|
||||
* 5. level: SPRING's tail within 6 dB of ROOM's (RMS of the first 1.5 s after a noise burst, defaults).
|
||||
* 6. a model change while the bus rings: no click (the old one's block fades out), the new one starts silent.
|
||||
* 7. cost: host instructions per sample of the reverb alone (rev_room, rev_spring): SPRING at most ROOM + 30 %;
|
||||
* and of the whole bus stage (fx_buses), with the device estimate (1.7 % per 100, drum_test's ratio).
|
||||
* 7. cost: host instructions per sample of the reverb alone (rev_room, rev_spring, rev_hall): SPRING and HALL at
|
||||
* most ROOM + 30 %; and of the whole bus stage (fx_buses), with the device estimate (1.7 % per 100,
|
||||
* drum_test's ratio).
|
||||
* HALL (1.2; (Skiff #19) Felucca's, and its tests): RT60 against SIZE; DAMP: the decay at 500 Hz and 3 kHz; the
|
||||
* corners (as SPRING's) and 27 SIZE x DAMP x level runs end in exact silence (left and side); no offset after a
|
||||
* loud burst; level against ROOM; stereo (the tail's left / right correlation); echo density, the tail's
|
||||
* ringing (resonances that stand out of the averaged spectrum: the metallic tone) and flutter (echoes at a
|
||||
* fixed period) against ROOM, SPRING and COMB8 (8 combs + 4 allpasses, of which ROOM is the first half: a
|
||||
* host-only reference, over twice ROOM's memory); model changes ROOM / SPRING / HALL both ways.
|
||||
* Demos (WAV) into DEMODIR: a drum pattern and a pluck through SPRING, the drums through ROOM to compare. */
|
||||
#define main hostsim_main
|
||||
#include "hostsim.c"
|
||||
@@ -299,49 +307,79 @@ static void test_clear(void)
|
||||
check("rev_clear: every sample of the combs and the allpasses silent", !left);
|
||||
}
|
||||
|
||||
static void test_switch(void)
|
||||
/* --------------------------------------------------------------- HALL --- */
|
||||
/* A host-only reference for the comparison, COMB8 (not in the firmware: over twice ROOM's memory): the classic
|
||||
* 8 damped combs (1116 .. 1617) and 4 allpasses (556 441 341 225) of which ROOM is the first half, mono, SIZE
|
||||
* and DAMP mapped as ROOM's, the input 3 dB lower (twice the combs) */
|
||||
static const uint16_t C8_LEN[8] = {1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617};
|
||||
static const uint16_t C8_AP[4] = {556, 441, 341, 225};
|
||||
static int16_t c8_buf[11024 + 1563];
|
||||
static uint16_t c8_i[12];
|
||||
static int32_t c8_lp[8];
|
||||
static void comb8(const int32_t *rev_in, int32_t *out, uint32_t n)
|
||||
{
|
||||
static int32_t c[CTL], d[CTL], r[CTL], w[CTL];
|
||||
uint32_t b, i;
|
||||
int32_t prev = 0, step = 0, own = 0, after = 0;
|
||||
char what[200];
|
||||
host_tracks_init();
|
||||
rev_clear();
|
||||
memset(dly_buf, 0, sizeof dly_buf); /* (the delay and chorus quiet: only the reverb) */
|
||||
memset(cho_buf, 0, sizeof cho_buf);
|
||||
fx.rtype = 0;
|
||||
for (b = 0; b < 4u * FS / CTL; b++) {
|
||||
if (b == 2u * FS / CTL)
|
||||
song.g[G_RTYPE] = 1;
|
||||
for (i = 0; i < CTL; i++) {
|
||||
c[i] = d[i] = 0;
|
||||
r[i] = b < FS / CTL ? (int32_t)(30000 * sin(2 * M_PI * 220 * (b * CTL + i) / FS)) : 0;
|
||||
uint32_t i, k;
|
||||
int32_t size = 25000 + song.g[G_RSIZE] * 50, damp = 32767 - song.g[G_RDAMP] * 200;
|
||||
for (i = 0; i < n; i++) {
|
||||
int32_t a = 0, in = mulq15(rev_in[i], 1825);
|
||||
int16_t *c = c8_buf;
|
||||
for (k = 0; k < 8u; k++) {
|
||||
int32_t o = c[c8_i[k]];
|
||||
c8_lp[k] = o + mulq15(c8_lp[k] - o, 32767 - damp);
|
||||
c[c8_i[k]] = (int16_t)clamp(in + mulq15(c8_lp[k], size), -32768, 32767);
|
||||
if (++c8_i[k] >= C8_LEN[k])
|
||||
c8_i[k] = 0;
|
||||
a += o;
|
||||
c += C8_LEN[k];
|
||||
}
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
for (i = 0; i < CTL; i++) {
|
||||
int32_t s = abs(w[i] - prev);
|
||||
if (b >= 2u * FS / CTL - 4u && b <= 2u * FS / CTL + 4u)
|
||||
step = s > step ? s : step;
|
||||
else if (b > FS / CTL + 100u && b < 2u * FS / CTL - 4u)
|
||||
own = s > own ? s : own;
|
||||
if (b > 2u * FS / CTL)
|
||||
after = abs(w[i]) > after ? abs(w[i]) : after;
|
||||
prev = w[i];
|
||||
for (k = 0; k < 4u; k++) {
|
||||
int32_t o = c[c8_i[8 + k]];
|
||||
c[c8_i[8 + k]] = (int16_t)clamp(a + (o >> 1), -32768, 32767);
|
||||
a = o - a;
|
||||
if (++c8_i[8 + k] >= C8_AP[k])
|
||||
c8_i[8 + k] = 0;
|
||||
c += C8_AP[k];
|
||||
}
|
||||
out[i] += a;
|
||||
}
|
||||
snprintf(what, sizeof what, "ROOM -> SPRING while the tail rings: largest step %d (the tail's own %d), silent after: %d",
|
||||
step, own, after);
|
||||
check(what, step <= 2 * own + 64 && after == 0 && fx.rtype == 1);
|
||||
song.g[G_RTYPE] = 0;
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
check(" and back to ROOM", fx.rtype == 0);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------- HALL --- */
|
||||
/* (Skiff phase 9) HALL (G_RTYPE 2), ROOM's network at half the rate: a longer tail than ROOM's at the same SIZE (RT60
|
||||
* 1.6x at least), stable at the corners (full-scale noise, then silence: bounded, dies away), its level within 6 dB
|
||||
* of ROOM's, a change to it and back while the bus rings without a click */
|
||||
static void model_run(uint32_t m, const int32_t *x, uint32_t len, uint32_t n) /* model m's response into ir[] */
|
||||
enum { M_ROOM, M_SPRING, M_HALL, M_COMB8 };
|
||||
static const char *const M_NAME[4] = {"ROOM", "SPRING", "HALL", "COMB8"};
|
||||
static void model_reset(int m, int32_t size, int32_t damp)
|
||||
{
|
||||
song.g[G_RTYPE] = (int16_t)(m == M_COMB8 ? 0 : m);
|
||||
song.g[G_RSIZE] = (int16_t)size;
|
||||
song.g[G_RDAMP] = (int16_t)damp;
|
||||
rev_clear();
|
||||
fx.rtype = (uint8_t)song.g[G_RTYPE];
|
||||
fx.sp_w = 0;
|
||||
fx.sp_size = 0;
|
||||
fx.sp_ph = 0;
|
||||
hl.ph = 0;
|
||||
hl.sz = 0;
|
||||
memset(c8_buf, 0, sizeof c8_buf);
|
||||
memset(c8_lp, 0, sizeof c8_lp);
|
||||
}
|
||||
/* one block of model m: mid added to out (the wet bus), the stereo difference into side (HALL's; 0 else) */
|
||||
static void model_block(int m, const int32_t *in, int32_t *out, int32_t *side, uint32_t n)
|
||||
{
|
||||
uint32_t i;
|
||||
hl.side = 0;
|
||||
if (m == M_HALL)
|
||||
rev_hall(in, out, n);
|
||||
else if (m == M_SPRING)
|
||||
rev_spring(in, out, n);
|
||||
else if (m == M_COMB8)
|
||||
comb8(in, out, n);
|
||||
else
|
||||
rev_room(in, out, n);
|
||||
for (i = 0; i < n; i++)
|
||||
side[i] = hl.side ? rev_side[i] : 0;
|
||||
}
|
||||
/* the response of model m to x[] (len samples, then silence): left (mid + side) into ir, side into irs */
|
||||
static int32_t irs[IRN];
|
||||
static void model_run(int m, const int32_t *x, uint32_t len, uint32_t n)
|
||||
{
|
||||
static int32_t in[CTL];
|
||||
uint32_t t, i;
|
||||
@@ -350,100 +388,353 @@ static void model_run(uint32_t m, const int32_t *x, uint32_t len, uint32_t n)
|
||||
in[i] = t + i < len ? x[t + i] : 0;
|
||||
ir[t + i] = 0;
|
||||
}
|
||||
rev_model(m, in, ir + t, CTL);
|
||||
model_block(m, in, ir + t, irs + t, CTL);
|
||||
for (i = 0; i < CTL; i++)
|
||||
ir[t + i] += irs[t + i];
|
||||
}
|
||||
}
|
||||
|
||||
/* the normalised echo density (Abel and Huang): the share of samples beyond one standard deviation in a 20 ms
|
||||
* window, over a Gaussian's (0.3173): 1 = as dense as noise. Its mean over [t0, t1) ms, and the first ms at
|
||||
* which it reaches 0.9 */
|
||||
static double ned_mean(const int32_t *h, double t0, double t1, double *t90)
|
||||
{
|
||||
uint32_t w = FS / 50u, c, a = (uint32_t)(t0 * FS / 1000), b = (uint32_t)(t1 * FS / 1000), cnt = 0;
|
||||
double s = 0;
|
||||
*t90 = -1;
|
||||
for (c = w / 2u; c + w / 2u < IRN && c < b; c += FS / 1000u) {
|
||||
double e = 0, sd, ned;
|
||||
uint32_t i, k = 0;
|
||||
for (i = c - w / 2u; i < c + w / 2u; i++)
|
||||
e += (double)h[i] * h[i];
|
||||
sd = sqrt(e / w);
|
||||
for (i = c - w / 2u; i < c + w / 2u; i++)
|
||||
k += fabs((double)h[i]) > sd;
|
||||
ned = sd > 0 ? k / (double)w / 0.3173 : 0;
|
||||
if (*t90 < 0 && ned >= 0.9)
|
||||
*t90 = c * 1000.0 / FS;
|
||||
if (c >= a) {
|
||||
s += ned;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
return cnt ? s / cnt : 0;
|
||||
}
|
||||
/* the tail's ringing: the power spectrum of 8192-sample Hann frames (hop 2048, 5.4 Hz a bin) from 0.15 s to 1.35 s,
|
||||
* each frame normalised (the late ones count as much as the early ones), averaged over the frames and over 4
|
||||
* responses (excitations of different noise); then each bin in dB against its +-1/6 octave neighbourhood,
|
||||
* 200 Hz .. 6 kHz. A diffuse tail averages to a flat spectrum; modes that ring on stand out in the same bins in
|
||||
* every frame (the metallic tone). The deviation's RMS (dB), its largest peak. The flutter: the largest
|
||||
* normalised autocorrelation of the same stretch at lags of 2 .. 50 ms (echoes that come back at a fixed period) */
|
||||
#define FFTN 8192u
|
||||
static void fft(double *re, double *im)
|
||||
{
|
||||
uint32_t i, j = 0, len, k;
|
||||
for (i = 1; i < FFTN; i++) {
|
||||
uint32_t bit = FFTN >> 1;
|
||||
for (; j & bit; bit >>= 1)
|
||||
j ^= bit;
|
||||
j |= bit;
|
||||
if (i < j) {
|
||||
double t = re[i]; re[i] = re[j]; re[j] = t;
|
||||
t = im[i]; im[i] = im[j]; im[j] = t;
|
||||
}
|
||||
}
|
||||
for (len = 2; len <= FFTN; len <<= 1) {
|
||||
double a = -2 * M_PI / len;
|
||||
for (i = 0; i < FFTN; i += len)
|
||||
for (k = 0; k < len / 2u; k++) {
|
||||
double c = cos(a * k), s = sin(a * k);
|
||||
double xr = re[i + k + len / 2u] * c - im[i + k + len / 2u] * s;
|
||||
double xi = re[i + k + len / 2u] * s + im[i + k + len / 2u] * c;
|
||||
re[i + k + len / 2u] = re[i + k] - xr;
|
||||
im[i + k + len / 2u] = im[i + k] - xi;
|
||||
re[i + k] += xr;
|
||||
im[i + k] += xi;
|
||||
}
|
||||
}
|
||||
}
|
||||
typedef struct { double ned, t90, ring, pk, flut, rt; } quality_t;
|
||||
static quality_t quality(int m, int32_t size, int32_t damp)
|
||||
{
|
||||
static double re[FFTN], im[FFTN], p[FFTN / 2u];
|
||||
static int32_t ex[64];
|
||||
uint32_t f, i, k, r, a = (uint32_t)(0.15 * FS), b = (uint32_t)(1.35 * FS), lo = 200u * FFTN / FS, hi = 6000u * FFTN / FS, cnt = 0;
|
||||
double s2 = 0, t90;
|
||||
quality_t q = {0, 0, 0, 0, 0, 0};
|
||||
memset(p, 0, sizeof p);
|
||||
for (r = 0; r < 4u; r++) {
|
||||
xs = 777u + r;
|
||||
for (i = 0; i < 64u; i++)
|
||||
ex[i] = noise(1 << 17);
|
||||
model_reset(m, size, damp);
|
||||
hl.ph = r * 0x40000000u;
|
||||
model_run(m, ex, 64, IRN);
|
||||
q.ned += ned_mean(ir, 50, 300, &t90) / 4;
|
||||
q.t90 += (t90 < 0 ? 300 : t90) / 4;
|
||||
q.rt += rt60(ir, IRN) / 4;
|
||||
for (f = a; f + FFTN <= b; f += FFTN / 4u) {
|
||||
double e = 0;
|
||||
for (i = 0; i < FFTN; i++) {
|
||||
re[i] = ir[f + i] * (0.5 - 0.5 * cos(2 * M_PI * i / FFTN));
|
||||
im[i] = 0;
|
||||
}
|
||||
fft(re, im);
|
||||
for (i = 1; i < FFTN / 2u; i++)
|
||||
e += re[i] * re[i] + im[i] * im[i];
|
||||
for (i = 1; i < FFTN / 2u && e > 0; i++)
|
||||
p[i] += (re[i] * re[i] + im[i] * im[i]) / e;
|
||||
}
|
||||
{ /* the flutter */
|
||||
double e0 = 0, mx = 0;
|
||||
uint32_t lag;
|
||||
for (i = a; i < b; i++)
|
||||
e0 += (double)ir[i] * ir[i];
|
||||
for (lag = 2u * FS / 1000u; lag <= 50u * FS / 1000u && e0 > 0; lag++) {
|
||||
double c = 0;
|
||||
for (i = a; i < b; i++)
|
||||
c += (double)ir[i] * ir[i + lag];
|
||||
c = fabs(c) / e0;
|
||||
mx = c > mx ? c : mx;
|
||||
}
|
||||
q.flut += mx / 4;
|
||||
}
|
||||
}
|
||||
for (k = lo; k <= hi; k++) {
|
||||
uint32_t k0 = (uint32_t)(k / 1.1225), k1 = (uint32_t)(k * 1.1225) + 1u;
|
||||
double mm = 0, d;
|
||||
for (i = k0; i <= k1; i++)
|
||||
mm += p[i];
|
||||
mm /= k1 - k0 + 1u;
|
||||
if (mm <= 0)
|
||||
continue;
|
||||
d = 10 * log10(p[k] / mm + 1e-30);
|
||||
s2 += d * d;
|
||||
cnt++;
|
||||
q.pk = d > q.pk ? d : q.pk;
|
||||
}
|
||||
q.ring = cnt ? sqrt(s2 / cnt) : 99;
|
||||
return q;
|
||||
}
|
||||
|
||||
/* RT60 in a band: the energy of 9 bins across f +-1/6 octave (Goertzel, 2048-sample Hann frames every 512)
|
||||
* over time; the slope of a line fitted from 5 to 25 dB below its loudest frame */
|
||||
static double band_rt(const int32_t *h, double f)
|
||||
{
|
||||
static double db[IRN / 512u];
|
||||
double mx = -1e9, sx = 0, sy = 0, sxx = 0, sxy = 0;
|
||||
uint32_t t, i, j, nf = IRN / 512u - 4u, cnt = 0;
|
||||
for (t = 0; t < nf; t++) {
|
||||
double e = 0;
|
||||
for (j = 0; j < 9u; j++) {
|
||||
double w = 2 * M_PI * f * pow(2, (j - 4.0) / 24) / FS, c = 2 * cos(w), s1 = 0, s2 = 0;
|
||||
for (i = 0; i < 2048u; i++) {
|
||||
double s = h[t * 512u + i] * (0.5 - 0.5 * cos(2 * M_PI * i / 2048)) + c * s1 - s2;
|
||||
s2 = s1;
|
||||
s1 = s;
|
||||
}
|
||||
e += s1 * s1 + s2 * s2 - c * s1 * s2;
|
||||
}
|
||||
db[t] = 10 * log10(e + 1e-9);
|
||||
mx = db[t] > mx ? db[t] : mx;
|
||||
}
|
||||
for (t = 0; t < nf && db[t] < mx - 0.01; t++)
|
||||
;
|
||||
for (; t < nf && db[t] > mx - 25; t++)
|
||||
if (db[t] <= mx - 5) {
|
||||
sx += t, sy += db[t], sxx += (double)t * t, sxy += t * db[t];
|
||||
cnt++;
|
||||
}
|
||||
if (cnt < 3u)
|
||||
return 0;
|
||||
return -60 / ((cnt * sxy - sx * sy) / (cnt * sxx - sx * sx)) * 512.0 / FS;
|
||||
}
|
||||
static void test_hall(void)
|
||||
{
|
||||
static int32_t imp[1] = {200000}, burst[2u * FS];
|
||||
static const int16_t SZ[2] = {64, 127};
|
||||
double rr[2], rh[2], er = 0, eh = 0;
|
||||
char what[200];
|
||||
uint32_t k, i;
|
||||
static const int32_t SZ[4] = {0, 64, 90, 127};
|
||||
double r[4];
|
||||
quality_t qa[4];
|
||||
char what[240];
|
||||
uint32_t k, i, m;
|
||||
host_tracks_init();
|
||||
for (k = 0; k < 2u; k++) {
|
||||
song.g[G_RSIZE] = SZ[k];
|
||||
song.g[G_RDAMP] = 60;
|
||||
rev_clear();
|
||||
model_run(0, imp, 1, IRN);
|
||||
rr[k] = rt60(ir, IRN);
|
||||
rev_clear();
|
||||
model_run(2, imp, 1, IRN);
|
||||
rh[k] = rt60(ir, IRN);
|
||||
for (i = 0; i < 64u; i++) /* (a click of noise: the send of a drum hit) */
|
||||
burst[i] = noise(1 << 17);
|
||||
for (k = 0; k < 4u; k++) {
|
||||
model_reset(M_HALL, SZ[k], 60);
|
||||
model_run(M_HALL, burst, 64, IRN);
|
||||
r[k] = rt60(ir, IRN);
|
||||
}
|
||||
snprintf(what, sizeof what, "HALL (phase 9): a longer tail than ROOM's: RT60 %.2f s (ROOM %.2f) at SIZE 64, %.2f (%.2f) at 127",
|
||||
rh[0], rr[0], rh[1], rr[1]);
|
||||
check(what, rh[0] >= 1.6 * rr[0] && rh[1] >= 1.6 * rr[1] && rh[1] < 12.0);
|
||||
for (k = 0; k < 2u; k++) {
|
||||
int32_t pk = 0, tail = 0;
|
||||
snprintf(what, sizeof what, "HALL decay rises with SIZE: RT60 %.2f s (SIZE 0), %.2f (64), %.2f (90), %.2f (127)",
|
||||
r[0], r[1], r[2], r[3]);
|
||||
check(what, r[0] < r[1] && r[1] < r[2] && r[2] < r[3] && r[0] >= 0.25 && r[0] <= 0.9 && r[2] >= 1.8 &&
|
||||
r[2] <= 3.5 && r[3] >= 3.5 && r[3] <= 8.0);
|
||||
{ /* DAMP: the decay at 500 Hz and at 3 kHz (DAMP 0, 60, 127): the highs die sooner the higher DAMP */
|
||||
static const int32_t DP[3] = {0, 60, 127};
|
||||
double lo[3], hi[3];
|
||||
for (k = 0; k < 3u; k++) {
|
||||
model_reset(M_HALL, 90, DP[k]);
|
||||
model_run(M_HALL, imp, 1, IRN);
|
||||
lo[k] = band_rt(ir, 500);
|
||||
hi[k] = band_rt(ir, 3000);
|
||||
}
|
||||
snprintf(what, sizeof what, "HALL DAMP: RT60 at 500 Hz / 3 kHz: %.2f / %.2f s (DAMP 0), %.2f / %.2f (60), %.2f / %.2f (127)",
|
||||
lo[0], hi[0], lo[1], hi[1], lo[2], hi[2]);
|
||||
check(what, hi[0] > hi[1] && hi[1] > hi[2] && hi[0] >= 0.3 * lo[0] && hi[2] <= 0.3 * lo[2]);
|
||||
}
|
||||
for (k = 0; k < 4u; k++) { /* the corners: full-scale noise or square waves, then silence */
|
||||
int32_t pk = 0, tail = 0, tails = 0;
|
||||
for (i = 0; i < 2u * FS; i++)
|
||||
burst[i] = noise(1 << 19);
|
||||
song.g[G_RSIZE] = 127;
|
||||
song.g[G_RDAMP] = k ? 127 : 0;
|
||||
rev_clear();
|
||||
model_run(2, burst, 2u * FS, IRN);
|
||||
burst[i] = k < 2u ? noise(1 << 19) : (i / (k == 2u ? 7u : 53u)) & 1u ? 1 << 19 : -(1 << 19);
|
||||
model_reset(M_HALL, 127, k & 1u ? 127 : 0);
|
||||
model_run(M_HALL, burst, 2u * FS, IRN);
|
||||
for (i = 0; i < IRN; i++) {
|
||||
int32_t v = abs(ir[i]);
|
||||
pk = v > pk ? v : pk;
|
||||
if (i >= IRN - FS)
|
||||
if (i >= IRN - FS) {
|
||||
tail = v > tail ? v : tail;
|
||||
tails = abs(irs[i]) > tails ? abs(irs[i]) : tails;
|
||||
}
|
||||
}
|
||||
snprintf(what, sizeof what, " at SIZE 127 DAMP %d: 2 s of full-scale noise: peak %d, the last second %d", k ? 127 : 0,
|
||||
pk, tail);
|
||||
check(what, pk <= 6 * 32768 && tail * 100 < pk);
|
||||
snprintf(what, sizeof what, "HALL at SIZE 127 DAMP %d: 2 s of %s: peak %d, the last second %d (side %d)",
|
||||
k & 1u ? 127 : 0, k < 2u ? "full-scale noise" : k == 2u ? "a full-scale 3.2 kHz square" : "a 416 Hz square",
|
||||
pk, tail, tails);
|
||||
check(what, pk <= 12 * 32768 && tail <= 4 && tails <= 4); /* (the sum of 4 lines x HL_OUT, twice) */
|
||||
}
|
||||
song.g[G_RSIZE] = 90;
|
||||
song.g[G_RDAMP] = 60;
|
||||
for (k = 0; k < 2u; k++) { /* the level against ROOM's: the same burst, defaults */
|
||||
static int32_t in[CTL], o[CTL];
|
||||
{ /* no limit cycle anywhere: SIZE 0 / 64 / 127 x DAMP 0 / 60 / 127, 1 s of a chord, quiet, middling or
|
||||
* loud (the quiet one keeps the lines near where their rounding changes), then silence: the last
|
||||
* second of 12 exactly 0 (left and side) */
|
||||
uint32_t s0, d0, lv, worst = 0, held = 0;
|
||||
static const int32_t SS[3] = {0, 64, 127}, DD[3] = {0, 60, 127}, LV[3] = {600, 20000, 200000};
|
||||
for (s0 = 0; s0 < 3u; s0++)
|
||||
for (d0 = 0; d0 < 3u; d0++)
|
||||
for (lv = 0; lv < 3u; lv++) {
|
||||
int32_t tail = 0;
|
||||
for (i = 0; i < FS; i++)
|
||||
burst[i] = (int32_t)(LV[lv] * (sin(2 * M_PI * 220 * i / FS) + sin(2 * M_PI * 277 * i / FS) +
|
||||
sin(2 * M_PI * 330 * i / FS)) / 3);
|
||||
model_reset(M_HALL, SS[s0], DD[d0]);
|
||||
model_run(M_HALL, burst, FS, IRN);
|
||||
for (i = IRN - FS; i < IRN; i++)
|
||||
tail = abs(ir[i]) + abs(irs[i]) > tail ? abs(ir[i]) + abs(irs[i]) : tail;
|
||||
held += tail != 0;
|
||||
worst = (uint32_t)tail > worst ? (uint32_t)tail : worst;
|
||||
}
|
||||
snprintf(what, sizeof what, "HALL: silent after its tail at every SIZE x DAMP x level (27 runs): %u not silent, worst %u",
|
||||
held, worst);
|
||||
check(what, !held);
|
||||
}
|
||||
{ /* the defaults after a loud burst: exact silence once the tail is gone, no offset on the way */
|
||||
int32_t last = 0, nz = -1;
|
||||
double dc = 0, e = 0;
|
||||
for (i = 0; i < FS / 4u; i++)
|
||||
burst[i] = noise(1 << 18);
|
||||
model_reset(M_HALL, 90, 60);
|
||||
model_run(M_HALL, burst, FS / 4u, IRN);
|
||||
for (i = 0; i < IRN; i++) {
|
||||
if (ir[i] || irs[i])
|
||||
nz = (int32_t)i;
|
||||
if (i >= 2u * FS && i < 4u * FS) {
|
||||
dc += ir[i];
|
||||
e += (double)ir[i] * ir[i];
|
||||
}
|
||||
}
|
||||
last = nz;
|
||||
dc /= 2.0 * FS;
|
||||
snprintf(what, sizeof what, "HALL (SIZE 90) after a loud burst: last sample not 0 at %.2f s; mean over 2 .. 4 s %.2f (RMS %.0f)",
|
||||
last / (double)FS, dc, sqrt(e / (2.0 * FS)));
|
||||
check(what, last >= 0 && last < (int32_t)(IRN - FS) && fabs(dc) < 0.05 * sqrt(e / (2.0 * FS)) + 0.5);
|
||||
}
|
||||
{ /* level against ROOM (the left channel; ROOM's is its mono bus); stereo: left and right in the tail */
|
||||
static int32_t in[CTL], o[CTL], sd[CTL];
|
||||
double er = 0, eh = 0, lr = 0, ll = 0, rr = 0;
|
||||
uint32_t t;
|
||||
rev_clear();
|
||||
xs = 99;
|
||||
for (t = 0; t < 2u * FS; t += CTL) {
|
||||
for (i = 0; i < CTL; i++) {
|
||||
in[i] = t < FS / 4u ? noise(20000) : 0;
|
||||
o[i] = 0;
|
||||
}
|
||||
rev_model(k ? 2u : 0u, in, o, CTL);
|
||||
for (i = 0; i < CTL; i++)
|
||||
*(k ? &eh : &er) += (double)o[i] * o[i];
|
||||
}
|
||||
}
|
||||
snprintf(what, sizeof what, " its tail %.1f dB from ROOM's (the same burst, SIZE 90 DAMP 60)", 10 * log10(eh / er));
|
||||
check(what, fabs(10 * log10(eh / er)) <= 6.0);
|
||||
{ /* ROOM -> HALL while the tail rings, and back */
|
||||
static int32_t c[CTL], d[CTL], r[CTL], w[CTL];
|
||||
uint32_t b;
|
||||
int32_t prev = 0, step = 0, own = 0;
|
||||
rev_clear();
|
||||
memset(dly_buf, 0, sizeof dly_buf);
|
||||
memset(cho_buf, 0, sizeof cho_buf);
|
||||
fx.rtype = 0;
|
||||
song.g[G_RTYPE] = 0;
|
||||
for (b = 0; b < 3u * FS / CTL; b++) {
|
||||
if (b == 2u * FS / CTL)
|
||||
song.g[G_RTYPE] = 2;
|
||||
for (i = 0; i < CTL; i++) {
|
||||
c[i] = d[i] = 0;
|
||||
r[i] = b < FS / CTL ? (int32_t)(30000 * sin(2 * M_PI * 220 * (b * CTL + i) / FS)) : 0;
|
||||
}
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
for (i = 0; i < CTL; i++) {
|
||||
int32_t s = abs(w[i] - prev);
|
||||
if (b >= 2u * FS / CTL - 4u && b <= 2u * FS / CTL + 4u)
|
||||
step = s > step ? s : step;
|
||||
else if (b > FS / CTL + 100u && b < 2u * FS / CTL - 4u)
|
||||
own = s > own ? s : own;
|
||||
prev = w[i];
|
||||
for (m = 0; m < 2u; m++) {
|
||||
model_reset(m ? M_HALL : M_ROOM, 90, 60);
|
||||
xs = 99;
|
||||
for (t = 0; t < 2u * FS; t += CTL) {
|
||||
for (i = 0; i < CTL; i++) {
|
||||
in[i] = t < FS / 4u ? noise(20000) : 0;
|
||||
o[i] = 0;
|
||||
}
|
||||
model_block(m ? M_HALL : M_ROOM, in, o, sd, CTL);
|
||||
for (i = 0; i < CTL; i++) {
|
||||
double L = o[i] + sd[i], R = o[i] - sd[i];
|
||||
*(m ? &eh : &er) += L * L;
|
||||
if (m && t >= FS / 2u) {
|
||||
lr += L * R;
|
||||
ll += L * L;
|
||||
rr += R * R;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
k = fx.rtype;
|
||||
song.g[G_RTYPE] = 0;
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
snprintf(what, sizeof what, " ROOM -> HALL while the tail rings: largest step %d (the tail's own %d); and back", step, own);
|
||||
check(what, step <= 2 * own + 64 && k == 2u && fx.rtype == 0);
|
||||
snprintf(what, sizeof what, "level: HALL's tail %.1f dB from ROOM's (the same burst, SIZE 90 DAMP 60)", 10 * log10(eh / er));
|
||||
check(what, fabs(10 * log10(eh / er)) <= 3.0);
|
||||
snprintf(what, sizeof what, " stereo: left / right correlation of the tail %.2f", lr / sqrt(ll * rr));
|
||||
check(what, fabs(lr / sqrt(ll * rr)) < 0.5);
|
||||
}
|
||||
rev_clear();
|
||||
/* the comparison: echo density, the tail's ringing and flutter of ROOM, SPRING, HALL and COMB8 (SIZE 90, DAMP 60) */
|
||||
for (m = 0; m < 4u; m++) {
|
||||
qa[m] = quality((int)m, 90, 60);
|
||||
snprintf(what, sizeof what, " %-6s: echo density %.2f (50 .. 300 ms; 0.9 at %3.0f ms), RT60 %.2f s, ringing %.2f dB RMS (peak %4.1f), flutter %.2f",
|
||||
M_NAME[m], qa[m].ned, qa[m].t90, qa[m].rt, qa[m].ring, qa[m].pk, qa[m].flut);
|
||||
check(what, 1);
|
||||
}
|
||||
check("HALL: as dense as ROOM, less ringing than ROOM and COMB8, less flutter than ROOM",
|
||||
qa[M_HALL].ned >= qa[M_ROOM].ned - 0.02 && qa[M_HALL].ring < 0.5 * qa[M_ROOM].ring &&
|
||||
qa[M_HALL].ring < qa[M_COMB8].ring && qa[M_HALL].flut < qa[M_ROOM].flut);
|
||||
model_reset(M_ROOM, 90, 60);
|
||||
host_tracks_init();
|
||||
}
|
||||
|
||||
/* model changes while the bus rings, through fx_buses and the side as mix_block adds it: the old model's tail
|
||||
* fades out within a block (no step larger than the tail's own), the new model starts silent */
|
||||
static void test_switch(void)
|
||||
{
|
||||
static const int8_t SEQ[5] = {0, 1, 2, 1, 0}, SEQ2[5] = {0, 2, 1, 2, 0};
|
||||
static int32_t c[CTL], d[CTL], r[CTL], w[CTL];
|
||||
uint32_t b, i, k, q;
|
||||
char what[200];
|
||||
for (q = 0; q < 2u; q++)
|
||||
for (k = 0; k + 1u < 5u; k++) {
|
||||
int from = (q ? SEQ2 : SEQ)[k], to = (q ? SEQ2 : SEQ)[k + 1u];
|
||||
int32_t prev = 0, step = 0, own = 0, after = 0;
|
||||
if (q && (from != 2 && to != 2))
|
||||
continue;
|
||||
host_tracks_init();
|
||||
rev_clear();
|
||||
memset(dly_buf, 0, sizeof dly_buf); /* (the delay and chorus quiet: only the reverb) */
|
||||
memset(cho_buf, 0, sizeof cho_buf);
|
||||
fx.dly_lp = 0;
|
||||
song.g[G_RTYPE] = (int16_t)from;
|
||||
fx.rtype = (uint8_t)from;
|
||||
for (b = 0; b < 4u * FS / CTL; b++) {
|
||||
if (b == 2u * FS / CTL)
|
||||
song.g[G_RTYPE] = (int16_t)to;
|
||||
for (i = 0; i < CTL; i++) {
|
||||
c[i] = d[i] = 0;
|
||||
r[i] = b < FS / CTL ? (int32_t)(30000 * sin(2 * M_PI * 220 * (b * CTL + i) / FS)) : 0;
|
||||
}
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
for (i = 0; i < CTL; i++) {
|
||||
int32_t L = w[i] + (hl.side ? rev_side[i] : 0), s = abs(L - prev); /* the left channel */
|
||||
if (b >= 2u * FS / CTL - 4u && b <= 2u * FS / CTL + 4u)
|
||||
step = s > step ? s : step;
|
||||
else if (b > FS / CTL + 100u && b < 2u * FS / CTL - 4u)
|
||||
own = s > own ? s : own;
|
||||
if (b > 2u * FS / CTL)
|
||||
after = abs(w[i]) + (hl.side ? abs(rev_side[i]) : 0) > after ? abs(w[i]) + (hl.side ? abs(rev_side[i]) : 0) : after;
|
||||
prev = L;
|
||||
}
|
||||
}
|
||||
snprintf(what, sizeof what, "%s -> %s while the tail rings: largest step %d (the tail's own %d), silent after: %d",
|
||||
M_NAME[from], M_NAME[to], step, own, after);
|
||||
check(what, step <= 2 * own + 64 && after == 0 && fx.rtype == to);
|
||||
}
|
||||
song.g[G_RTYPE] = 0;
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
check(" and back to ROOM", fx.rtype == 0 && !hl.side);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------- CHORUS's MODE --- */
|
||||
@@ -524,15 +815,15 @@ static void test_chorus_modes(void)
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- cost --- */
|
||||
static double cost_of(int what) /* 0 rev_room, 1 rev_spring, 2 fx_buses ROOM, 3 fx_buses SPRING */
|
||||
static double cost_of(int m, int bus) /* model m alone (rev_room, rev_spring, rev_hall), or the bus stage */
|
||||
{
|
||||
static int32_t c[CTL], d[CTL], r[CTL], w[CTL];
|
||||
uint32_t b, i, nb = 4u * FS / CTL;
|
||||
uint64_t i0;
|
||||
host_tracks_init();
|
||||
rev_clear();
|
||||
song.g[G_RTYPE] = (int16_t)(what & 1);
|
||||
fx.rtype = (uint8_t)(what & 1);
|
||||
song.g[G_RTYPE] = (int16_t)m;
|
||||
fx.rtype = (uint8_t)m;
|
||||
for (i = 0; i < CTL; i++) {
|
||||
c[i] = noise(30000);
|
||||
d[i] = noise(30000);
|
||||
@@ -540,9 +831,13 @@ static double cost_of(int what) /* 0 rev_room, 1 rev_spring, 2 fx_b
|
||||
}
|
||||
i0 = instr_now();
|
||||
for (b = 0; b < nb; b++) {
|
||||
if (what >= 2)
|
||||
if (bus) {
|
||||
fx_buses(c, d, r, w, CTL);
|
||||
else if (what)
|
||||
if (hl.side)
|
||||
rev_side_mix(c, d, CTL); /* (as mix_block: HALL's stereo) */
|
||||
} else if (m == M_HALL)
|
||||
rev_hall(r, w, CTL);
|
||||
else if (m == M_SPRING)
|
||||
rev_spring(r, w, CTL);
|
||||
else
|
||||
rev_room(r, w, CTL);
|
||||
@@ -551,7 +846,8 @@ static double cost_of(int what) /* 0 rev_room, 1 rev_spring, 2 fx_b
|
||||
}
|
||||
static void test_cost(void)
|
||||
{
|
||||
double room = cost_of(0), spr = cost_of(1), broom = cost_of(2), bspr = cost_of(3);
|
||||
double room = cost_of(M_ROOM, 0), spr = cost_of(M_SPRING, 0), hall = cost_of(M_HALL, 0);
|
||||
double broom = cost_of(M_ROOM, 1), bspr = cost_of(M_SPRING, 1), bhall = cost_of(M_HALL, 1);
|
||||
char what[200];
|
||||
if (!room) {
|
||||
printf("reverb: cost: no instruction counter on this host\n");
|
||||
@@ -560,9 +856,14 @@ static void test_cost(void)
|
||||
snprintf(what, sizeof what, "cost: the reverb alone ROOM %.0f, SPRING %.0f instructions / sample (+%.0f %%, limit +30 %%)",
|
||||
room, spr, (spr / room - 1) * 100);
|
||||
check(what, spr <= room * 1.30);
|
||||
snprintf(what, sizeof what, " HALL %.0f (+%.0f %%, limit +30 %%)", hall, (hall / room - 1) * 100);
|
||||
check(what, hall <= room * 1.30);
|
||||
snprintf(what, sizeof what, " the bus stage (chorus, delay, reverb) ROOM %.0f (~%.1f %%), SPRING %.0f (~%.1f %%): +%.0f (~%.2f %% CPU)",
|
||||
broom, broom * 0.017, bspr, bspr * 0.017, bspr - broom, (bspr - broom) * 0.017);
|
||||
check(what, (bspr - broom) * 0.017 <= 2.0);
|
||||
snprintf(what, sizeof what, " .. HALL %.0f (~%.1f %%, with its stereo): +%.0f (~%.2f %% CPU)",
|
||||
bhall, bhall * 0.017, bhall - broom, (bhall - broom) * 0.017);
|
||||
check(what, (bhall - broom) * 0.017 <= 2.0);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- demos --- */
|
||||
|
||||
@@ -170,6 +170,8 @@ head -c 200000 build/felucca.bin > "$OUT/old_app.bin"
|
||||
python3 tools/fm1pkg_make.py "$OUT/old_app.bin" build/loader/ota.bin "$OUT/old.fwsc" >/dev/null
|
||||
$CC -o "$OUT/ldr_test" tests/ldr_test.c
|
||||
run "update loader: other app -> this build" "$OUT/ldr_test" "$OUT/old.fwsc" build/felucca.fwsc
|
||||
$CC -o "$OUT/ldr_screen_test" tests/ldr_screen_test.c
|
||||
run "update loader's screen (Skiff): UPDATE MODE, WRITING and its bar, UPDATE FAILED" "$OUT/ldr_screen_test"
|
||||
|
||||
if [ -f build/gen/felucca_tables.h ]; then
|
||||
$CC -O2 -w -Ibuild/gen -Ifirmware/src -o "$OUT/hostsim" tests/hostsim.c -lm
|
||||
|
||||
@@ -35,7 +35,8 @@ FUNCS = ["analog_render", "digital_render", "digital_render_legacy", "digital_re
|
||||
"throw_on", "throw_off", # (Skiff) throws (throw.c): while one is out
|
||||
"rev_room", "rev_spring", # the reverb bus (fx.c): REVERB TYPE ROOM / SPRING
|
||||
"dist_hard", "dist_fold", "dist_bits", # (Skiff phase 9) FX > DRIVE's TYPEs (fx.c), on a track that uses one
|
||||
"rev_hall", "cho_mode", # (Skiff phase 9) REVERB TYPE HALL; CHORUS MODE / FEEDBACK (fx.c)
|
||||
"rev_hall", "rev_side_mix", "cho_mode", # REVERB TYPE HALL ((Skiff #19) Felucca's) and its stereo; (Skiff
|
||||
# phase 9) CHORUS MODE / FEEDBACK (fx.c)
|
||||
"mix_part", "mix_split", # (Skiff 1.3) a track's block (fx.c), on either core; the split
|
||||
"track_insert", "ins_drive", "ins_swept", # (Skiff 1.3) FX > INSERT (fx.c), on a track that uses one
|
||||
"mix_spread", "esync_coef", "mod_depth"] # (Skiff 1.3) SPREAD (fx.c), ENV SYNC (voice.c), MOD DEPTH (mod.c)
|
||||
|
||||
@@ -40,7 +40,7 @@ dv_metal_mix 16
|
||||
slicer_track 558
|
||||
slice_render 453
|
||||
slc_rev 120
|
||||
fm1_alnk0_irq 30289
|
||||
fm1_alnk0_irq 8441
|
||||
fm1_timer5_irq 33387
|
||||
click_render 30
|
||||
mod_begin 158
|
||||
@@ -58,7 +58,8 @@ rev_spring 126
|
||||
dist_hard 45
|
||||
dist_fold 46
|
||||
dist_bits 32
|
||||
rev_hall 233
|
||||
rev_hall 1994
|
||||
rev_side_mix 8
|
||||
cho_mode 168
|
||||
duck_block 123
|
||||
duck_apply 13
|
||||
|
||||
+13
-4
@@ -1433,7 +1433,7 @@ static void wdt_ms(void) { fm1_ms++; }
|
||||
static void wdt_key(void) { fm1_ms++; if (fm1_ms % 50u == 0u) fm1_in.notes = 1u; } /* a key pressed after a moment */
|
||||
static int test_menu_tabs(void)
|
||||
{
|
||||
int bad = 0, ok = 1;
|
||||
int bad = 0, ok = 1, drawn;
|
||||
uint32_t t, i, n;
|
||||
for (t = 0; t < MTAB_COUNT; t++) {
|
||||
uint32_t f = mtab_first(t);
|
||||
@@ -1496,11 +1496,12 @@ static int test_menu_tabs(void)
|
||||
turn(EN_K2, -1); ok &= !(ui_prefs & PREF_USB_FIXED) && !fx_usb_fixed;
|
||||
bad += check("MENU: any of KNOB 1..4 changes the selected row's value in any tab, the menu stays", ok && ui.menu == 1);
|
||||
|
||||
/* OCT+ / OCT-: the next / previous value on every kind of row (as the knobs: stopping at the ends; COLOR wraps) */
|
||||
ok = 1;
|
||||
/* OCT+ / OCT-: the next / previous value on every kind of row (as the knobs: stopping at the ends; COLOR wraps); each
|
||||
* new value draws the menu again (drawn: the value in the menu's signature) */
|
||||
ok = drawn = 1;
|
||||
favorites.factory[15][24] = 0xA5u; /* ((1.3) STEP PREVIEW's bit: a byte bank.c freed, as on a unit) */
|
||||
for (i = 0; i < MI_VALUES; i++) {
|
||||
uint32_t n = menu_n(i), v, j, seen, want;
|
||||
uint32_t n = menu_n(i), v, j, seen, want, s0;
|
||||
if (i == MI_TUNE || i == MI_CPU || menu_act(i)) /* ((U3) TUNE's 101 values: below; CPU: below; (1.3) MIDI
|
||||
* LEARN, LEARN CLEAR: actions, test_midi_learn) */
|
||||
continue;
|
||||
@@ -1510,15 +1511,21 @@ static int test_menu_tabs(void)
|
||||
seen = 1u << menu_get(i);
|
||||
for (j = 0; j <= n; j++) { /* up through every value */
|
||||
want = menu_step(i, 1);
|
||||
v = menu_get(i);
|
||||
s0 = ui.menu_sig;
|
||||
press(B_OCTUP);
|
||||
ok &= menu_get(i) == want && ui.menu == 1;
|
||||
drawn &= menu_get(i) == v || ui.menu_sig != s0;
|
||||
seen |= 1u << menu_get(i);
|
||||
}
|
||||
ok &= seen == (1u << n) - 1u;
|
||||
for (j = 0; j <= n; j++) { /* and down again */
|
||||
want = menu_step(i, -1);
|
||||
v = menu_get(i);
|
||||
s0 = ui.menu_sig;
|
||||
press(B_OCTDN);
|
||||
ok &= menu_get(i) == want && ui.menu == 1;
|
||||
drawn &= menu_get(i) == v || ui.menu_sig != s0;
|
||||
}
|
||||
v = menu_get(i); /* the ends: COLOR wraps, the rest stop */
|
||||
if (i == MI_COLOR) {
|
||||
@@ -1539,6 +1546,8 @@ static int test_menu_tabs(void)
|
||||
menu_put(MI_PREVIEW, 0);
|
||||
memset(&favorites.factory[15][6], 0, 6); /* ((1.3) T1..T6 on channels 1..6 again) */
|
||||
bad += check("MENU: OCT+ / OCT- step every value row up / down (THEME wraps, the rest stop), the menu stays", ok);
|
||||
bad += check("MENU: every value row's new value draws the menu again (its value in the signature; 1.3.1's STEP "
|
||||
"PREVIEW and SCREEN OFF stayed as drawn)", drawn);
|
||||
ui.menu_sel = MI_TUNE; /* ((Skiff U3, R8) TUNE: cents, the unit's) */
|
||||
press(B_OCTUP); press(B_OCTUP);
|
||||
ok = song.g[G_TUNE] == 2 && str_eq(menu_vname(MI_TUNE, menu_get(MI_TUNE)), "+2 CT") &&
|
||||
|
||||
@@ -75,10 +75,10 @@ ENV = {"wave":(5, 80, 100, 50), "kit": (0, 127, 127, 60), "multi": (0, 85, 0, 75
|
||||
"oneshot": (0, 127, 127, 70), "sus": (12, 80, 120, 60)}
|
||||
SET_TAG = {"PIANO": "PT_KEYS", "FLUTE": "PT_LEAD", "SAX": "PT_LEAD"} # (Skiff phase 9) core.h PT_*: PRESETS' LIST
|
||||
SET_VARIANTS = [ # (Skiff phase 9) SAMPLE's presets after PERC's slot: (name, e, env, mono, fx, tag[, more]), apply9.py
|
||||
("LOFI PIANO", [0, 0, 110, 1, 30, 0, 30, 0], [0, 127, 127, 70], 0, [40, 10, 20, 40], "PT_KEYS", [("P_DTYPE", 3), ("P_LRATE", 40), ("P_LD_PIT", 1)]),
|
||||
("LOFI PIANO", [0, 0, 110, 1, 30, 0, 30, 0], [0, 127, 127, 70], 0, [40, 10, 20, 40], "PT_KEYS", [("P_DTYPE", 3), ("P_LRATE", 40), ("P_LD_PIT", 8)]),
|
||||
("MUSIC BOX", [0, 24, 0, 0, 110, 0, 0, 0], [0, 90, 0, 80], 0, [0, 30, 40, 60], "PT_PLUCK"),
|
||||
("FLUTE PAD", [2, 0, 0, 1, 90, 0, 0, 0], [80, 90, 120, 100], 0, [0, 60, 25, 90], "PT_PAD"),
|
||||
("DARK SAX", [3, -12, 0, 1, 26, 0, 48, 0], [22, 80, 120, 55], 1, [0, 15, 20, 60], "PT_LEAD", [("P_LD_PIT", 1), ("P_LRATE", 84), ("P_LFADE", 100)]),
|
||||
("DARK SAX", [3, -12, 0, 1, 26, 0, 48, 0], [22, 80, 120, 55], 1, [0, 15, 20, 60], "PT_LEAD", [("P_LD_PIT", 8), ("P_LRATE", 84), ("P_LFADE", 100)]),
|
||||
("KOTO", [0, 12, 0, 0, 120, 0, 22, 0], [0, 72, 0, 50], 0, [0, 0, 25, 30], "PT_PLUCK", [("P_ED_PIT", 2)]),
|
||||
]
|
||||
|
||||
|
||||
+12
-12
@@ -2019,17 +2019,17 @@ function makeMockDevice(opt = {}) {
|
||||
P("ACID", [0, 0, 0, 0, 50, 100, 25, 64], [0, 55, 20, 30], 1, 1), P("SINE KEY", [3, 6, 50, 0, 127, 0, 0, 0], [2, 80, 30, 70], 0, 6),
|
||||
P("RAVE", [4, 30, 64, 0, 85, 20, 30, 64], [20, 80, 110, 60], 1, 13), P("SUB BASS", [3, 0, 0, 0, 40, 0, 20, 0], [0, 60, 100, 20], 1, 8),
|
||||
P("SYNTH PLUCK", [0, 8, 50, 0, 30, 40, 0, 64], [0, 88, 0, 60], 0, 3), P("SYNTH BRASS", [0, 10, 64, 0, 45, 20, 10, 64], [35, 70, 90, 45], 0, 6),
|
||||
P("WIND SWEEP", [0, 0, 0, 90, 30, 90, 0, 0], [60, 90, 60, 80], 0, 5), P("STRINGS", [4, 6, 64, 0, 92, 8, 0, 48], [48, 90, 118, 72], 0, 5, [[15, 20], [9, 72], [13, 1], [12, 80]]),
|
||||
P("WIND SWEEP", [0, 0, 0, 90, 30, 90, 0, 0], [60, 90, 60, 80], 0, 5), P("STRINGS", [4, 6, 64, 0, 92, 8, 0, 48], [48, 90, 118, 72], 0, 5, [[15, 20], [9, 72], [13, 8], [12, 80]]),
|
||||
/* (Skiff) the themes' sounds (src/eng_*.c) */
|
||||
P("BONE FLUTE", [2, 3, 30, 22, 84, 15, 0, 64], [56, 80, 110, 64], 1, 0, [[9, 84], [12, 90], [13, 1]]),
|
||||
P("WAR HORN", [0, 5, 64, 4, 42, 12, 20, 64], [72, 80, 110, 80], 1, 0, [[9, 80], [12, 96], [13, 1]]),
|
||||
P("DARK STRINGS", [1, 4, 64, 6, 40, 34, 22, 40], [100, 90, 120, 105], 0, 0, [[9, 30], [14, 8], [13, 1], [12, 110]]),
|
||||
P("BONE FLUTE", [2, 3, 30, 22, 84, 15, 0, 64], [56, 80, 110, 64], 1, 0, [[9, 84], [12, 90], [13, 8]]),
|
||||
P("WAR HORN", [0, 5, 64, 4, 42, 12, 20, 64], [72, 80, 110, 80], 1, 0, [[9, 80], [12, 96], [13, 8]]),
|
||||
P("DARK STRINGS", [1, 4, 64, 6, 40, 34, 22, 40], [100, 90, 120, 105], 0, 0, [[9, 30], [14, 8], [13, 8], [12, 110]]),
|
||||
P("NIGHT BASS", [0, 7, 64, 0, 40, 35, 15, 64], [0, 64, 50, 30], 1),
|
||||
P("NEON LEAD", [0, 14, 64, 0, 92, 25, 12, 64], [6, 70, 110, 55], 1, 0, [[9, 86], [12, 92], [13, 2], [38, 28]]),
|
||||
P("NEON LEAD", [0, 14, 64, 0, 92, 25, 12, 64], [6, 70, 110, 55], 1, 0, [[9, 86], [12, 92], [13, 11], [38, 28]]),
|
||||
P("SUNSET PAD", [4, 9, 55, 0, 74, 15, 0, 48], [78, 90, 115, 92], 0, 0, [[10, 1], [9, 52], [15, 48]]),
|
||||
P("HERO BRASS", [0, 16, 64, 0, 50, 18, 8, 56], [50, 75, 95, 55]),
|
||||
P("SYN TOM", [3, 0, 0, 6, 127, 0, 25, 0], [0, 76, 0, 60], 0, 0, [[6, 63]]),
|
||||
P("QUANTA", [3, 0, 0, 0, 127, 0, 0, 0], [0, 64, 127, 50], 1, 0, [[10, 4], [9, 96], [13, 40]]),
|
||||
P("QUANTA", [3, 0, 0, 0, 127, 0, 0, 0], [0, 64, 127, 50], 1, 0, [[10, 4], [9, 96], [13, 50]]),
|
||||
/* (Skiff phase 9) more for every engine (src/eng_*.c) */
|
||||
P("REESE", [0, 40, 64, 0, 52, 15, 30, 32], [0, 64, 127, 30], 1, 0, [[9, 30], [14, 8]]),
|
||||
P("DRIVE BASS", [0, 14, 64, 0, 62, 20, 10, 64], [0, 64, 64, 25], 1, 0, [[95, 1], [96, -32]]),
|
||||
@@ -2067,18 +2067,18 @@ function makeMockDevice(opt = {}) {
|
||||
P("FLUTE", [2, 0, 0, 1, 127, 0, 0, 0], [12, 80, 120, 60]), P("SAX", [3, 0, 0, 1, 127, 0, 0, 0], [12, 80, 120, 60]),
|
||||
/* (Skiff phase 9) more for every engine (src/eng_*.c) */
|
||||
P("PIANO", [0, 0, 0, 1, 127, 0, 0, 0], [0, 127, 127, 70]),
|
||||
P("LOFI PIANO", [0, 0, 110, 1, 30, 0, 30, 0], [0, 127, 127, 70], 0, 0, [[95, 3], [9, 40], [13, 1]]),
|
||||
P("LOFI PIANO", [0, 0, 110, 1, 30, 0, 30, 0], [0, 127, 127, 70], 0, 0, [[95, 3], [9, 40], [13, 8]]),
|
||||
P("MUSIC BOX", [0, 24, 0, 0, 110, 0, 0, 0], [0, 90, 0, 80]),
|
||||
P("FLUTE PAD", [2, 0, 0, 1, 90, 0, 0, 0], [80, 90, 120, 100]),
|
||||
P("DARK SAX", [3, -12, 0, 1, 26, 0, 48, 0], [22, 80, 120, 55], 1, 0, [[13, 1], [9, 84], [12, 100]]),
|
||||
P("DARK SAX", [3, -12, 0, 1, 26, 0, 48, 0], [22, 80, 120, 55], 1, 0, [[13, 8], [9, 84], [12, 100]]),
|
||||
P("KOTO", [0, 12, 0, 0, 120, 0, 22, 0], [0, 72, 0, 50], 0, 0, [[6, 2]])] },
|
||||
{ name: "VOICE", titles: ["VOWEL", "TONE"], edit: [D("VOWEL", F.INT, 0, 127, 0), D("VOWEL2", F.INT, 0, 127, 64), D("TALK", F.TIME, 0, 127, 0),
|
||||
D("PITCH", F.SEMI, -12, 12, 0), D("BUZZ", F.PCT, 0, 127, 64), D("BREATH", F.PCT, 0, 127, 10), D("Q", F.PCT, 0, 127, 64), D("RANDOM", F.PCT, 0, 127, 0)],
|
||||
presets: [P("CHOIR AAH", [0, 0, 0, 0, 40, 22, 60, 0], [85, 90, 115, 95], 0, 5), P("VOX LEAD", [32, 0, 0, 2, 90, 8, 72, 0], [6, 70, 105, 55], 1, 4),
|
||||
P("WOW BASS", [95, 0, 68, 0, 100, 0, 80, 0], [0, 70, 70, 30], 1, 8), P("WHISPER", [0, 95, 88, 3, 50, 120, 50, 0], [50, 90, 110, 90], 0, 5),
|
||||
/* (Skiff) the themes' sounds (src/eng_*.c) */
|
||||
P("CRYPT CHOIR", [112, 0, 0, -3, 34, 30, 64, 14], [90, 90, 118, 100], 0, 0, [[9, 70], [13, 1]]),
|
||||
P("MONK CHANT", [95, 0, 96, -5, 80, 12, 80, 0], [50, 80, 115, 85], 1, 0, [[9, 82], [12, 96], [13, 1]]),
|
||||
P("CRYPT CHOIR", [112, 0, 0, -3, 34, 30, 64, 14], [90, 90, 118, 100], 0, 0, [[9, 70], [13, 8]]),
|
||||
P("MONK CHANT", [95, 0, 96, -5, 80, 12, 80, 0], [50, 80, 115, 85], 1, 0, [[9, 82], [12, 96], [13, 8]]),
|
||||
P("DREAM CHOIR", [0, 20, 0, 3, 55, 45, 55, 8], [80, 90, 118, 95]),
|
||||
/* (Skiff phase 9) more for every engine (src/eng_*.c) */
|
||||
P("ROBOT TALK", [20, 100, 40, -12, 110, 4, 90, 30], [0, 70, 100, 30], 1)] },
|
||||
@@ -2089,7 +2089,7 @@ function makeMockDevice(opt = {}) {
|
||||
P("SYNC LEAD", [9, 9, 0, 0, 0, 82, 30, 64], [2, 70, 100, 40], 1, 4), P("RING BELL", [13, 0, 18, 6, 1, 96, 30, 64], [0, 92, 0, 80], 0, 7),
|
||||
P("CHIP CHOIR", [1, 0, 12, 7, 1, 62, 95, 40], [70, 90, 110, 85], 0, 5),
|
||||
/* (Skiff) the themes' sounds (src/eng_*.c) */
|
||||
P("TURBO SYNC", [9, 7, 0, 3, 0, 92, 28, 64], [2, 72, 105, 45], 1, 0, [[38, 24], [9, 86], [12, 90], [13, 1]]),
|
||||
P("TURBO SYNC", [9, 7, 0, 3, 0, 92, 28, 64], [2, 72, 105, 45], 1, 0, [[38, 24], [9, 86], [12, 90], [13, 8]]),
|
||||
P("NEON ARP", [1, 12, 0, 5, 0, 70, 35, 40], [0, 66, 0, 45]),
|
||||
P("COLLIDER", [13, 0, 23, 9, 2, 60, 50, 64], [0, 70, 0, 55], 0, 0, [[6, 36]]),
|
||||
/* (Skiff phase 9) more for every engine (src/eng_*.c) */
|
||||
@@ -2104,7 +2104,7 @@ function makeMockDevice(opt = {}) {
|
||||
P("CATHEDRAL", [12, 2, 0, 0, 0, 6, 0, 0], [48, 64, 127, 72]),
|
||||
/* (Skiff phase 9) more for every engine (src/eng_*.c) */
|
||||
P("PEDAL BASS", [14, 4, 0, -4, 0, 20, 10, 0], [0, 64, 127, 30], 1),
|
||||
P("CLARINET", [9, 0, 2, -5, 0, 0, 14, 1], [24, 64, 120, 45], 1, 0, [[13, 1], [9, 89], [12, 70]])] },
|
||||
P("CLARINET", [9, 0, 2, -5, 0, 0, 14, 1], [24, 64, 120, 45], 1, 0, [[13, 8], [9, 89], [12, 70]])] },
|
||||
{ name: "GRAIN", titles: ["GRAIN", "SPRAY"], edit: [E("SOURCE", ["PIANO", "PIANO", "FLUTE", "SAX", "PIANO", "USR1", "USR2", "USR3"], 0),
|
||||
D("POS", F.PCT, 0, 127, 32), D("SIZE", F.PCT, 0, 127, 80), D("DENSITY", F.PCT, 0, 127, 80),
|
||||
D("PITCH", F.SEMI, -24, 24, 0), D("SPREAD", F.PCT, 0, 127, 30), D("RANDOM", F.PCT, 0, 127, 10), D("TONE", F.PCT, 0, 127, 127)],
|
||||
|
||||
+10
-9
@@ -6,9 +6,9 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Felucca</title>
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22%3E%3Crect width=%2216%22 height=%2216%22 rx=%223%22/%3E%3Crect x=%224%22 y=%224%22 width=%228%22 height=%228%22 fill=%22%23fff%22/%3E%3C/svg%3E">
|
||||
<meta name="description" content="Felucca, the multi-engine synth firmware for the FM-1, running in your browser: the same code the instrument runs.">
|
||||
<title>Try Skiff</title>
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16 16%22%3E%3Crect width=%2216%22 height=%2216%22 rx=%223%22 fill=%22%23111%22/%3E%3Crect x=%223%22 y=%229%22 width=%223%22 height=%224%22 fill=%22%23ff5a36%22/%3E%3Crect x=%227%22 y=%226%22 width=%223%22 height=%227%22 fill=%22%2322c3b4%22/%3E%3Crect x=%2211%22 y=%223%22 width=%223%22 height=%2210%22 fill=%22%23ffbf00%22/%3E%3C/svg%3E">
|
||||
<meta name="description" content="Skiff, the six-track groovebox firmware for the M-VAVE FM-1, running in your browser: the same code the unit runs.">
|
||||
<style>
|
||||
/* DotGothic16 (SIL OFL 1.1, fonts/OFL.txt), cut to printable ASCII, for the knob labels */
|
||||
@font-face { font-family: "DotGothic16"; src: url("fonts/DotGothic16-subset.woff") format("woff"); font-display: swap; }
|
||||
@@ -90,9 +90,10 @@ footer small { font-size: 11px; opacity: .8; }
|
||||
|
||||
<footer>
|
||||
<small class="version">@VERSION@@PREVIEW@</small><br>
|
||||
Felucca by Leo Kuroshita, Hügelton Instruments · <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPL-3.0</a> · browser build after charlesvestal's <a href="https://github.com/charlesvestal/fm1-x0x">X0X</a> · DotGothic16 font, <a href="fonts/OFL.txt">SIL OFL 1.1</a><br>
|
||||
<nav><a href="../installer/">Install</a><a href="../editor/">Editor</a><a href="https://github.com/hugelton/Felucca">Source</a></nav>
|
||||
<small>M-VAVE and FM-1 are trademarks of their respective owners. Felucca is not affiliated with or endorsed by them.</small>
|
||||
Skiff by illuminus5, built on Felucca by Leo Kuroshita, Hügelton Instruments · <a href="https://www.gnu.org/licenses/gpl-3.0.html">GPL-3.0</a> · browser build after charlesvestal's <a href="https://github.com/charlesvestal/fm1-x0x">X0X</a> · DotGothic16 font, <a href="fonts/OFL.txt">SIL OFL 1.1</a><br>
|
||||
Saves stay in this browser. Not here: USB (the editor, MIDI out, audio), the TRS MIDI jack.<br>
|
||||
<nav><a href="../webapp/installer/">Install</a><a href="../webapp/editor/">Editor</a><a href="../learn/">Learn</a><a href="https://github.com/illuminus5/skiff">Source</a></nav>
|
||||
<small>M-VAVE and FM-1 are trademarks of their respective owners. Skiff is not affiliated with or endorsed by them.</small>
|
||||
</footer>
|
||||
</main>
|
||||
|
||||
@@ -100,7 +101,7 @@ footer small { font-size: 11px; opacity: .8; }
|
||||
<script type="module">
|
||||
// the panel's controls and its drawing: ../panel.js (window.PANEL, shared with the Learn page)
|
||||
const { B, EN, PLAY_GREEN, WHITE, ROW1, ROW2, KNOBS } = window.PANEL;
|
||||
const STORE = "felucca-emu-flash";
|
||||
const STORE = "skiff-emu-flash";
|
||||
|
||||
// ------------------------------------------------------------------ the panel
|
||||
// Two drawings of the same controls (PANEL.draw): WIDE after the FM-1's own layout, TALL for a phone held upright.
|
||||
@@ -388,7 +389,7 @@ async function switchOn() {
|
||||
if (m.leds) drawLights(lastLeds = m.leds, m.anim);
|
||||
if (m.sectors && !saveFlash(m.sectors) && !warned) {
|
||||
warned = true;
|
||||
console.warn("Felucca: this browser does not keep the saves; they last until the page closes.");
|
||||
console.warn("Skiff: this browser does not keep the saves; they last until the page closes.");
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -397,7 +398,7 @@ async function switchOn() {
|
||||
await ac.resume();
|
||||
document.getElementById("start").hidden = true;
|
||||
go.textContent = "On";
|
||||
if (ac.sampleRate !== 44100) console.warn(`Felucca: the browser plays at ${ac.sampleRate} Hz, the pitch is off by ${(1200 * Math.log2(ac.sampleRate / 44100)).toFixed(0)} cents.`);
|
||||
if (ac.sampleRate !== 44100) console.warn(`Skiff: the browser plays at ${ac.sampleRate} Hz, the pitch is off by ${(1200 * Math.log2(ac.sampleRate / 44100)).toFixed(0)} cents.`);
|
||||
syncButtons();
|
||||
syncKeys();
|
||||
send({ type: "visible", on: !document.hidden });
|
||||
|
||||
+9
-1
@@ -9,6 +9,7 @@
|
||||
webapp/installer/index.html index_pkg.html, self-contained (fm1pkg.js, fm1ota.js, metadata inlined)
|
||||
webapp/editor/index.html editor.html (+ fukiai.ttf, FUKIAI-LICENSE.txt)
|
||||
learn/ Learn Skiff, the manual in chapters (web/learn, without its local/ review videos)
|
||||
try/ the browser emulator (build/emu from web/emu/build.sh, EMU_PREVIEW=0)
|
||||
panel.js, fonts/ the panel's drawing and the fonts the Learn page shares, at the paths it has in web/
|
||||
src/ not touched
|
||||
|
||||
@@ -87,11 +88,18 @@ def main(pkg, version, out):
|
||||
shutil.copytree(HERE / "learn", out / "learn", ignore=shutil.ignore_patterns("local"))
|
||||
shutil.copy(HERE / "panel.js", out / "panel.js")
|
||||
shutil.copytree(HERE / "fonts", out / "fonts", dirs_exist_ok=True)
|
||||
emu = HERE.parent / "build" / "emu" # ((Skiff #18) the browser emulator: web/emu/build.sh's, ../panel.js)
|
||||
page = (emu / "index.html").read_text(encoding="utf-8") if (emu / "index.html").exists() else ""
|
||||
if f">v{version}<" not in page:
|
||||
raise SystemExit(f"{emu}: no browser build of v{version} without the preview mark "
|
||||
"(EMU_PREVIEW=0 sh web/emu/build.sh, after the release build)")
|
||||
shutil.rmtree(out / "try", ignore_errors=True)
|
||||
shutil.copytree(emu, out / "try")
|
||||
(out / "index.html").write_text(
|
||||
'<!doctype html><meta charset="utf-8"><title>Skiff</title>'
|
||||
'<meta http-equiv="refresh" content="0; url=webapp/installer/">'
|
||||
'<a href="webapp/installer/">Skiff installer</a>\n', encoding="utf-8")
|
||||
print(f"site: {out}: webapp/installer ({len(html)} B), webapp/editor, learn, firmware/{name} ({len(raw)} B, {product})")
|
||||
print(f"site: {out}: webapp/installer ({len(html)} B), webapp/editor, learn, try, firmware/{name} ({len(raw)} B, {product})")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
+1
-1
@@ -137,7 +137,7 @@ async function editorMock() {
|
||||
const nl = E.parse[E.CMD.DUMP](await rq(E.req.dump()), info);
|
||||
await rq(E.req.preset(0, 0));
|
||||
const sl = E.parse[E.CMD.DUMP](await rq(E.req.dump()), info);
|
||||
ok(nl.preset === 16 && nl.p[9] === 86 && nl.p[12] === 92 && nl.p[13] === 2 && nl.p[38] === 28 &&
|
||||
ok(nl.preset === 16 && nl.p[9] === 86 && nl.p[12] === 92 && nl.p[13] === 11 && nl.p[38] === 28 &&
|
||||
sl.p[9] === 60 && sl.p[12] === 0 && sl.p[13] === 0 && sl.p[38] === 0,
|
||||
"editor: NEON LEAD sets its LFO and GLIDE, the next factory preset their defaults");
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
#!/bin/sh
|
||||
# Build (and optionally test) from Windows via WSL: wsl -d Ubuntu -- sh /mnt/c/path/to/skiff/wsl-build.sh [test] [build.sh args]
|
||||
# Uses a Python venv at ~/.venv-fm1 (Pillow + fonttools; see BUILDING.md).
|
||||
# Uses a Python venv at ~/.venv-fm1 (Pillow + fonttools; see BUILDING.md), and Emscripten from ~/emsdk when it is there
|
||||
# (the browser emulator: built and tested by the tests).
|
||||
set -e
|
||||
cd "$(dirname "$0")"
|
||||
export PATH="$HOME/.venv-fm1/bin:$PATH"
|
||||
[ -x "$HOME/emsdk/upstream/emscripten/emcc" ] && export PATH="$HOME/emsdk:$HOME/emsdk/upstream/emscripten:$PATH"
|
||||
if [ "$1" = test ]; then shift; sh build.sh "$@" && sh tests/run_tests.sh; else sh build.sh "$@"; fi
|
||||
Reference in new issue
Block a user