From the original SynthMaker forum (2004–2014), with its members’ names and dates.
whyterabbyt ·
Okay, having got to grips with the Code Module enough to get a (seemingly) working module (http://www.synthmaker.com/forum/viewtopic.php?t=969) Ive now seen Shifrin's code opsted for part of Dan's compressor, and realised there's some bits about the Code Module I hadnt been aware of.
I see stage(0) and stage(1) sections marked out; I assume stage(0) is an initialisation stage, and stage(1) is runtime, yeah? Are there any other stages?
It also looks like you can handle arrays. Are there any other datatypes which havent been listed in the main docs?
I also see a loop(n) control, which I hadnt been aware of. is the index fixed, or can it be a variable? Are there any more instructions.
One last thing; the comparison available dont seem to include equals and not equals... will these be made possible?
jorge ·
whyterabbyt wrote: I see stage(0) and stage(1) sections marked out; I assume stage(0) is an initialisation stage, and stage(1) is runtime, yeah? Are there any other stages?
Yeah, stage(0) runs only once in the beginning to initialise and stage(1) runs at sampling rate, once per sample.
There's stage(2) and stage(3), so far they have only been used to implement 1 sample delays or what in DSP terms is called Z^-1. If the 1 sample delay was done all in stage(1) you'd get different behaviour depending on the order you'd insert the components. If you'd insert them left to right, you'd get a cascading effect where your input sample would flow through all of them in one go. The correct way is to do all the calculations in stage(1), use stage(2) to move all the internal states to the outputs and use stage(3) to move all the new input values to the internal states ( or the other way, cant remember now). Stage(1) runs for the whole synth before stage(2) rund for the whole synth and then stage(3) also for the whole synth.
In most situations you dont have to worry about stage(2) and stage(3).
whyterabbyt wrote: It also looks like you can handle arrays. Are there any other datatypes which havent been listed in the main docs?
I cant think of any other ones.
whyterabbyt wrote: I also see a loop(n) control, which I hadnt been aware of. is the index fixed, or can it be a variable?
n is fixed, but you can easily implement your own incrementing index variable. Just make it zero before the loop and add 1 to it at the end of the loop.
whyterabbyt wrote: Are there any more instructions.
Maybe, I think log10 was implemented recently. I think we just need to update the docs at some stage soon.
whyterabbyt wrote: One last thing; the comparison available dont seem to include equals and not equals... will these be made possible?
You're right. I think it was implemented at some stage, I vaguely remember using it but I've just tried again and it doesnt seem to work, I'll try to fix it soon.
Shifrin ·
I believe there is a hop(N) function too - which only executes the code it contains every N samples IIRC :-
hop(4)
{
a = b + c;
}
So every 4 samples a gets set to b + c!
Shif.
jorge ·
whyterabbyt wrote: One last thing; the comparison available dont seem to include equals and not equals... will these be made possible?
Maybe for now you can use:
float a=0;
float b=0;
float result=0;
float true=1;
result=(a>=b)&(a<=b)&true; // same as result=(a==b)&true;
I just noticed that we also need "or" to be able to do the following:
result=(a<b)|(a>b)&true; // same as result=(a!=b)&true;
Shifrin ·
Yeah that's what I did to check equality!
Shif.
note:-
You can do it in the assembler component afaik using the cmpps command with a type '0' for 'equal to' and a type '4' for 'not equal to'.
whyterabbyt ·
jorge quoth
Yeah, stage(0) runs only once in the beginning to initialise and stage(1) runs at sampling rate, once per sample.
There's stage(2) and stage(3)....
In most situations you dont have to worry about stage(2) and stage(3).
Right, ta. BTW when you say 'at the beginning' for stage(0), is that once-only 'ever', or when any input values change.
n is fixed, but you can easily implement your own incrementing index variable. Just make it zero before the loop and add 1 to it at the end of the loop.
But you cant do
loop(myIterations){
}
right?
Are there any more instructions.
Maybe, I think log10 was implemented recently. I think we just need to update the docs at some stage soon.
That'd help me a lot
You're right. I think it was implemented at some stage, I vaguely remember using it but I've just tried again and it doesnt seem to work, I'll try to fix it soon.
Ta. I know they can be done with chained comparisons, but I wondered if that was more inefficient...
jorge ·
whyterabbyt wrote: when you say 'at the beginning' for stage(0), is that once-only 'ever', or when any input values change.
It runs only once when a new process starts. In a mono section that means when you change the schematic or when you switch directSound on for example.
On a poly section that means every 4th note you play.
whyterabbyt ·
Many thanks...
Nu Audio Science ·
I'm losing it totally with this SSE stuff
I thought a new process would be started with every fifth note not every fourth note played.
I think i will diss this SSE optomising stuff until i can understand it better
EDIT * Meant to ask Jorge why is it the fourth note played and not the fifth that starts a new process, Is it pre emptive or something ?
jorge ·
Nu Audio Science wrote: I thought a new process would be started with every fifth note not every fourth note played.
Each SSE instruction processes 4 values in one go, not 5.
The process starts on the 1st note you play, the 5th note, the 9th note etc.
If it was every fifth note it would be the 1st, the 6th, the 11th etc
I did simplify my description a bit, I can go more in detail if someone needs it, just thought it would confuse things. For example if you play 4 note, stop one and play your fifth note, it will take the place of the free channel rather than starting a new process. So there's some voice management going on but roughly you can think of it as a process starting with every 4th note.
Nu Audio Science ·
I think its the way i talk then because i would say that as every fifth note starts a new process, As in if four are playing no new process but the fifth starts a new process.
Guess i should have paid more attention at school
whyterabbyt ·
NAS; think of it as being each 4th note subsequent to the 1st note... Not on each 4th note....
1+4 = 5
5+4 = 9
whyterabbyt ·
BTW I forgot to ask; is there any way to use comments in ones code?
skOre ·
use the double /:
//comment
whyterabbyt ·
Hmm, I thought I'd tried that. Oh well, ta.
Wrote something here? To have a post removed or your name hidden, write to [email protected].