-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: maxFFTsize seems not to be checked when resizing out of bound upwards #255
Comments
ok good bad news - @AlexHarker asked me to check if it was the same in max. I can confirm it is:
|
It's possible/likely that these crashes have different causes. For max what you are seeing here is another example of the effects of flucoma/flucoma-max#386. If I compile against my work-in-progress on thread safe parameters the crash/assert disappear. Unless I am very much mistaken SC is single-threaded. |
maybe but they do yield at the exact same assert with the exact same code, so I'm curious. |
That would have been easier to be sure of if you'd actually given the line for the assert. I am not set up yet to test in SC, but I am fairly sure that the source of the crash is different, because there should be no threading concerns in SC, and if max is made thread safe the assert does not happen. |
1 similar comment
That would have been easier to be sure of if you'd actually given the line for the assert. I am not set up yet to test in SC, but I am fairly sure that the source of the crash is different, because there should be no threading concerns in SC, and if max is made thread safe the assert does not happen. |
line 51 of core/algo/stft.h stft - resize in Max. In SC, same: Thread 10 Crashed:: com.apple.audio.IOThread.client |
setParameterValuesRT() places no restriction such that the mMaxFFTSize field of an FFTParams can't be replaced. So what is happening right now is that the max fit is constantly being reset to -1 and then the code generates what looks like a sensible size based on the window size that fails further down. There are multiple places where we could consider this an error but the side-effects of changing each one are opaque to me (some would be in core and some would be in wrappers). For instance, we could consider that:
and
are incorrect, because these state that the max FFT size is mutable once the object has been constructed. However, that might be necessary. I wonder if making it mutable only if not -1 would work, but checking this in practice is complex. I think the other stuff this relates to is covered by LongRuntimeMaxParam, which looks to me like how all other initialisation max, vs non-initialisation params are dealt with. I am unsure if there is a way of specifying what must be set at initialisation time, or not (other than this type and also the max fit size parameter which one assumes this applies to). [Are there any others?] As far as I can see LongRuntimeMaxParam requires the wrappers to ensure correct containing (I'm not sure I like this pattern, but it seems to be the design that has been made). Sorry for the dump of thoughts, but this is a complex problem and this is not my code. I am doubtful of my ability to be confident in any fix without substantial time input on investigating further. It may be that @weefuzzy can guide us more quickly, but otherwise the quick options are somewhat shot in the dark with the assumption that it will not have bad side-effects (and possibly lots of testing by someone else) or we leave as is knowing the bug exists... |
OK - I can confirm that fixing in FFTParams operator=() is not viable without significant rework because these are used elsewhere. Max fixes this by using x->mInitialized and reading the max FFT size out if already initialised. A similar fix for SC would be possible, but I cannot say it would be the design choice that I would make, as to my mind the client layer should be handling such issues. However, because of the ways constraints are currently designed it is hard to see how that could be done. |
thanks for the investigation. I'm relieved it is not a HISStools stft problem. We'll see how we fix it or gaffer tape it in the 3 wrappers for now I reckon |
The HISTools FFT is just an FFT. The STFT part is provided by flucoma. |
Please tell us what you were doing! You can include code and files by drag and dropping them into the text area.
I am messing about with FFT, at times randomly asking for a window larger than the default maxFFTsize
{ var source = SinOsc.ar(222,mul: 0.1); [source, FluidSTFTPass.ar(source,LFNoise0.kr(1).range(10,10000))] }.play
when the window goes above 8192 I get an assert crash.
What was the expected result?
to give a warning and cap
What was the actual result?
a crash
What operating system were you using?
Mac
Operating system version
Monterey
FluCoMa Version
latest
The text was updated successfully, but these errors were encountered: