Approach to Fourier Analysis and Displaying Two‑Sided/One‑Sided Spectra (Magnitude and Phase) in SuperCollider

Hello everyone,

I would like to ask whether SuperCollider (built‑in class, plugin, Quark, etc.) provides a class that can perform a Fourier transform on a sound file, a UGen output, or a buffer, and then display both the two‑sided and the one‑sided spectra, including magnitude and phase.

If no such class exists, I would be very grateful for any advice on the recommended way to achieve this within SuperCollider.

Many thanks in advance for your guidance.

Maybe Signal fft has what you need?
https://docs.supercollider.online/Classes/Signal.html#-fft
Best,
Paul

1 Like

TXMod is right: Signal:fft performs an arbitrarily large FFT on client-side data. (It doesn’t partition into overlapping frames or apply window functions, but those are just normal array operations.)

This would be a great quark but I wouldn’t suggest adding it to core. Why? Because core SC should provide the tools to build higher level interfaces but it shouldn’t make too many assumptions about people’s usage patterns. One person wants a two-sided spectrum with phase; another wants a color spectrogram; all “nice to have” but the maintenance burden on developers isn’t zero.

I’m not aware of an existing quark that handles the specific need that you’re asking about, but someone (maybe you) could develop it.

hjh

1 Like

Hello @prko

The SignalBox quark includes an implementation of the single sided Real-FFT and associated helper methods. (See also here.)

Maybe this is what you’re after?

1 Like

Thank you for your kind answers!

If I understand correctly, SuperCollider provides ways to compute both two‑sided and one‑sided spectra (e.g. with Signal:fft or SignalBox).

Phase information can be derived from the FFT results, but there doesn’t seem to be a built‑in or ready‑made class that directly displays magnitude and phase together.

It is currently the responsibility of the user…