Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ the project file format or the controls.

### Added

- **FM4: modulator waves, the OPS page.** FM4's ninth EDIT page has WAV, the wave of the
modulator pair: `SIN` (FM as it was), `SIN2` (hollow, odd harmonics), `HALF` (warm, even
harmonics) and `DBL` (glassy). Three of the waves the classic 4-operator synths had beside
the sine. No CPU cost. Three new sounds: REED, HORN and TINE. A project from before it opens
on `SIN`.
- **PERC: a noise layer, the NOIS page.** PERC's seventh EDIT page has NSE (noise mix), NDC
(the noise's own decay) and NCL (its colour, 400 Hz to 12 kHz): shakers, brushes and the
stick's snap on a tom from the FM machine. NSE 0 is PERC as it was. Three new sounds: SHAKER,
Expand Down Expand Up @@ -179,6 +184,10 @@ the project file format or the controls.

### Fixed

- **KICK TAPS: TAP turns all the way up.** The knob stopped at 9 of 127, shown as 7%, where the
ghost hits are barely heard: the slot is the WAVE pair's MOD, which has ten modes, and every
machine stopped there. TAP reaches 100%, by the knob, a lock and a saved sound. A kit keeps the
TAP it was saved with.
- **KICK TAPS: no click on the ghost hits.** Each ghost starts its sine at zero; it used to
start wherever the run's phase had got to, which stepped the output.
- **CLR out of PREP no longer removes a zone.** Leaving PREP with CLR lands on ZONES, where CLR
Expand Down
3 changes: 3 additions & 0 deletions app/app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ const char *page_name_on(Page page, uint8_t machine) {
if (machine_is_perc(machine) && page == Page::asr) return "NOIS";
if (machine_is_kick(machine) && page == Page::osc) return "TAIL";
if (machine_is_kick(machine) && page == Page::scn) return "TAPS";
if (machine_is_fm(machine) && page == Page::scn) return "OPS";
return page_name(page);
}
// KICK's PNCH page's encoder names.
Expand All @@ -587,6 +588,8 @@ constexpr const char *kHatCymNames[kAsrParams] = {"TLV", "TDC", "THP", "OPN"};
constexpr const char *kPercNoiseNames[kAsrParams] = {"NSE", "NDC", "NCL", "---"};
// And its TAPS page's (the SCN slots).
constexpr const char *kKickTapNames[kScnParams] = {"TAP", "TDV", "TFB", "TDC"};
// FM4's OPS page's (the SCN slots too): the modulator pair's wave (dsp/fm.hpp); three are free.
constexpr const char *kFmOpsNames[kScnParams] = {"WAV", "---", "---", "---"};

// The ASR page's encoder names (dsp/va.cpp's table). Only the VAs read the page; on any other
// machine its four slots show "---".
Expand Down
6 changes: 3 additions & 3 deletions app/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ bool Engine::apply_sound(const Command &command, int track, int) {
value = uint8_t(next < 0 ? 0 : (next > 127 ? 127 : next));
}
// WAV and DST stop at their last shape and destination (core/project.hpp).
const uint8_t top = kit_param_max(command.a);
const uint8_t top = kit_param_max(machine_id_[track], command.a);
value = value > top ? top : value;
params_[track].v[command.a] = clamp_7bit(value);
// `performed_` is built FROM `params_`, and the per-block copy in process()
Expand Down Expand Up @@ -752,7 +752,7 @@ bool Engine::apply_sound(const Command &command, int track, int) {
for (int i = 0; i < 8; i++) {
const int p = int(command.step) + i;
if (p >= kTrackParams || !user_sound_owns(machine, p)) continue;
const uint8_t top = kit_param_max(p);
const uint8_t top = kit_param_max(machine_id_[track], p);
params_[track].v[p] = bytes[i] > top ? top : bytes[i];
if ((locked >> p & 1u) == 0) effective_[track].v[p] = params_[track].v[p];
}
Expand Down Expand Up @@ -1020,7 +1020,7 @@ bool Engine::apply_step_edit(const Command &command, int track, int step) {
uint8_t value = command.c == kSemitoneFlag && tune_param(machine_id_[track]) == param
? tune_step(machine_id_[track], base, int(int8_t(command.b)))
: clamp_7bit(int(base) + int(int8_t(command.b)));
const uint8_t top = kit_param_max(param);
const uint8_t top = kit_param_max(machine_id_[track], param);
if (value > top) value = top; // WAV and DST stop at their last one

if (!pattern_set_lock(live(), track, step, param, value)) {
Expand Down
7 changes: 7 additions & 0 deletions app/ui_editview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,13 @@
if (machine_is_kick(id)) {
add("TAP GHOST HITS");
add("TDV EVERY 1/16 ...");
} else if (machine_is_fm(id)) {
switch (fm_wave(kit.v[kScnFirst])) {
case 0: add("WAV MODULATORS SINE"); break;
case 1: add("SIN2 HOLLOW: REEDS"); break;
case 2: add("HALF NASAL: BRASS"); break;
default: add("DBL GLASSY: METAL"); break;
}
} else if (!machine_reads_scn(id)) {
add("NOT ON THIS MACHINE");
} else if (va_scan_mode(kit.v[kScnFirst]) == ScanMode::off) {
Expand Down
6 changes: 5 additions & 1 deletion app/ui_mixer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
if (!track_param_real(index)) return "---";
if (index >= kScnFirst) {
if (machine_is_kick(engine_.machine_id(track))) return kKickTapNames[index - kScnFirst];
if (machine_is_fm(engine_.machine_id(track))) return kFmOpsNames[index - kScnFirst];
if (!machine_reads_scn(engine_.machine_id(track))) return "---";
return kScnNames[index - kScnFirst];
}
Expand Down Expand Up @@ -631,6 +632,9 @@
case kOscFirst + 3:
append_ratio(out, fm_carrier_ratio(value));
return true;
case kScnFirst + 0:
append(out, fm_wave_name(fm_wave(value)));
return true;
default:
return false;
}
Expand Down Expand Up @@ -941,7 +945,7 @@
ShownParam shown;
shown.base = engine_.params(selected_).v[index];
shown.heard = shown.base;
shown.top = kit_param_max(index);
shown.top = kit_param_max(engine_.machine_id(selected_), index);
if (held_step_ >= 0 && index >= 0 && index < kTrackParams) {
shown.locked = pattern_get_lock(engine_.pattern(), selected_, held_step_,
uint8_t(index), shown.heard);
Expand Down
10 changes: 10 additions & 0 deletions core/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,14 @@ void knob_rows(const HelpPlace &place, bool slc_auto, char rows[kHelpRows][kHelp
add_row(rows, count, "TAP 0 NONE");
break;
}
if (machine_is_fm(place.machine)) {
add_row(rows, count, "WAV: OPS 2 AND 4");
add_row(rows, count, "SIN PLAIN FM");
add_row(rows, count, "SIN2 HOLLOW ODD");
add_row(rows, count, "HALF NASAL EVEN");
add_row(rows, count, "DBL GLASSY");
break;
}
add_row(rows, count, "POS TO END EACH NOTE");
add_row(rows, count, "MOD OFF FWD REV LOOP");
add_row(rows, count, "LREV PING RET SINE");
Expand Down Expand Up @@ -818,6 +826,7 @@ void edit_title(const char *screen, const HelpPlace &place, char title[kHelpChar
: page == 6 && machine_is_perc(place.machine) ? "NOIS"
: page == 7 && machine_is_kick(place.machine) ? "TAIL"
: page == kScanHelpPage && machine_is_kick(place.machine) ? "TAPS"
: page == kScanHelpPage && machine_is_fm(place.machine) ? "OPS"
: kEditPageNames[page];
Line(title).add(screen).add(" ").add(name).add(" ").add(machine_name(place.machine));
}
Expand Down Expand Up @@ -1067,6 +1076,7 @@ const char *help_param_words(uint8_t machine, int index) {
static const char *const taps[4] = {"GHOST HITS", "DIVISION", "EACH TO NEXT", "GHOST LENGTH"};
return taps[slot];
}
if (machine_is_fm(machine)) return slot == 0 ? "MODULATOR WAVE" : "";
return machine_reads_scn(machine) ? kScnWords[slot] : "";
default: return "";
}
Expand Down
20 changes: 16 additions & 4 deletions core/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
// slap (id 17), 8 x 4 bytes: KitTrack::slap, slap_time, slap_feedback, slap_tone (absent:
// off, the defaults)
// lfo slow (id 18), 8 x 1 byte: KitTrack::lfo_slow, 0-2 (absent: x1); then one byte, the
// drum pages' generation (kKitDrumPagesPerc: PERC's NOIS page is real). A section that
// stops before it is a kit from before NOIS, whose PERC tracks open with it at 0
// machine pages' generation: 1 (kKitDrumPagesPerc) PERC's NOIS page is real, 2
// (kKitPagesFmWave) FM4's WAV too. A section that stops before it is a kit from before
// NOIS; a kit below a page's generation opens with that page at 0
// zones (id 19), only in a kit that has zones, variable length: the track count (8), the
// record size (126), then per track a zone count 0-16 and its 126-byte records (path,
// START, END, LVL, TUN, MODE, CHK, GAIN, FLAGS; core/project.hpp, kSectionKitZones).
Expand Down Expand Up @@ -461,6 +462,10 @@ constexpr uint32_t kKitLfoSlowBytes = uint32_t(kTracks);
// writer that knows NOIS says so here, and a reader zeroes the three on a kit that does not.
constexpr uint32_t kKitDrumPagesBytes = 1;
constexpr uint8_t kKitDrumPagesPerc = 1;
// 2: FM4 reads the SCN page's first slot as WAV (2026-11-30). The same story: an FM4 track that
// was once a WAVE track can hold a scan mode there, which would now pick a wave.
constexpr uint8_t kKitPagesFmWave = 2;
constexpr uint8_t kKitPagesWritten = kKitPagesFmWave;
constexpr uint32_t kKitLfoSlowWritten = kKitLfoSlowBytes + kKitDrumPagesBytes;
constexpr uint32_t kKitLfoSlowOffset = kKitSlapOffset + kKitSlapBytes;
constexpr uint32_t kKitTotalBytes = kHeaderBytes + kKitLfoSlowOffset + kKitLfoSlowWritten;
Expand Down Expand Up @@ -1169,7 +1174,7 @@ SerializeResult kit_write(const Kit &kit, uint8_t *buffer, uint32_t capacity, ui
w.u8(slap_sanitized(track.slap_tone));
}
for (int t = 0; t < kTracks; t++) w.u8(lfo_slow_sanitized(kit.tracks[t].lfo_slow));
w.u8(kKitDrumPagesPerc);
w.u8(kKitPagesWritten);

if (zones_bytes != 0) {
w.u8(uint8_t(kTracks));
Expand Down Expand Up @@ -1458,7 +1463,7 @@ SerializeResult kit_read(Kit &kit, const uint8_t *buffer, uint32_t size) {
if (!r.seek(kHeaderBytes + offset[15])) return refuse(SerializeResult::malformed);
for (int t = 0; t < kTracks; t++) {
for (int p = kKitScnFirst; p < kKitParams; p++) {
kit.tracks[t].params[p] = clamp_u8(r.u8(), 0, kit_param_max(p));
kit.tracks[t].params[p] = clamp_u8(r.u8(), 0, kit_param_max(kit.tracks[t].machine, p));
}
}
if (!r.ok()) return refuse(SerializeResult::truncated);
Expand Down Expand Up @@ -1616,6 +1621,13 @@ SerializeResult kit_read(Kit &kit, const uint8_t *buffer, uint32_t size) {
for (int p = kKitArpEnd; p < kKitAsrEnd; p++) track.params[p] = 0;
}
}
// And one from before FM4's WAV: the sine, the machine as that kit played it.
if (drum_pages < kKitPagesFmWave) {
for (int t = 0; t < kTracks; t++) {
KitTrack &track = kit.tracks[t];
if (machine_is_fm(track.machine)) track.params[kKitScnFirst] = 0;
}
}
return SerializeResult::ok;
}

Expand Down
27 changes: 23 additions & 4 deletions core/project.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ constexpr uint8_t kKitLfoDestMax = uint8_t(kKitSoundParams); // OFF, then the 1
// The marker byte the layout sections hold: 1 = WAV and DST are numbers.
constexpr uint8_t kLfoLayoutNumbers = 1;

// The highest value a parameter byte may hold: 127 for all but WAV, DST and SCN's MOD. Knobs,
// locks, random ranges and LIVE RND clamp to it, so a knob does not wind past the last shape.
// The highest value a parameter byte may hold when the machine is not known (a scene, a lock, a
// random range): 127 for all but the LFO's WAV and DST. Slot 40 is a number, 0-9, on the WAVE
// pair alone (SCN's MOD); on KICK it is TAP, a level, so the limit there needs the machine
// (kit_param_max(machine, index), below the machine predicates). The WAVE voice reads a MOD
// past its last mode as the last (va_scan_mode).
constexpr uint8_t kit_param_max(int index) {
return index == kKitLfoWaveIndex ? kKitLfoWaveMax
: index == kKitLfoDestIndex ? kKitLfoDestMax
: index == kKitScanModeIndex ? kKitScanModeMax
: uint8_t(127);
}

Expand Down Expand Up @@ -281,7 +283,24 @@ constexpr bool machine_is_wave(uint8_t id) {
constexpr bool machine_reads_scn(uint8_t id) { return machine_is_wave(id); }
// Does this machine have the page at all, as the scan or as KICK's TAPS (dsp/kick.hpp)? What
// shows, names, saves and presets the page's bytes asks here.
constexpr bool machine_has_scn_page(uint8_t id) { return machine_reads_scn(id) || machine_is_kick(id); }
// FM4's is OPS, with one knob so far: WAV, the modulator pair's wave (dsp/fm.hpp).
constexpr bool machine_has_scn_page(uint8_t id) {
return machine_reads_scn(id) || machine_is_kick(id) || id == uint8_t(MachineId::fm);
}
// FM4's WAV is a number like SCN's MOD, in the same slot: SIN SIN2 HALF DBL.
constexpr int kKitFmWaves = 4; // static_asserted in dsp/fm.hpp
constexpr uint8_t kKitFmWaveMax = uint8_t(kKitFmWaves - 1);

// The highest value a parameter byte may hold on this machine: kit_param_max(index), and SCN's
// MOD stops at its last mode on the machines that scan, as FM4's WAV does at its last wave. Knobs, the kit's reader and a loaded
// sound clamp to it, so a knob does not wind past the last mode. KICK's TAP shares the slot and
// is a level, 0-127: until 2026-11-30 every machine stopped at 9 there, which held TAP at 7%.
constexpr uint8_t kit_param_max(uint8_t machine, int index) {
return index != kKitScanModeIndex ? kit_param_max(index)
: machine_reads_scn(machine) ? kKitScanModeMax
: machine == uint8_t(MachineId::fm) ? kKitFmWaveMax
: kit_param_max(index);
}

// FM4: four sine operators in one of eight algorithms (dsp/fm.hpp).
constexpr bool machine_is_fm(uint8_t id) { return id == uint8_t(MachineId::fm); }
Expand Down
16 changes: 14 additions & 2 deletions core/sounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,16 @@ constexpr SoundPreset kFmPresets[] = {
// A drone: three carriers over one modulator, a slow swell, the index held, feedback for
// breath. Long notes.
{"DRONE", {88, 40, 50, 40}, FLAT, {100, 30, 30, 72}, {60, 120, 100, 90}, {50, 70, 30, 13}},
// The modulator waves (WAV, the last four bytes' first; 2026-11-30). A reed: two pairs at
// 1:1 with SIN2, whose odd harmonics make the hollow tone of a clarinet or a reed organ. Held.
{"REED", {72, 24, 62, 20}, FLAT, {80, 60, 60, 72}, {10, 100, 30, 80}, {20, 64, 40, 13},
{1, 0, 0, 0}},
// A horn: BRASS's algorithm with HALF, whose even harmonics are the nasal part of a brass
// tone. HALF's first harmonic is half the sine's, so the same IDX is mellower: IDX is up.
{"HORN", {40, 24, 90, 40}, FLAT, {80, 90, 60, 59}, {45, 100, 35, 85}, {15, 64, 40, 13},
{2, 0, 0, 0}},
// A tine: two pairs at 1:1 with DBL, glassy from the first turn of IDX, ringing.
{"TINE", {72, 24, 45, 0}, FLAT, {100, 120, 90, 71}, NO_ASR, {25, 64, 50, 13}, {3, 0, 0, 0}},
};

// --- GRAIN: POS SIZ DEN SPR / PIT SHP DEC LVL / ATK SUS REL --- / SCN PSP (dsp/grain.cpp) ----
Expand Down Expand Up @@ -608,8 +618,10 @@ uint64_t sound_preset_writes(uint8_t machine) {
case MachineId::perc: return kSrcFltrAmp | kDrumPageBits; // NOIS (dsp/perc.hpp)
case MachineId::hat: return (kSrcFltrAmp | kDrumPageBits) & ~(uint64_t(1) << kHatChoke);
case MachineId::va_mono:
case MachineId::va_poly:
case MachineId::fm: return kSrcFltrAmp | kAsrBits | kOscBits;
case MachineId::va_poly: return kSrcFltrAmp | kAsrBits | kOscBits;
// And WAV, the first of the SCN slots (dsp/fm.hpp); its other three are not read.
case MachineId::fm:
return kSrcFltrAmp | kAsrBits | kOscBits | (uint64_t(1) << kSoundScnFirst);
case MachineId::wave_mono:
case MachineId::wave_poly: return kSrcFltrAmp | kAsrBits | kOscBits | kScnBits;
case MachineId::grain:
Expand Down
2 changes: 1 addition & 1 deletion core/usersounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ bool user_sound_store(UserSoundBank &bank, int slot, const char *name, const uin
s.used = true;
copy_name(s.name, name);
for (int p = 0; p < kKitParams; p++) {
const uint8_t top = kit_param_max(p);
const uint8_t top = kit_param_max(bank.machine, p);
s.params[p] = params[p] > top ? top : params[p];
}
s.extras = sanitized(extras);
Expand Down
26 changes: 24 additions & 2 deletions docs/BUDGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ No audio cost: SLOW multiplies a synced cycle's ticks or divides a free rate onc
LFO's settings are made (`LfoSettings::make`), and the LFO then steps once a block as before.
`scenario_lfoslow` checks the pushes and the page on the C674x; its peak is the factory beat's.

### FM4's WAV (2026-11-30)

WAV changes which table operators 2 and 4 read: `strata_fm_add` and `strata_fm_add_free` take a
second table pointer and are otherwise the loops they were, and the choice of table is made at
control rate. No cost is expected. `scenario_fmwave` is `scenario_fm` with WAV on DBL.
**Not measured yet**: cl6x and the emulator run on Roland's PC; the cl6x listing of the two
loops should be compared with the one before (`tools/ti_loops.py`).

### PERC's NOIS (2026-11-30)

The noise layer is, a sounding voice, a block of `enaga_noise_add`, one envelope render, one
Expand Down Expand Up @@ -474,8 +482,22 @@ worst 34.20%, `genload`.
**GRAIN (2026-11-30).** A GRAIN track's WID pans each grain at its onset and renders the cloud
as a pair (`strata_grain_add_mono_pair`: one more multiply-add a sample a grain) into the stereo
chain. `scenario_grainwide` is `scenario_grain` (SHIMMR on track 8) with track 8's WID at 48.
**Not measured yet**: cl6x and the emulator run on Roland's PC. The estimate is the review's, 1 to
1.5 points with cl6x, most of it the second chain.
Measured at `d8b6c38` (emulator, Enaga v0.4.0, Roland's PC, all 66 scenarios with both
compilers):

| Scenario | cl6x | GCC-only |
| --- | --- | --- |
| `grain` (WID 0) | 28.62% | 63.49% |
| `grainwide` (WID 48) | 29.36% | 63.49% |
| `genload` | 32.16% | 67.06% |
| `stack` | 42.23% | 84.13% |
| `genall` (the worst with cl6x) | 43.84% | 73.88% |

The wide cloud costs 0.74 points with cl6x, under the review's estimate of 1 to 1.5; GCC-only
the two peak on the same block, so the pair is not what sets that peak. cl6x built
`grainloops.ti.c` without a remark and all 66 scenarios pass. GCC-only 47 of 66 pass: 17 fail
only their load line (the GCC-only column has been over those lines since v0.7.0's pass,
docs/SCENARIO_LOG.md) and `controls` and `triplets` log a save too late.

### The line input (2026-11-28, emulator, Enaga v0.4.0)

Expand Down
Loading