FFT full_spectrum strangeness

Summary:

I’m seeing some weird behaviour with fl.fft~ / fl.ifft~ in full_spectrum mode when the overall graph is changed. Sometimes it seems like the graph doesn’t update, or the output from ifft is actually from another part of the graph. Hopefully the animation below shows up, and shows better what I mean than I can describe. All three lanes in that patch should, AFAICS, be passthrough. However, I never see any output on the middle one, and when (in the animation) I change its connection, the output on the right-most goes away too.

FrameLib Version:

Commit ae2a4c37

Environment Details (Max/SC/Whatever):

Catalina, Max 8

Steps to reproduce (Provide patch/code if possible):


----------begin_max5_patcher----------
1005.3oc0Y1tbapCDF921WEL72iqi9Bgn2Jc5jQ1VNkTPhCHZbOcpu1qjvzV
2p3nLHaxIyDmAgLu5Y2Uq1k7skKR2nNH5RSdexGRVr3aKWrvMjcfEmtdQZM+
v1JdmaZo08U5xtpxch1zUC2ubm6NpMO9NDYbvFdKuVnEs2Kj7MUB6T.mtWW4
+4tl.JnmFR1WWJqDZmHveMnpWONJ5mOY81OUJe39VwV8vRmPQqAqRxxo1+.Y
303ByOrbFAPyPj7UIEj0YDFLufQILFlfvIe7zCbPC8WaDCOszzUleS9n8tee
4R6GqBz5HEOYLCi1.s3faAltuZsVYl3QelLbZ31.3ErAXfEdLl4LEtOQFyxE
vLxHteu9Xxc0pchj88UU220XVbs809fFkFGGO.tNyvIdvwSnAP8Uv4V9ZPG5
Eczq1eCcw7nb1.5E2dG9qBaPbvFQgCg43YC6FUkVsk25a2LD+Jv7BA1P.xju
BCJ.PJgRgDfIGFpvAMkMOQ4Fj0JC7d4ldM4lRlStun+FEGtQYCotdC6ggwkz
agO8xEq.AyRwJn7r2FEq7BVm7Yw5vN23P9eTkb4woPtwS3n34pPtmkPZbHza
RdLMet30UGiGbIwojEH.3AWjKBGm+ltNcbbJSGgQCkoil0xzeF2bj5EweoKC
clfylGhepTtS8zwjMU7setlKStaqptQH63ZQRUoTv8l5mEq.eOVDHErFUPKH
DXVFHCvXVCC41uMPI2J7VnS1ULK2P+JYvaOt+ywDF..7AL4Z5tAtM.CuflaK
wsB9tiIGRtqWVp6R530MUhNOFfhqI+lFUsA6LBxTACK2MzLbFmoDtFSV+Jg7
A8mbkqc5HfVw+1K5zhcdLLWy7.Cu2BDL6FaK1zueun0FW7nR9P0W8sgHRGHP
Mr4OAPA3kodekhqsGJrgKe3bSf6KkZye+Gu6V2pvN941kNUe61wm6XF9jeo8
NS.PojqKUxeaR3ylip01mf0N30WDUksudPeRCljzEAn73xaRBEBh1jtSVn7P
DBDAgngHTdDDhDfPzHnCNDffQRHXHBAmnPnPPBEint+X24ynDLVJACQoIa8f
gvDNFLABPoXrUJDuDjFIgfgHzTcRgc1wYyotbWipTpOcNIz9OM4u5QCvVSME
nki.44YnLBYUnS7uOhBMMBCJQaLBCGcHurRS1qkE.Sw3XWXHGdTDCgBIUKIV
BACPnI6iBJkdLpj.FTJcPLXJjT5ifOckfgnDzSY77lluHZ6NMamHlFYdT4Rm
vV4trTNboqGjzVwWJGmelaDdqo4Csoyi9V2BK8.cno9TaOdsx9xSUtavyHoq
IIIuVz0vGHw0K0xuu7GfMW8bL
-----------end_max5_patcher-----------

Actual Result:

Unpredictable. I suspect (because developers love it when bug reports have speculation about causes) that in full_spectrum the inverse fft is reading from the wrong area of memory, but it’s not as if I’ve actually tried to verify that.

Expected Result:

Predictably the same as in non-full-spectrum mode.

Logs/Other

Thanks - should you be adventurous would you mind swapping out the line at line 132 in FrameLib_iFFT.cpp for:

auto temp = allocAutoArray<double>(mMode != kComplex ? sizeOut : 0);

and letting me know if that fixes it? I’m pretty sure that’s the issue but I don’t have time to check right now. As far as I can see that line should assign temp memory when needed and it is needed for the full spectrum version, but right now the test is wrong so it’ll assign a pointer with no memory - seemingly that should return a nullptr so I have no idea why this isn’t crashing, but the first thing is to see whether this line fixes it and then sort out the why isn’t it failing correctly later…

1 Like

No worries. I’ll report back…

Yup, that seems to fix it, ta.

OK - I’ve pushed the fix. It looks like I check for nullptrs hence no crash. Most likely you were getting whatever was in the output memory, which could easily be something from elsewhere in the network.

Good find - thanks!

1 Like