Skip to content

V2#7

Open
joegiralt wants to merge 72 commits into
bjoeri:masterfrom
joegiralt:v2
Open

V2#7
joegiralt wants to merge 72 commits into
bjoeri:masterfrom
joegiralt:v2

Conversation

@joegiralt

Copy link
Copy Markdown

No description provided.

Emilie Gillet and others added 30 commits April 2, 2019 13:24
replace overlapping structures with pointers for latest avr-gcc
suppress undefined behaviour warning
suppress undefined behaviour warning
formant_amplitude[3] is an alias of noise_modulation
comment apparent out-of-bounds loop
Replaces the stock Ambika oscillator set with a focused synthesis engine:
saw, square, triangle, sine, pad, filtered noise, 4-op FM, Karplus-Strong
plucked string, waveshaping, and west coast wavefolder.

New synthesis engines with dedicated UI pages:
- 4-op FM with 8 TX81Z algorithms, 8 waveforms per operator, feedback
- Karplus-Strong with 4 excitation types, 3-read-head ensemble, stiffness
- West coast wavefolder with variable fold stages, FM, self-sync, sub osc
- Waveshaping through distortion table with variable drive

Envelope system expanded with per-envelope curve selection (exponential,
linear, looping, looping linear). Analog slop parameter adds per-note
random pitch and envelope variation for vintage poly character.

Smart patch randomizer with per-section depth control. Step sequencer
removed to free controller flash. S1+encoder navigation for synthesis
mode switching.

Bug fixes: note stack uninitialized variables, transient generator
off-by-one, SPI bulk write bounds check, page group init size.
- Add ExtraEnvelopeSettings struct (4 bytes: ADSR) and extra_env[4]
  array at offsets 112-127, expanding Patch from 112 to 128 bytes
- Add MOD_SRC_ENV_4 through MOD_SRC_ENV_7 to ModulationSource enum
- Remove MOD_SRC_SEQ_1 and MOD_SRC_SEQ_2 (sequencer sources)
- Rename kNumEnvelopes to kNumEnvLfoSlots (value stays 3)
- Add kNumTotalEnvelopes=7, kNumExtraEnvelopes=4, kNumLfos=3
- Add PRM_PATCH_EXTRA_ENV_* parameter enum entries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Expand envelope array from 3 to kNumTotalEnvelopes (7), add rendering
loop for all 7 mod sources (ENV_1-ENV_7), update ADSR parameters from
both env_lfo[] (slots 0-2) and extra_env[] (slots 3-6), extend
COMMAND_RETRIGGER_ENVELOPE cases, and append default ADSR values for
the 4 extra envelopes in init_patch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace removed MOD_SRC_SEQ_1/SEQ_2 enum values with MOD_SRC_ENV_4/ENV_5
in init_patch PROGMEM data, and add 16 bytes of extra_env[4] ADSR
defaults to match the expanded 128-byte Patch struct.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the ParameterEditor-based ENV_LFO page with a custom EnvPage
that supports selecting all 7 envelopes. Envelopes 1-3 show LFO controls
(rate, shape, curve) plus ADSR. Envelopes 4-7 show ADSR only with blank
top-row cells where LFO controls would be.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
joegiralt and others added 30 commits April 20, 2026 15:16
Major FM4Op improvements based on analysis of TX81Z reference samples
and ymfm/SC/ROM disassembly sources:

- Exponential output level curve (0.75 dB/step, 128-byte PROGMEM table)
  Applied in voice.cc before envelope multiply, matching TX81Z signal
  chain: raw level → exp lookup → × envelope → amplitude

- ScaleMod with no shift (was >> 4) for full 8-bit modulation depth,
  giving mod index up to ~3.1 radians at max level

- ScaleCarrier on all 8 algorithms — per-op envelopes now actually
  control carrier output volume (was completely ignored before)

- 16-bit feedback state (was int8_t) prevents the feedback loop from
  locking into a fixed repeating pattern, creating evolving oscillation
  closer to the TX81Z's 14-bit feedback dynamics

- 3-carrier mix (ALG 6,7) changed from /3 division to >> 2 + DC
  correction, avoiding slow AVR integer division

Flash: 32446 text + 82 data = 32528 (240 bytes free)
RAM: +2 bytes for 16-bit feedback state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaced the 2-tap FIR damping filter with a one-pole IIR low-pass.
The FIR barely changed the tone across its full range — now damping
sweeps from bright metallic ring to dark muted thud.

- Damping: IIR cutoff control (was FIR coefficient with uint8_t
  overflow bug at values > 111)
- Decay: applied per delay-line cycle, not per sample (was killing
  the sound in <2ms at any non-zero value)
- Feedback: reduces damping loss for longer sustain instead of adding
  gain (was self-oscillating at value 16+)
- Stiffness: offset scales with delay length (was fixed 7 samples,
  wildly different effect at different pitches)
- Body: halved range for stability (was unstable above 50%)

+2 bytes RAM (int16_t lp_state_), fits in flash (198 bytes free).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Doubled read head deviation (>> 7 instead of >> 8) and spread
(>> 1 instead of >> 2) for more dramatic chorus/detune effect
at high wmix settings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wavefolder:
- Quadratic gain curve (1x-33x) replaces linear 1x-4x.
  Now creates 16+ folds at max vs previous 2-3. Dramatically
  richer harmonic content matching real Buchla 259 character.
- Removed separate fold stages parameter (folds determined
  automatically by gain, up to 16 iterations)
- Drive and input gain properly combine with fold depth

Color filter:
- 2-pole IIR (12dB/oct) replaces single-pole (6dB/oct).
  The steep rolloff actually changes the timbre — sweeps from
  dark fundamental-only to bright full harmonics.
- Min coefficient 16 ensures fundamental passes at darkest setting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
FM: TX81Z-accurate modulation, 16-bit feedback, exponential levels
KS: IIR damping, fixed parameter scaling
WC: Buchla-style quadratic wavefolder, 2-pole color filter

Flash optimization to fit within 32256-byte bootloader limit:
- Removed ScaleCarrier from all algorithms (VCA handles carrier volume)
- Shrunk exp level table from 128 to 64 entries (lower half is all 1s)
- Total: 32228 bytes (28 bytes free)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Power-on and init now start in FM4OP mode with algorithm 1,
all-sine operators at 1:1 ratio, moderate levels.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Trigger was only filling delay_line[0..delay_length_], but
delay_length_ hadn't been updated for the new note yet (SetPitch
runs later in RenderOscillators). Result: every note used the
previous note's buffer length, making all notes sound the same pitch.

Fix: fill the entire 192-sample buffer on trigger. The Render loop
already wraps at the correct delay_length_ set by SetPitch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bug fixes:
- Fix MIDI channel display: channels 1-16 show numbers instead of
  garbage strings (amnt, srce, oct...)
- Fix engine switch: fully isolate shared patch bytes between all
  engines with per-engine state slots (save/restore on switch)
- Fix voicecard frame drops on engine switch: only init the active
  engine, avoid clearing KS delay line unconditionally in audio ISR
- Fix boot page: show engine-appropriate page after multi loads

Improvements:
- Per-engine mod destination names in mod matrix (algo/lvl1-4 for FM,
  damp/body/stif for KS, fold/sym/bias for WC)
- EEPROM auto-reset on firmware upgrade via version marker
- Octave range extended to -4/+4, default -1
- FM init levels reduced to gentle defaults (20/10/10/1)
- Pitch slop gentler, envelope slop stronger
- Voicecard init patch matches controller (FM4OP default)
- Controller test harness for parameter display and engine switch logic

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants