From the original SynthMaker forum (2004–2014), with its members’ names and dates.
matti ·
There seems to be no Min or Max for arrays. There's only Min and Max for Mem's. Which is basicly the same thing, but a bit too complicated for most to use. So i would just want to get an array that is a Max of components of two arrays.. without it taking huge amounts of cpu like it will if you build it with a loop.
I managed to do this with less resources than with looping, by resampling both arrays to make them 2x longer, multiplying the arrays with an array that contain 1's and 0's so that every 2nd sample is nulled(because it's garbage from resampling), then shifting the other array 1 step forward, then adding them together(the two arrays data will be interleaved), converting to a Mem, then taking a Max out of that Mem with step set to 2. This way(believe it or not) i get a Max for arrays with less resources than with a loop that has two arrays going thru a float Max primitive.
Not very nice way to do it 😕 A proper primitive would be better.
TomC ·
Float Array Max
It's there.
Tom
exonerate ·
TomC wrote: Float Array Max
It's there.
Tom
There's a Float array min/max in the Dev Toolkit, also.
exonerate ·
Oh, I've just realized your actually after something different, you want an array output containing the maximum values of two arrays, so just like the mem version but float array. 🙂
+1 to that, 😀 might come in handy.
Cheers 😉
Exo
matti ·
Yes 🙂
The curious thing is how much slower it is when done with a Loop. Maybe there could be something to improve on the inner workings of loops? Im sure they are not that important to everyone and not even designed to be super fast, but for me they help alot in prototyping, offline processing and graphics stuff. The thing i'm currently doing and where i need the Max array primitive is a dB-scale FFT screen for my EQ. With the cumbersome method i described in the first post i save around 85% in processing time. The Loop method eats up 22% of cpu time which is a HUGE amount for such a simple thing, when the Mem-method takes only about 3-4%. (the calculations are done 50 times per second)
All in all i really like the way i managed to shrink the cpu usage down to pretty much nothing, but there should be an easier way for doing it.
exonerate ·
matti wrote: Yes 🙂
The curious thing is how much slower it is when done with a Loop. Maybe there could be something to improve on the inner workings of loops? Im sure they are not that important to everyone and not even designed to be super fast, but for me they help alot in prototyping, offline processing and graphics stuff. The thing i'm currently doing and where i need the Max array primitive is a dB-scale FFT screen for my EQ. With the cumbersome method i described in the first post i save around 85% in processing time. The Loop method eats up 22% of cpu time which is a HUGE amount for such a simple thing, when the Mem-method takes only about 3-4%. (the calculations are done 50 times per second)
All in all i really like the way i managed to shrink the cpu usage down to pretty much nothing, but there should be an easier way for doing it.
Loops for me are alway pretty fast, When i'm doing something to an array, I always have a sample and hold after it which I trigger with the finished trigger on the loop, if your doing a lot of processing it might help to split it up have one loop for one section then another loop for another section with a sample and hold after each, instead of using one loop to do all the processing. So it's like processing in blocks which should be much faster, with your cumbersome method this is basically what is happening, each primitive processes the array seperately and passes on the result when done. The same approach with the loop, should prove just as fast.
Cheers 😉
Exo
matti ·
Well yes they are "fast", but time is relative. If you are doing something with high frequencys it starts to add up. My point was that it's strange how much faster i got the process by using very heavy calculations that would normally seem like a very bad idea.
Just think about it for a second.. The float Max primitive inside a loop is slower than 2x resampling of an array, 2x multiplying 2 arrays together, shifting one array, adding the arrays together, then basicly taking a Max of the two arrays. There has to be something wrong with this equation.. (and i do use sample & holds.. the speed difference without them is gigantic). The amount of work done should most definetly take more cpu time than the loop with just one floatMax primitive.
if your doing a lot of processing it might help to split it up have one loop for one section then another loop for another section with a sample and hold after each, instead of using one loop to do all the processing
With multiple loops its actually even slower..
exonerate ·
matti wrote: Well yes they are "fast", but time is relative. If you are doing something with high frequencys it starts to add up. My point was that it's strange how much faster i got the process by using very heavy calculations that would normally seem like a very bad idea.
Just think about it for a second.. The float Max primitive inside a loop is slower than 2x resampling of an array, 2x multiplying 2 arrays together, shifting one array, adding the arrays together, then basicly taking a Max of the two arrays. There has to be something wrong with this equation.. (and i do use sample & holds.. the speed difference without them is gigantic). The amount of work done should most definetly take more cpu time than the loop with just one floatMax primitive.
if your doing a lot of processing it might help to split it up have one loop for one section then another loop for another section with a sample and hold after each, instead of using one loop to do all the processing
With multiple loops its actually even slower..
Yes that is quite strange, I think the loop is bound to have some overhead, but that is extreme to say the least.
Maybe there's a serious inefficiency in the loop code? or maybe triggers and the way they work is just inefficient.
Either way Malc please take a look and see if that can be improved. 😇
I use the loop quite often, but I'll be honest I've never used it for really intense calculations.
Cheers 😉
Exo
TomC ·
exonerate wrote: Oh, I've just realized your actually after something different, you want an array output containing the maximum values of two arrays, so just like the mem version but float array. 🙂
+1 to that, 😀 might come in handy.
Cheers 😉
Exo
Okay, while we're at it anyway I'd like to see Array-Average as well 🙂
Tom
matti ·
Another thing i guess would be usefull is an "Array trigger blocker". There's currently no way to change the contents of an array without it triggering all the calculations that are after it. (and don't tell me there's a float array sample and hold already..)
matti ·
matti wrote: There seems to be no Min or Max for arrays. There's only Min and Max for Mem's. Which is basicly the same thing, but a bit too complicated for most to use. So i would just want to get an array that is a Max of components of two arrays.. without it taking huge amounts of cpu like it will if you build it with a loop.
....
Any chance the Devs have seen this request? Or any chance this becoming a part of the next release perhaps?
Wrote something here? To have a post removed or your name hidden, write to [email protected].