stage(0) bug?

For general discussion related FlowStone
Post Reply
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

stage(0) bug?

Post by KG_is_back »

I think I've found a bug. When you have two code components in series and the last one has the code executed in stage(0) it ignores values that are generated by previous code components in stage(2) - they also have to be generated in stage(0). It seems like if the stage(0) what executed in all components first and other stages get computed after stage(0) is finished in all code components. This gets very obvious when using poly.

I consider it a bug because if effectively makes stage(0) very inconsistent. Way around is to avoid using it and use conditional jump in assembly code instead.
Attachments
prehaps a stage0 bug.fsm
(1.15 KiB) Downloaded 887 times
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: stage(0) bug?

Post by MyCo »

That's the normal behavior. That's the reason why the stages exist.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: stage(0) bug?

Post by KG_is_back »

MyCo wrote:That's the normal behavior. That's the reason why the stages exist.


I mean they are executed in this order:

stage(0) in first code module
stage(0) in second code module
stage(2) in first code module
stage(2) in second code module

The problem I have encountered was, when using mono to poly module. A parameter in poly section gets calculated using a value that comes from a mono section. mono to poly obviously gets executed in stage(2) cos' it fails to send value to stage(0) in poly section.
To be more specific I have tried to make a random multisamper that picks a sample depending on a randomizer (noise generator in range 0-1) from mono section. However the sample picking algorithm gets executed in stage0 and the schematic fails to load the value from the randomizer.

I have made a custom mono to poly via trogs array to mem. To create one sample memory slot that one assembly component writes to in mono and second reads in poly, but it was not stable. It crashed FS on startup if audio device was on on startup.
stw
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am
Contact:

Re: stage(0) bug?

Post by stw »

stage(0) is always executed only once.
In case of a mono stream if it's activated (e.g. taken into the signal chain by a selector)
In case of a poly stream whenever a new voice is initiated.
stage(2) is always executed after stage(0).
If you want to use any data in stage(0) in the poly section you have to create it in stage(0) in a poly section because the mono section already executed stage(0) and won't do it again until you switch it with a selector.

But why don't you just do everything in stage(2)?
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: stage(0) bug?

Post by KG_is_back »

stw wrote:But why don't you just do everything in stage(2)?


because the operation has to be calculated only once at the start. I was just surprised that the component staging is executed all at once per stage and not stage by stage per component. Looks like I'll be better to execute inter-component calculations in stage2 and jump them after first sample instead of stage0.
stw
Posts: 111
Joined: Tue Jul 13, 2010 11:09 am
Contact:

Re: stage(0) bug?

Post by stw »

KG_is_back wrote:
stw wrote:But why don't you just do everything in stage(2)?


because the operation has to be calculated only once at the start.


Then do your stage(0) calcs/assignments in a poly stage(0) and not in a mono stage(0) if you want to use it in a poly section. This should avoid the hassles you encounter in the description.

no stage0 bug.fsm
(1.21 KiB) Downloaded 956 times
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: stage(0) bug?

Post by KG_is_back »

stw wrote:
KG_is_back wrote:
stw wrote:But why don't you just do everything in stage(2)?


because the operation has to be calculated only once at the start.


Then do your stage(0) calcs/assignments in a poly stage(0) and not in a mono stage(0) if you want to use it in a poly section. This should avoid the hassles you encounter in the description.

no stage0 bug.fsm


Cool :-D I've totally forgot about that one :-D But I've got better:

Code: Select all

streamout out;
float x[1]=rand(0,1);
stage(0){
out=x[0];


The base of my problem is - it's too random :mrgreen: ...I'd rather use oscillator to create the random noise pattern, so on plugin reset the pattern resets too. Giving me the same audio when I render the track more times.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: stage(0) bug?

Post by tester »

Yyyym, so you need random random or quasi random? :mrgreen:
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
KG_is_back
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: stage(0) bug?

Post by KG_is_back »

Actually it doesn't have to be random at all :D ...I've already sorted it out. mono stream to "mono to float" primitive triggered by "midi mono" primitive. Plus some afterload and empty selector cos it was bugging a little
Post Reply