Page 1 of 2
Conditional selection
Posted:
Mon May 25, 2020 9:44 am
by juha_tp
If one wants to stay with DSP code component, how to code conditional selection?
pseudo code:
- Code: Select all
switch value
case (1, 3, 5, 7)
...
otherwise // 2, 4, 6, 8
...
end
Any examples out there?
Re: Conditional selection
Posted:
Mon May 25, 2020 12:31 pm
by adamszabo
I believe its only possible with assembler
Re: Conditional selection
Posted:
Mon May 25, 2020 3:57 pm
by Spogg
Re: Conditional selection
Posted:
Tue May 26, 2020 7:23 am
by juha_tp
I did look that thread earlier but, could not find examples of usage since I need to make at least four operations (calculate coefficients using degree 3 polynomial equations) when the condition is true instead of just making one operation.
I guess "if" type statement could work if condition is checked for every coefficient calculation operation:
- Code: Select all
if(x % 2 != 0) a0 = polynomial
if(x % 2 != 0) a1 = ...
if(x % 2 != 0) b0 = ...
if(x % 2 != 0) b1 = ...
if(x % 2 == 0) a0 = ...
...
Could this be possible ... ?
Re: Conditional selection
Posted:
Tue May 26, 2020 11:47 am
by adamszabo
That would use way too much cpu, since it still calculates all your equations even if they are not "enabled"
Re: Conditional selection
Posted:
Wed May 27, 2020 12:09 am
by tulamide
First thing that came to my mind was cubic interpolation, but you wouldn't need any conditionals for that, and it seems to be code for a filter. Maybe if you elaborate on the topic? Maybe there is another way?
Simple example, if you're only interested in every second sample, you could use hop(2) and had no need for the conditionals anymore.
Re: Conditional selection
Posted:
Wed May 27, 2020 8:41 pm
by wlangfor@uoguelph.ca
I'd love to know the answer to this as well.
Re: Conditional selection
Posted:
Wed May 27, 2020 9:26 pm
by juha_tp
What I'm trying to do is a LR crossfeed plug-in without Ruby code. I'm using polynomials to calculate coefficients (in attached example I'm using BLT based implementation).
There's also something wrong with the LPF filter.
EDIT: attached the schematic
Re: Conditional selection
Posted:
Thu May 28, 2020 9:04 am
by adamszabo
Its best if you post a schematic because we have no idea which filter you are using that is different from the left or right channel, these graphs dont really tell us anything
Re: Conditional selection
Posted:
Thu May 28, 2020 10:12 am
by juha_tp
OK, updated my previous post with schematic.