Conditional selection

DSP related issues, mathematics, processing and techniques
juha_tp
Posts: 60
Joined: Fri Nov 09, 2018 10:37 pm

Conditional selection

Post 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?
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Conditional selection

Post by adamszabo »

I believe its only possible with assembler
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Conditional selection

Post by Spogg »

Maybe this will help...

viewtopic.php?f=4&t=8731&hilit=bitmasking

Cheers

Spogg
juha_tp
Posts: 60
Joined: Fri Nov 09, 2018 10:37 pm

Re: Conditional selection

Post by juha_tp »

Spogg wrote:Maybe this will help...

viewtopic.php?f=4&t=8731&hilit=bitmasking

Cheers

Spogg


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 ... ?
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Conditional selection

Post by adamszabo »

That would use way too much cpu, since it still calculates all your equations even if they are not "enabled"
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Conditional selection

Post 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.
"There lies the dog buried" (German saying translated literally)
User avatar
wlangfor@uoguelph.ca
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada
Contact:

Re: Conditional selection

Post by wlangfor@uoguelph.ca »

I'd love to know the answer to this as well.
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
juha_tp
Posts: 60
Joined: Fri Nov 09, 2018 10:37 pm

Re: Conditional selection

Post 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
Attachments
Linkwitz-Riley Crossfeed_unfinished.fsm
(1.83 KiB) Downloaded 1521 times
Last edited by juha_tp on Sat Jun 06, 2020 5:45 am, edited 4 times in total.
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Conditional selection

Post 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
juha_tp
Posts: 60
Joined: Fri Nov 09, 2018 10:37 pm

Re: Conditional selection

Post by juha_tp »

OK, updated my previous post with schematic.
Post Reply