From the original SynthMaker forum (2004–2014), with its members’ names and dates.
lesobrod ·
Just a demonstration of some math SM' possibilities.
Module "Primes" produce all (and only) prime numbers from [Min..Max] range.
Surprisingly it takes not very much time. Algorithm "Sieve of Sundaram" is fast.
http://en.wikipedia.org/wiki/Sieve_of_Sundaram
On C2D old notebook all 119 primes from [4000..5000] range was found in 10 sec.
(I note that "Text View" module is very slow).
From values above ~ 20000 schematic may freezing up 😉
trogluddite ·
lesobrod wrote: (I note that "Text View" module is very slow)
You can speed things up a little by using your 'Done' signal to only update the 'Text View' after the results are found...
Nice work on the algorithm - could be very useful when creating reverbs etc. to find delay/comb settings. Using primes guarantees that multiple delays won't have common factors that lead to build up of resonances.
lesobrod ·
Thanx for help with redraw problem.
And algorithm was improved, so I hope, we have good illustration of SM' math&logic features.
Using primes guarantees that multiple delays won't have common factors that lead to build up of resonances.
If I understand correctly, you need just test for common divisors. It's more simple thing than creating primes array:
http://en.wikipedia.org/wiki/Binary_GCD_algorithm
MegaHurtz ·
We got a mad Russian scientist on our hands. 😀
Mo ·
lesobrod wrote: If I understand correctly, you need just test for common divisors. It's more simple thing than creating primes array:
http://en.wikipedia.org/wiki/Binary_GCD_algorithm
Great! Thanks for the code examples, but any idea on how to test for common divisors in a array of primes in SM?
trogluddite ·
lesobrod wrote: It's more simple thing than creating primes array
Your prime method has the great advantage of generating an lookup-table of 'ready to use numbers'. You could pick completely randomly from the array and know that you'll never pick numbers with common divisors. Once the array is in place (calcuated only once at startup), there is no longer any need for further testing of any numbers you pick from the array.
So although the array itself may be slower to calculate, it can save much processing each time a new number is needed - just do an array get at, and you already have a 'pre-tested' number.
You can also use SM's clever 'primitive memory' to advantage for these kind of lookup-tables.
When you save an SM schematic, or VST/exe export - most primitves retain their contents, as long as a trigger doesn't come along to reset the values. So you can do things like this...
When the array generator makes an array, it will dump the values into the sample and hold. The stripy border means that the module is 'Purgable' (use the r-click menu to change this). When you export to VST or .exe, the purgable bits don't get exported - but the sample and hold will still load up with the array intact.
So you have the flexibility to edit the array module when in the SM workspace - but n exports, just the lookup-table remains.
oddson ·
For the same reason... isn't it easier to just have a list of all primes under some threshold already calculated?
The first 10,000 primes would cover over one second even at 96KHz... for delays longer I can't see how it would matter if the values are prime or not.
Reverb and the samplerate
Wrote something here? To have a post removed or your name hidden, write to [email protected].