Cross-synthesis: audio's two-signal tools applied to two textures
Started 2026-11-24. Status: ⚪ concept only. An ideas note, not a spec. Nothing here was built, run or measured.
Provenance. Fleshes out section H of ideas/audio_inspired_visual.md. Written by Claude, offline, on 2026-11-24. Observed offline means read from files this session; nothing was run in Max, no test or bench was run, and every cost figure is a quote of a doc or is labeled (inferred). External claims are labeled (external) with a source in "Sources". Sibling notes: dspless_control_modules.md; sibling specs in progress elsewhere (not read, not edited): .specify/stable/f_dynamics/ (A), .specify/f_wavetable/ (B), .specify/stable/f_crossover/ (C), .specify/f_vf_resonate/ (D).
Specs extracted 2026-11-25 (Claude, offline; nothing decided by Matt): .specify/cross_synthesis/overview.md (shared decisions, Q1 to Q6, order), and one spec each for f_midside, f_vocoder, f_convolve, f_phasemag, f_freqshift in .specify/<module>/spec.md. This note stays the concept record.
The frame
Cross-synthesis means one signal supplies a property and the other supplies the material. In audio the property is a spectral envelope or a phase, the material is a carrier. Here both are textures, and "spectrum" has two possible meanings that this note keeps apart:
- Local band energy (spatial domain). Filter a texture into bands by spatial frequency, then follow each band's amplitude per pixel. Works with ordinary pix passes. Needs no FFT.
- Global Fourier spectrum (frequency domain). A 2D transform of the whole frame. Every bin describes the whole image, so "where" information lives only in the phase. Needs a DFT or FFT.
The four seeds split along that line: the vocoder and mid/side are spatial-domain; convolution reverb and the phase/magnitude swap are frequency-domain; the frequency shifter can be done either way.
Facts this note rests on (observed offline by Claude, 2026-11-24)
Vsynth, installed package ~/Documents/Max 9/Packages/Vsynth/ (box texts and codebox code dumped from the .maxpat JSON; patchlines not traced, so wiring statements are inferred):
vs_op2isjit.gl.pix vsynth @gen vs_op2pass.genjit @type char, with the op chosen by swapping the gen file (pass add subs mult div inv comp1 comp2 max min;code/vs_op2subs.genjitis justin1 - in2). It is 8-bit and has no constant operand (vs_op1is the one-input sibling, same@type char). SoA - Bclips negative values to 0, andA + Bclips at 1. A signed signal needs a 0.5 offset or a float32 pix.vs_blendmode_mixeris@type charwith 13 gen files (vs_bm_absdiff add alpha avg exclude max min mod mult negate screen sub);vs_mixer_3is@adapt 0 @type char.vs_convolveis a 3x3jit.gl.pix vsynth @type charwith ninesampletaps, awidthtap spacing parameter and a 12-item kernel menu (Sobel in four directions, emboss, box, Gaussian 3x3, sharpen, outline, two edge detectors, identity). It is 8-bit in and out.vs_filter_hp4xcontains acharpix whose box list (* 0.5,* 0.5,+,!- 1., two inlets) reads as0.5*a + 0.5*(1-b), i.e. a difference encoded around mid-gray (inferred from the box list). The blur inside isvs_2xblur(abstraction, twojit.gl.pixper instance, awidthparameter).vs_filter_spathas lowpass, highpass and bandpass modes built from fourvs_2xblur, amax-basedbandpasspix and achar4-way selector.vs_frame_delayis ajs jit.gl.textureset.jsset of 60 textures withxfadepix (@adapt 1, one of them@type char);vs_differentiatoroutputsabsdiff(in1, in2)on acharpix, unsigned.- Neighbors in
docs/vsynth-reference/module-inventory.mdagree:vs_wfg_3andvs_envelopeoutputs arefloat32; the texture path is mixed 8-bit and float32.
Repo (docs and source, read this session):
- GPU DFT:
src/f_vf_fluid/gen_dft.pywrites four separable-DFT codeboxes (fx fy iy ix) with N = 256 baked in (the literal appears exactly twice per file and the script asserts it). Each output texel runs a 256-iteration loop ofnearest()reads with a twiddletwopi * mod(k*n, N) / N. That is a direct O(N) per texel per axis DFT, not a fast FFT (thegen_dft.pyloop; the repo's own bench says it matchesnp.fftto ~1e-7 relative,jit-gen-codeboxreferences/numerics-and-limits.md). Four float channels carry two complex fields per pass (R,G and B,A). The domain is periodic, bins arefloor(norm * N), andnearest()at texel centers is needed. Shared byf_vf_fluid,f_ks,f_wave_field(their docs) and formerlyf_wc_fft(superseded; source at commitd628ae8, per the banner ofdocs/f-reference/superseded/f_wc_fft.md). - Cost, from the docs: about 0.5 to 0.65 ms per DFT pass at the 256² solver size (
f_vf_fluid.md, "Cost"); the whole 7-stage chain was 2.39 to 2.5 ms (f_ks.md,f_vf_fluid.md;f_wave_field.md2.52 ms, measured before its redesign). Bench machine detail is in those docs; other machines not measured. - The solver grid is fixed at 256² and only the last stage follows render size; the input is minified into the grid by a
taps x tapsbox average (f_vf_fluid.md).sample()of a larger texture into a fixed-dimstage aliases (jit-gen-codeboxSKILL checklist). f_wc_fftwas replaced byf_wc, a render-resolution solver with 1 px and 2 px Gaussian kernels in the spatial domain, "no FFT" (ideas/f_wc.md): the project already took the spatial route once when kernels were small.- Loops: 128, 256 and 512 iteration
forloops with fournearest()reads compile and are correct; a 256-tap unrolled shader overflows the statement budget (numerics-and-limits.md). atan2has a NaN and branch-cut hazard (numerics-and-limits.md, "NaN andatan2"). Relevant below: the phase/magnitude swap can avoid it.
Max (/Applications/Max.app, Contents/Resources; help and example patches read, nothing opened in Max):
jit.fft(C74/docs/refpages/jit-ref/jit.fft.maxref.xml,C74/help/jitter/jit.fft.maxhelp): a matrix FFT, forward or@inverse 1, 2 planes (real, imaginary), float32 or float64, "matrices of any size are supported; dimensions are not required to be powers of two" (the refpage notes older versions truncated to a power of two). It is CPU (a matrix object). Three shipped example patches use it on 128x128 float32 video:Examples/jitter-examples/video/analysis/jit.fft-mask,-threshold,-rota. They show the usual recipe:jit.unpack/jit.pack, forward FFT,jit.op hypotfor magnitude,jit.reposto center the spectrum, a mask or threshold orjit.rotaapplied to the spectrum, inverse FFT.MaxFFT2Din thev8object (Max 9):Examples/javascript/v8-fft/v8-maxfft2d-jitter-gate.js's header says it transforms a Jitter matrix up to 2^26 per dimension, char or float, 1 to 4 planes, with an exact Bluestein fallback for sizes not factoring as 2^a 3^b 5^c ("correct, just slower"). It is a spectral gate demo (zero bins under a threshold). Read from the header comment only; the API was not exercised.- The audio side has
pfft~examples includingExamples/gen/pfft.cross-synthesis.maxpat(audio only; its one comment says "Bias toward higher frequencies"; I did not read its flow).pfft-spectral-processingskill coverspfft~for audio and does not apply to textures. - Searched, nothing image-FFT found:
Jitter Recipes,Polish Your Pixels(a tutorial mentionsfftbut is not an image-FFT patch),ISF(FFT_Color_Lines.fsis an audio-spectrum visual),av-toolbox(audio spectrum). So there is no GPU image FFT in Max or the installed packages; the repo's own DFT stages are the only GPU one.
1. Spatial vocoder
In audio. Split the modulator (voice) and the carrier (synth) into the same bands. Follow each modulator band's envelope and use it as the gain of the same carrier band, then sum. The carrier keeps its own pitch and texture but takes the modulator's spectral shape over time.
On images. Split A and B by spatial frequency into K bands (coarse to fine). Per pixel, follow band k of A: its local amplitude (rectify, then blur). Use that to set the gain of band k of B. The result keeps B's local fine structure but redistributes where it is strong according to A. Coarse bands carry where A has big shapes; fine bands carry where A has detail, so edges and busy regions of A "light up" the grain of B. No pixel of A is copied. Two variants: gain (multiply B's band by A's envelope) and normalized (also divide by B's own envelope, so B's band takes on A's energy exactly, the whitened vocoder). The normalized form is the closer analog to a channel vocoder and also the more fragile one (see risks).
Signal flow, with existing parts and new ones.
A --> [band split, K bands] --> band_k(A) --> |.| --> blur (vs_2xblur, width w_k) --> env_k(A)
B --> [band split, K bands] --> band_k(B) ------------------------------+
v
out_k = band_k(B) * env_k(A) [* 1/(env_k(B)+eps) if normalized]
sum_k out_k (+ B's residual lowpass, optional) --> output- Band split: idea C. Until
f_crossoverexists, a hand version from parts:vs_filter_spat(low, high, band modes) or twovs_2xblurat different widths and a difference (difference of Gaussians). Three bands is the natural start. - Envelope:
absof a signed band needs a float32 or offset-aware pix (abs(x - 0.5)if the band is stored around mid-gray asvs_filter_hp4xdoes).vs_2xblurfor the smoothing, with the width scaled to the band (a coarser band wants a wider envelope, about the band's wavelength (inferred)). - Gain:
vs_op2mult exists but is 8-bit, and signed bands lose precision there. A float32 pix that takes the four textures at once (bands of B, envelope of A, optional envelope of B) is needed; with K bands, one pix per band or a packed layout (RGBA = 4 bands in one texture) (design choice, unresolved).
What does not exist. A float32 spatial band split (idea C); a float32 abs/envelope step; a per-band gain-and-sum pix. No FFT.
Minimal first experiment (described, not run). Offline NumPy: two grayscale test images, a 3-band difference-of-Gaussians split with sigmas (1, 3, 9 px), envelope = Gaussian blur of abs(band) at 2x the band sigma, gain form first, then the normalized form with eps = 0.02. Compare to Heeger-Bergen's pyramid synthesis framing (external) and judge by eye: does B's grain visibly follow A's layout? Then a scratch Max patch with three vs_2xblur per input and one hand-written float32 pix, no module.
Cost class (inferred). Per frame: 2 inputs x (K-1 blurs) + K envelope blurs, each vs_2xblur being two pix (per its box list), plus the combine. At K = 3 about 12 to 14 small blur passes at render size. The blur widths scale with the band, so cost is texture bandwidth, not tap count; there is no measured figure for vs_2xblur in the repo docs I read. Cheaper if the bands live on a pyramid (half-resolution per band), which is a reason to see how f_crossover is built before choosing.
Good and bad. Good: B has real texture in every band (noise, a camera, a fine pattern) and A has clear structure at several scales (a face, text, a blobby field). Time-varying A gives a "talking texture". Bad: B smooth in a band (nothing to modulate, the band is empty); A very flat; K too high (the result is blotchy because envelopes are noisy); normalized form on noisy B (it amplifies noise where env_k(B) is small).
Risks. Division blow-up where B's envelope is near 0 (needs the eps floor and a gain clamp). 8-bit banding if any signed intermediate passes through a char pix. Edge wrap of the blur (G-edge-wrap in .specify/gates.md concerns out-of-range sample() wrapping in pix chains; blurs near the border are exposed to it). Envelope lag: the smoothing sets a spatial smear, no time lag, so no feedback hazard.
Open for Matt. Q1, Q2 (end of file).
2. Mid and side for textures
In audio. M = (L+R)/2 holds what the channels share; S = (L-R)/2 holds how they differ. Process them separately (widen by boosting S, mono-ize by killing S) and decode L = M+S, R = M-S.
On images. Two source pairs make sense:
- Current and previous frame. M is the static part, S the motion (this is
0.5 + (current - memory)off_adaptNovelty with a one-frame memory,ideas/f_adapt.md, so the pair is the same signal with a different consumer). Processing S alone (glow it, blur it, delay it, boost it) and re-adding gives "motion-only effects" without a mask. Killing S freezes the picture to its static layer. - A stereo pair or two cameras / two generators. M is the common part, S the difference. S as a displacement or mask source gives disparity-like or "what differs" fields; decode is the way back.
Signal flow.
A, B --> encode --> M = (A+B)/2 S' = 0.5 + (A-B)/2 (S' stored around mid-gray)
M --> [process M] S' --> [process S, mid-gray aware]
decode: A' = M + (S'-0.5) B' = M - (S'-0.5)Corrected 2026-11-25 (Claude, by hand, one case: A = 1, B = 0 gives M = 0.5, S' = 1.0; the earlier decode with a factor 2 returned 1.5). Not yet checked in NumPy; see .specify/f_midside/spec.md User Story 1.
- With existing parts:
M=vs_blendmode_mixeravggen (exists).S'is the0.5*a + 0.5*(1-b)pattern found invs_filter_hp4x(inferred reading). Decode withvs_op2add and sub needs the S' re-centered, which is not a single op2: so decode is two small pix. Everything is 8-bit, so S' has 7 bits of signal. - Previous frame:
vs_frame_delay(one tap,xfade) or a draw-order feedback pair as invs_differentiator.
What does not exist. A float32 encode/decode pix pair (or one pix with a mode param). It is a very small module, one pix each way, but float32 with offset handling is the point; the 8-bit path will look banded in dark S.
Minimal first experiment. NumPy first: encode a video clip frame pair, scale S by 0, 1, 3, check that the decode with unchanged S returns the input exactly (float) and within 1/255 (8-bit round trip). Then a scratch patch: two jit.gl.pix (encode, decode) around f_vf_glow on S.
Cost class (inferred). One cheap pass each way, plus whatever the middle does. The cheapest of the four.
Good and bad. Good: video with moving subject on a still background (S is the subject outline); a pair with a real, structured difference. Process S at mid-gray: effects must preserve mid-gray as zero (a blur is fine, a brightness change shifts zero). Bad: camera noise (S is mostly noise at rest, the glow of S sparkles); exposure drift (M and S both move).
Risks. The overlap with f_adapt Novelty is the main one: if f_adapt is built, encode is a mode of it and only decode is new. Not yet decided there (ideas/f_adapt.md, "Overlap with core Vsynth"). Mid-gray is "zero", so a color chain that is not zero-preserving corrupts S silently. Decode of S after a hard clamp loses the sign information.
Open for Matt. Q3.
3. Convolution as visual reverb
In audio. Multiply the input's spectrum by the impulse response's spectrum (fast convolution). The room's reflections smear every event into the IR's shape. Large IRs (seconds) are only practical through an FFT.
On images. Convolve the frame with an impulse-response texture: a bright dot becomes a copy of the IR. IRs: a Gaussian (blur), a ring (halo or bokeh), a star or polygon (lens flare, the bloom precedent: Unreal's convolution bloom does this for glints, external, see Sources), a photograph, or f_ks/f_wc/f_wave_field output as a living IR. The "reverb" reading: the IR's decaying tail is a spatial echo around every bright feature.
Why it needs new work. vs_convolve is 3x3 with 8-bit I/O. A separable large Gaussian is already cheap (vs_2xblur), but an arbitrary, non-separable IR of N x N is N² taps per pixel in the spatial domain. Options:
| Route | What it is | Notes |
|---|---|---|
| a. Spatial taps | a loop-based pix, N² taps (or a sparse sample of the IR) | no FFT; cost grows with IR area; fine for a 16x16 IR at most (inferred) |
| b. GPU DFT, this repo | forward DFT of A (fx fy), multiply by the IR's spectrum, inverse (iy ix) | 4 DFT passes per frame, about 2.0 to 2.6 ms at 256² by the documented 0.5 to 0.65 ms per pass; IR spectrum is computed only when the IR changes; fixed 256² grid |
c. CPU, jit.fft or MaxFFT2D | readback, transform, multiply, inverse, upload | any size; costs a readback and upload per frame and at least one frame of latency (inferred; f_util_profile and asyncread precedent in ideas/audio_inspired_visual.md section F) |
| d. Hybrid | IR's spectrum precomputed once offline or in jit.fft, uploaded as a float32 texture; A's transform on the GPU | removes the IR from the per-frame budget |
Signal flow for route b/d.
A -> [minify to 256², pad] -> fx -> fy -> [spectrum x IR_hat] -> iy -> ix -> real part -> [magnify, gain, mix] -> out
IR -> (same fx fy once, on change) -> IR_hatThe spectrum multiply is a complex multiply on the RG and BA pairs. Two real inputs can share one complex transform (put A in the real plane and a second image in the imaginary one, separate by conjugate symmetry: the standard two-for-one real-FFT trick, external, textbook), so RGBA of a pass can carry up to 4 real images, for example the three color channels of A. That is a packing decision the existing chains do not make (they use the two complex fields for u, v or E, I).
What does not exist. A "spectrum multiply" pix; a re-usable forward/inverse pair that exposes the spectrum as a texture (today each chain is closed inside its module); a float32 path from A in at render size. Handling of the periodic wrap: DFT convolution is circular, so a bright feature at the right edge leaks onto the left edge. Unreal's convolution bloom has a "convolution buffer" for exactly this (external). Here it means padding into a bigger grid or accepting a toroidal look (the repo's solvers already treat the frame as a torus).
Minimal first experiment. NumPy: convolve a test photo with a star IR at 256² by np.fft.fft2 and compare to direct convolution (circular) to confirm what an exact result looks like; then show the wrap artifact with a bright spot near the edge and the padded variant. In Max: reuse f_ks's four DFT boxes in a scratch patch (src/f_ks/gen_dft.py output), with a new multiply pix between fy and iy. Judge by a single bright dot (the output should be the IR) before using any image.
Cost class (inferred). DFT-dominated and cubic in the grid edge: each output texel loops over N inputs, so one pass is N³ taps (256³ = 16.8 M tap-reads per pass). A 512² grid costs about 8 times per pass (inferred from the loop structure; unmeasured), which would put four passes in the tens of ms. So a 256² grid is the workable size and the result is a soft image magnified to render size: right for blurry, large kernels (the case where a direct approach fails), wrong for crisp detail.
Good and bad. Good: high-contrast sparse inputs (bright shapes on dark) with a bold IR, so the repeated IR is readable, like the glint and bokeh uses in the bloom precedent. Bad: dense photos with a wide IR (a mush; this is just a blur); an IR with a negative lobe (ringing); IR not normalized (the picture brightens or darkens, as the bloom docs warn (external)); minify aliasing of a fine A into 256².
Risks. The cost is real but bounded (the library already ships three modules at this price). Float32 range for HDR-style IR hot spots (the DFT stages are float32; any char hop kills it). Zero-IR or DC drift (normalize at load). A fixed 256 literal means no size choice without regenerating the codeboxes.
Open for Matt. Q4.
4. Phase and magnitude swap, and a frequency shifter
4a. Phase and magnitude swap
In audio. Magnitude of A with the phase of B is the classic spectral cross-synthesis: it keeps A's spectral content and B's timing structure. (pfft.cross-synthesis is the Max audio example; I did not read its flow.)
On images. The well-known result (external): swap Fourier magnitude and phase of two images and the reconstruction reads as the phase donor, because phase carries the edges and positions (Oppenheim and Lim 1981, with the later caveat that for small patches magnitude dominates). So |A| * phase(B) looks like B with A's texture statistics: B's layout, A's grain. |B| with random phase is a texture of B's frequency content with no layout (a related synthesis idea: Heeger and Bergen's stochastic textures, external). Unit magnitude with B's phase (B_hat / |B_hat|, spectral whitening) is an edge-only drawing of B.
Signal flow. Both A and B through fx fy, then per bin:
out_hat = |A_hat| * B_hat / (|B_hat| + eps)then iy ix. This needs no atan2: the unit phasor is B_hat divided by its magnitude, avoiding the atan2 branch-cut and NaN issue noted in numerics-and-limits.md. A morph control mixes the phasors (mix(unit(A_hat), unit(B_hat), t) renormalized, then times a magnitude chosen likewise). Packing: A and B can ride one complex field each, or A and B real images share one (two-for-one trick above) and a second field carries a second pair.
What does not exist. The same forward/inverse pair as section 3, and a per-bin swap pix. Windowing (a Hann window before the transform) to tame the edge cross, which the periodic transform sees as a seam.
Minimal first experiment. NumPy, 5 lines: fft2 two images, swap, ifft2, view; then repeat with a Hann window, then with the swap done per 32x32 tile (the short-time version, which should flip the magnitude-or-phase verdict per the 1991 caveat, external). Confirms which donor dominates for Matt's actual material before any GPU work.
Cost class (inferred). Two forward chains (A and B, or one chain if they share a field via packing) plus one inverse: 4 to 6 passes, about 2 to 3.5 ms at 256² by the documented per-pass cost. The same chain as section 3 with a different middle stage: 3 and 4a are one infrastructure project.
Good and bad. Good: two images with clear, different structure (a portrait and a texture); animated A (the grain flows while the layout holds). Bad: similar images (no visible swap); scenes where the structure is the same across frames (nothing changes but color noise); a hard-edged solid shape as B (ringing everywhere).
Risks. Seam cross from the periodic boundary; DC and Nyquist handling; eps choice (too low: speckle noise where |B_hat| is tiny; too high: washed out); the result is signed and can leave [0, 1], so a re-center or clamp is needed before it reaches an 8-bit module.
4b. Frequency shifter
In audio. Shift every partial by a constant Hz, not a ratio: harmonics become inharmonic. It is done with an analytic signal (Hilbert transform) multiplied by a complex exponential, keeping one sideband. A ring modulator keeps both sidebands.
On images. Shift every spatial frequency by a constant vector k0: stripes of 8 px period and 4 px period move by the same additive amount in cycles per pixel, so their ratio changes. Visually: patterns that beat and drift against the original (moiré-like), not zoom (zoom is multiplicative). A phase-only offset is translation (the Fourier shift theorem), and a phase ramp over time is a drift.
What exists. The two-sideband version is a ring modulator: multiply the image by a grating (vs_op2 mult against vs_wfg_3), already listed as covered in audio_inspired_visual.md. The new thing is the single-sideband version, which needs the analytic image. Two routes:
- Spectral: forward DFT, zero or move bins (shift the spectrum by k0 with a mod-N index offset, drop the half-plane that would alias), inverse. Same chain as 3 and 4a; a "shift" stage is an index remap in the spectrum,
nearest()with an offset. Output is complex; take the real part or the magnitude. - Spatial, Gabor quadrature (
ideas/f_gabor.md): convolve with a cosine-phase and sine-phase Gabor at orientation theta and frequency f (a quadrature pair, which the f_gabor note already specs as "quadrature energy"). Shifting by k0 along the same axis is thenc*cos(2*pi*k0.x) - s*sin(2*pi*k0.x). This shifts only a band around f, not the whole image, and it costs the Gabor tap loop (about 169 taps for the 13x13 disc loop inf_gabor.md) per orientation.
Minimal first experiment. NumPy: take a picture of stripes at two frequencies, ring-mod it, and do the SSB version by half-plane masking in fft2; look at whether the single sideband reads as "drifting inharmonic stripes" and the ring mod as "two copies". Judge whether the SSB is worth the extra machinery.
Cost class (inferred). Spectral route: the same chain as 3; Gabor route: orientation count x tap loop (f_gabor.md calls the tap loop its cost).
Good and bad. Good: periodic input (stripes, grids, WFG gratings), where the shift is legible. Bad: natural photos (the result is mush; with no periodic structure there is nothing for the eye to track); 2D has no unique analytic signal (the Hilbert transform needs a half-plane or an axis choice), so there is a direction to pick, which is a design question and not a bug.
Risks. Highest of the four: the idea itself is a stretch from audio, the 2D analytic signal is ambiguous, the result is unsigned/complex and needs a display rule, and the cheap two-sideband version already exists.
Open for Matt. Q5.
Shared infrastructure
- The repo's GPU DFT (
src/f_vf_fluid/gen_dft.py, used byf_vf_fluid,f_ks,f_wave_field; formerlyf_wc_fft). Facts above. What it gives sections 3 and 4: a verified forward and inverse transform at 256² with a known cost and test path (NumPy mirrortests/math/test_fft_separable.py, per thegen_dft.pydocstring; not run). What it does not give: any size other than 256; a texture-in, spectrum-out module (today the chain is internal to each module); packing for R, G, B images; a window. A note on why it is a direct DFT: the chains were built as intra-frame pix chains that cannot keep a ping-pong across passes in one frame without extra textures (inferred; seedocs/max-reference/intraframe_multipass_architecture.md, which says a plain forward chain ofjit.gl.pixhas no inherent frame delay), and a fast butterfly FFT needs log2(N) passes with data-dependent reads; a direct DFT is two passes per direction. That trade is the repo's existing decision, not reopened here. Thejit.gl.pass/ JXP route (docs/max-reference/jit_gl_pass_architecture.md) is a possible home for a multi-pass FFT but was not used for any module; I did not look further. - A spatial band split is idea C; its draft spec is
.specify/stable/f_crossover/spec.md(committed 2026-11-24; this note was written before it and does not rely on it). Section 1 depends on its output contract (float32? packed bands? pyramid or full resolution?). Section 2 and 3 do not. - Max's own FFT.
jit.fft(CPU, any size, 2-plane float32/float64) and v8MaxFFT2D: see "Facts". Both are CPU. Useful for (a) an offline spectrum of an IR or a still, uploaded once; (b) a reference to compare the GPU chain against; (c) a non-256 size when per-frame cost is not the problem. Not for per-frame video unless readback latency and cost are acceptable, which is a measurement nobody has made. - A spectrum texture type. If a forward/inverse pair becomes modules, the spectrum between them is a new texture contract (complex, float32, centered or not, size, which fields are packed), like
f_vecfield_type.mdandf_tensor_type.mdare for fields and tensors. A "spectrum" outlet with no contract would be easy to misuse. Open question Q6. - Float32 signed signals. Sections 1, 2 and 4 all want a signed intermediate. Vsynth's mixing path is 8-bit
char(see "Facts"), and the library convention for signed values around mid-gray exists (vs_filter_hp4x,f_adaptnovelty0.5 + ...). One shared note on which pix are float32 end to end would help all of them; this is the same vocabulary issue as idea A. - Resolution decoupling. A fixed 256² solver with minify-in and magnify-out (as in
f_vf_fluid) is the existing answer; for texture cross-synthesis the minify step is where fine detail dies (box-averagetaps).
Ranking (recommendation, not a decision)
| Value | Effort | Risk | Notes | |
|---|---|---|---|---|
| 2 Mid / side | medium | low (one or two float32 pix) | low | cheap, immediately usable with motion; overlaps f_adapt |
| 1 Spatial vocoder | high | medium (needs band split, envelope, gain pix) | medium (division, 8-bit banding) | the "transfer structure without copying pixels" idea; only needs idea C, no FFT |
| 3 Convolution reverb | high for bold IRs | medium-high (reusable DFT pair, multiply pix, wrap) | medium (cost, 256² limit, wrap) | most visually distinct; shares its chain with 4a |
| 4a Phase / magnitude swap | medium-high (surprising looks) | medium (same chain as 3, different middle) | medium (seams, ringing) | cheap to add once 3 exists |
| 4b Frequency shifter | low-medium | high | high | ring-mod already covered; SSB is the speculative part |
By value to Matt's practice (cross-input structure transfer, live): 1, then 3 and 4a together, then 2, then 4b. By effort: 2, 1, 3 and 4a, 4b. Idea 2 is the one to do for free when f_adapt is built; ideas 3 and 4a should be one infrastructure project so the DFT pair is built once.
Suggested first experiment
A NumPy-only check on one real image pair, before any Max work: (i) the spatial vocoder, 3 bands, gain and normalized forms; (ii) the phase/magnitude swap with and without a Hann window and per tile. One script, two figures, under an hour of work, and it answers the two things that decide the order: does the vocoder look like structure transfer on Matt's material, and does the swap read as B-with-A's-grain on it. If (i) wins, wait for or help shape f_crossover. If (ii) wins or Matt wants the reverb look, the next experiment is the scratch patch that puts a spectrum-multiply pix between f_ks's fy and iy and tests one bright dot against a star IR. This needs Matt's go (nothing here was run).
Open questions for Matt
- Q1. Is the vocoder's "A" usually a camera/video (live structure) or a generator (patterned), and is B's texture usually a noise or a photo? It decides how many bands and which envelope widths matter.
- Q2. Should the vocoder wait for
f_crossover(idea C) or be a stand-alone module with its own three-band split? (Depends on the sibling spec's output.) - Q3. Should mid/side be a mode of
f_adapt(it already covers the time case) or a tiny stand-alone encode / decode pair that also covers stereo pairs? - Q4. Is a 256²-grid, soft-looking convolution acceptable for the reverb (the same trade as
f_ks), or does it need render-size crispness (which implies a different method, orjit.ffton the CPU)? - Q5. Is the frequency shifter worth a spike at all, given the ring-mod version is already covered?
- Q6. If a forward/inverse DFT pair is built, should it be (a) internal to each effect module as today, (b) two modules with a spectrum texture type between them, or (c) a shared codebox generator only?
Gates touched
Scanned .specify/gates.md 2026-11-24 (offline, Claude): no row's tripwire fires. A new module from any of these would touch G-menu (category). G-edge-wrap is relevant to blurs in section 1. No gate or plan edit was made.
Sources (external; consulted via web search 2026-11-24, search excerpts only, full texts not read)
- Oppenheim and Lim, "The Importance of Phase in Signals", Proc. IEEE 69(5), 1981 (swap experiment): result pages at https://dsp-group.mit.edu/wp-content/uploads/2024/11/Proc_Phase_1979.pdf (the 1979 preprint) and https://arxiv.org/pdf/1203.4756 (a thesis describing the same exchange). The small-patch caveat comes from a 1991 study in Biological Cybernetics reported in the same search; I did not open it.
- Heeger and Bergen, "Pyramid-Based Texture Analysis/Synthesis", 1995: https://inc.ucsd.edu/~marni/Igert/Heeger_1995.pdf and the IPOL write-up https://www.ipol.im/pub/art/2014/79 (works for stochastic microtextures, fails on structured ones, per the survey https://arxiv.org/pdf/1707.07184).
- Unreal Engine, convolution bloom: https://dev.epicgames.com/documentation/en-us/unreal-engine/bloom-in-unreal-engine (kernel image convolved by FFT; a convolution buffer prevents wrap-around; the doc contrasts it with the cheaper standard bloom, which can brighten the whole image).
- Textbook, not looked up: the two-for-one real-input FFT trick and the analytic-signal construction in 1D.