Skip to content

Add raw FFT magnitude APIs fftr and fftrs - #3000

Merged
nesbox merged 2 commits into
nesbox:mainfrom
aliceisjustplaying:upstream-fftr
Sep 18, 2026
Merged

nesbox merged 2 commits into
nesbox:mainfrom
aliceisjustplaying:upstream-fftr

Conversation

@aliceisjustplaying

@aliceisjustplaying aliceisjustplaying commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

fft() and ffts() apply automatic gain, which makes them unsuitable when a cart needs the captured signal's raw magnitude. This adds fftr(start_freq, end_freq=-1) and fftrs(start_freq, end_freq=-1) for raw and smoothed raw magnitudes. Both preserve the existing FFT bin and inclusive range-sum behavior. The raw values are recorded before amplification; smoothing uses the existing 0.6 history weight. See the FFT implementation.

This ports the raw FFT feature from alice-feature-cqt onto current upstream main. It includes Lua, JavaScript, Python, Ruby, Janet, Scheme, Squirrel and Wren bindings, built-in API help and resetting the raw buffers when a cart starts. VQT is in the separate PR #3001.

Validation on macOS ARM64:

  • Built the SDL application and all eight affected language runtimes. Runtime checks verified single-bin and range calls in each language.
  • Ran the offline FFT regression test with AddressSanitizer and UndefinedBehaviorSanitizer: amplitude scaling, smoothing, range behavior and disabled access passed.
  • Compiled and ran the same test with TIC80_FFT_UNSUPPORTED.
  • Built and tested the combined FFT/VQT changes after resolving their shared registration edits locally.

Physical capture devices and other operating systems have not been tested locally.

@aliceisjustplaying
aliceisjustplaying marked this pull request as draft September 17, 2026 19:17
@aliceisjustplaying
aliceisjustplaying marked this pull request as ready for review September 17, 2026 20:02
nesbox added a commit to Ferk/TIC-80 that referenced this pull request Sep 17, 2026
GitHub hands a pull request from a fork no repository secrets at all, and
the android job asserts on the two signing passwords, so every such PR goes
red for a reason that has nothing to do with the change: the run of nesbox#3000
on 17.09 died on "RELEASE_STORE_PASSWORD secret is not set" while the other
eight jobs passed.

The job now builds the release variant with -PUNSIGNED=1 when the pull
request comes from a fork. That flag leaves the signingConfig off the
release build type and gradle writes app-release-unsigned.apk, so the check
that the android build compiles still runs, and a file carrying no
signature at all cannot be mistaken for a shipable APK the way a
debug-signed one could. Every other event — a push, the tag call from
release.yml, release-pro.yml — signs exactly as before and still fails by
name when a password is missing, which is what keeps the 16.09 bug from
coming back.

The release-pro.yml comment pointed at that check by line number; it now
names the helper instead, because the number moved.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@glastonbridge

Copy link
Copy Markdown

I am a Field-FX organiser and the people on our Monday night livecoding jams have been using a version of this (the branch mentioned above) for over a year now. It is well tested, and very useful for writing reactive effects.

@nesbox

nesbox commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Read it through: the raw values are recorded before the amplification multiply, the smoothed variant keeps the existing 0.6 weight, and the public fft/ffts are untouched, so the new pair is the only new behaviour. One thing worth naming: tests/fft.c is the first test in this tree, and it is not wired into CI yet — that is a follow-up, not a blocker.

@nesbox nesbox left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read it: the raw values are recorded before the amplification multiply, the smoothed variant keeps the 0.6 weight, and the public fft/ffts are untouched. tests/fft.c is the first test in this tree; wiring it into CI is a follow-up.

@nesbox
nesbox merged commit 023415a into nesbox:main Sep 18, 2026
11 checks passed
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.

3 participants