added scriptable FFT
-
If you have any ideas how to extend this class let me know. At the moment it's just possible to analyse the data (so there is no inverse FFT) also it's not optimised for real time usage (but rather to analyse samples).
-
@christoph-hart holy cow! I was looking for a decimation yesterday! That should do it, right?
-
@christoph-hart said in added scriptable FFT:
If you have any ideas how to extend this class let me know.
also it's not optimised for real time usage
I think this is probably the biggest one, albeit easier said than done
The main purpose I (and I believe others) needed it for was realtime frequency detection for things like Dynamic EQ. Unless there's something in the new scriptnode that can accomplish it... I'm a bit out of touch on the latest branches tbh
I think FFTs can also be used for time-stretching stuff right? Probably above my paygrade
-
@iamlamprey said in added scriptable FFT:
I think FFTs can also be used for time-stretching stuff right?
The FFT is maybe the most important algorithm in DSP but let's keep it realistic guys. This implementation works within the scripting layer and any attempt for realtime usage will at some point run against performance issues: As soon as you need to operate on the actual sample data, it will burn the CPU as @dustbro has shown with its infamous CPU Screamer example.
At some point in the future I will add the FFT to the SNEX API, with an emphasis on realtime usage, but until then just relax and enjoy the possibility of sorting a sample set based on its harmonic spectrum :)
-
@christoph-hart Of course! :) keep up the great work
-
Could this be used to compare dynamic layers and create an aet type thing?
-
@christoph-hart said in added scriptable FFT:
it will burn the CPU
Wait till you see my analog tape dsp :grinning_squinting_face:
-
@d-healey Yes that's more in the ballpark. However it would require an inverse FFT so that you can do (in pseudo code):
for(chunk in signal) { forwardTransform(chunk); doSomeStuffInFrequencyDomain(); inverseTransform(chunk); }
However I gotta admit I have never used the inverse transform (all FFT application I did until now only needed to analyse the frequency domain) so maybe I need a bit input of someone who is a bit more proficient in this area. A quick googling revealed this website which contains some basic information, but let me know if you know better resources:
https://www.dsprelated.com/freebooks/sasp/Overlap_Add_Decomposition.html
-
@christoph-hart as for a non-real time decimation of a buffer, it should work right? Just in order to get something better than than one sample every X samples…
This is not related to displaying the buffer, which works great btw thanks to you :) -
@ustk said in added scriptable FFT:
Just in order to get something better than than one sample every X samples…
Ah, you're still in the waveform drawing stuff? Not sure if the FFT is seriously overkill for this task. Have you tried other interpolation algorithms? The next best thing is linear interpolation which should be good enough (it's good enough for the sample playback lol).
-
@christoph-hart no no as I said this is not for drawing, this one is for computational stuff.
Actually I am taking a sample every X samples to decimate before a correlation function, and it works. But I'd like a more precise decimation model…What I found online always uses an fft, but the formulas are too complex for me to translate into code. Although I'm sure it's a trivial operation, I'm just not used to fft…
I imagine this requires an inverse fft too though
-
This post is deleted! -
What about a resynthesis module? :D
-
@d-healey with the results I got from DDSP I'm surprised more developers aren't looking into resynthesis more... we'd never have to sample a round robin again
-
@iamlamprey It would be nice if we never had to sample anything again.
-
@iamlamprey
What's DDSP?Nevermind it's more googleable than I thought. -
@christoph-hart Yep :) The style-transfer is particularly appealing, I wouldn't be surprised if you can legally train it with other people's sample libraries since it's 100% synthesis.
Not a lawyer but ;)
-
@Christoph-Hart I thought I'd have a go at this fft thing. Following your instructions above and the docs I load a sample from the sampler into a buffer. If I uncomment the
process
line in this script HISE will just crash.const var Sampler1 = Synth.getSampler("Sampler1"); reg sound = Sampler1.createSelection(".*")[0]; const buf = sound.loadIntoBufferArray(); const fft = Engine.createFFT(); fft.setEnableSpectrum2D(true); fft.setWindowType(fft.BlackmanHarris); fft.setMagnitudeFunction(function(data, offset) { var max = 0.0; for(s in data) { max = Math.max(max, s); } Console.print("The max value at " + offset + " is " + Engine.getDecibelsForGainFactor(max)); }, true); fft.prepare(1024, 2); //fft.process(buf);
-
@d-healey Bump