From the original SynthMaker forum (2004–2014), with its members’ names and dates.
rl ·
Hi Guys. You asked for early adopter feedback, Ok I'm starting with the code component:
Basically: It's great!!!!, some minor suggestions:
For longer code-parts scrollbars would be helpful
When doing mistakes, the place where the error occurs can be guessed by the fact that sm gives up on syntax colouring. I would prefer a visble marker for the error location.
For longer codes, editing seems to become slow.
The sin1 function is a good start, but I want more 😉 : tanh, pow, exp, log,...
Subroutines (maybe with inline expansion) would be great.
How about control structures (if, for,...)
What is the difference between monoin/out and polyin/out vars?
bye, rl
jorge ·
rl wrote: The sin1 function is a good start, but I want more 😉 : tanh, pow, exp, log,...
If one of those is urgent and you're getting stuck because of not having it, please let us know. You can actually create your own using taylor expansion series inside a code component, that's probably how it would work if you had those functions anyway, but ofcourse it's much better to have the functions ready.
rl wrote: Subroutines (maybe with inline expansion) would be great.
I think that will happen at some stage. Probably not for v1.0.
rl wrote: How about control structures (if, for,...)
The code component processes 4 voices at the same time. Loops should be possible as they affect the 4 voices but conditional jumps are not possible if you want to keep using SSE instructions for processing 4 voices at the same time. There are ways to avoid conditional jumps by using compare functions to create masks and using the masks with boolean operations.
For example the following control structure:
if ( cnt >= 1.0 ) cnt = cnt - 1.0;
can be done as follows:
cnt=cnt - ( ( cnt >= 1.0 ) & 1.0 );
rl wrote: What is the difference between monoin/out and polyin/out vars?
Poly data is passed around as SSE data with 4 floats together with each float being used for a separate voice/note. Mono data is also passed around as SSE data with 4 floats but only the first float is used. You can use Poly components as if they were Mono, it will work, but you might be wasting processing of the 3 unused floats. If you use Mono components as if they were Poly, every 4th note you play will work but not the other 3. The idea is to use Poly data all the way up to the PolyToMono component and Mono data after that, that way the effects section of your synth is calculated only once independently of the number of notes played.
malc ·
Hi rl,
rl wrote: For longer code-parts scrollbars would be helpful
When doing mistakes, the place where the error occurs can be guessed by the fact that sm gives up on syntax colouring. I would prefer a visble marker for the error location.
Some good suggestions there. Shouldn't be too difficult. I will add that to the list 🙂
rl wrote: ]For longer codes, editing seems to become slow.
Yes, I see what you mean. I'll need to look at this.
Thanks for the info, always very helpful to us.
rl ·
jorge wrote: For example the following control structure:
if ( cnt >= 1.0 ) cnt = cnt - 1.0;
can be done as follows:
cnt=cnt - ( ( cnt >= 1.0 ) & 1.0 );
yes, I remember these tricks from the old days of C programming.....
jorge wrote: Poly data is passed around as SSE data with 4 floats together with each float being used for a separate voice/note. Mono data is also passed around as SSE data with 4 floats but only the first float is used. You can use Poly components as if they were Mono, it will work, but you might be wasting processing of the 3 unused floats. If you use Mono components as if they were Poly, every 4th note you play will work but not the other 3. The idea is to use Poly data all the way up to the PolyToMono component and Mono data after that, that way the effects section of your synth is calculated only once independently of the number of notes played.
thanks for the explaination, so for the code within the code component there should be no difference ?!
rl
jorge ·
Hi rl
rl wrote: so for the code within the code component there should be no difference ?!
Yeah, correct, I guess that's the simple answer you wanted.
At the moment anything you do inside the Code component will process the four sound channels at the same time. It means it will work for both poly and mono although there might be ways later on to make the mono code more efficient in certain cases.
If you have any other questions please let us know.
rl ·
jorge wrote: If you have any other questions please let us know.
Well, yes....
It looks like the only implemented comparison operator ist '>=', there ist no '<', '<='. '>', at least syntax highlighting stops here. Also the unary '-' operator is not completely supported. I had to write '-1 * x' instead of '-x'.
Againt the missing if-then-else structure gives me some headaches. Example: I'm working on a filter algo that uses the tanh function to model non-linear behavior.
tanh (x) = 1 - 2 / (exp (2*x) + 1)
replacing exp(2x) with the first three terms of a taylor series:
since this approximation is only good for x => 0, I would use the fact that tanh is an odd function, thus tanh(-x) = -tanh(x) for x < 0, so in plain old C i would write:
I trying to misuse the boolean result of the comparison as numical value (0 or 1) for the multiplication. (Can I expect the comparison result having the value '1'?)
As you can see the code in the example looks a bit cluttered. I understand that you have good reasons not to support control structures.
Things that would help me are subroutines, eg:
float function tanh (float x) {......
They could be placed inside the code component and maybe evaluated by means of macro expansion techniques, or even better you could provide code library components that can be placed somewhere on the schematics.
stefan ·
The comparison ( >= ) results in a bool mask, not 1.0. You should use the & operator, probably like this: