Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Audio click/pop using selector & filters

For general discussion related FlowStone

Audio click/pop using selector & filters

Postby Drnkhobo » Sun May 26, 2013 2:14 pm

Hey all, I have noticed a click in the audio when using a selector with a filter. The selector chooses the filters 'pole' which in my case is another filter. . . .

6dB = one filter
12dB = two filters (serial)
ect

so I understand that when the selector changes to either stream there will be a difference in the audio (naturally from the second filter) but how can I get around this?

I have thought about using a counter to trigger when the selectors index changes. This counter multiplys the stream from 0-1 so when you change the pole, it ramps up the audio from 0-1. but then the audio will drop when I ramp it up!

lol, I dont know if anyone has a work around? or if I have missed something?

Have a look at a quick fsm:

poleswitch.fsm
(10.98 KiB) Downloaded 950 times


Has anyone used a pole select in their projects? Did you use a selector like this?
Drnkhobo
 
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Audio click/pop using selector & filters

Postby Morph » Sun May 26, 2013 2:53 pm

Hi

The selector recompile the schematic on change, so use multiply instead should work.

poleswitchmul.fsm
(11.48 KiB) Downloaded 979 times


If it still pop, use de-zip between green and stream.
Morph
 
Posts: 53
Joined: Tue Jul 13, 2010 1:59 pm

Re: Audio click/pop using selector & filters

Postby Drnkhobo » Sun May 26, 2013 4:17 pm

Nice work around Morph! Thanks mate ;)

Dont know why I never thought to multiply the streams beforehand!

Just saw in the RBJ filter dsp module a line like this

Code: Select all
stage(0)
{
  abs = 3.4e38|0.999999|0.1;
}


Anyone know what the "|" is for???
Drnkhobo
 
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Audio click/pop using selector & filters

Postby Morph » Sun May 26, 2013 4:53 pm

Drnkhobo wrote:Anyone know what the "|" is for???

"Or".
Morph
 
Posts: 53
Joined: Tue Jul 13, 2010 1:59 pm

Re: Audio click/pop using selector & filters

Postby Nubeat7 » Sun May 26, 2013 5:00 pm

one of the things which is not to find in the user guide!
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Audio click/pop using selector & filters

Postby Drnkhobo » Sun May 26, 2013 6:07 pm

Guys, i dont understand that . . . :oops:

the code is telling me that abs is equal to: 3.4e38|0.999999|0.1

so where does the OR operator compare? And to what? BOOL?

I know that the purpose of this line is to assign abs a value of either one of those but i dont get how its doing it.
I have/had the understanding that the OR compares two values & outputs 0/1 depending on if any are true . . .

Hang on, is this actually saying that abs equals 1 if 3.4e38 or 0.999999 or 0.1 ????
Drnkhobo
 
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Audio click/pop using selector & filters

Postby trogluddite » Sun May 26, 2013 8:32 pm

It is float number voodoo black magic! ;)

The result of the OR line is a special value used for creating an ABS function elsewhere in the code...
Drnkhobo wrote:I have/had the understanding that the OR compares two values & outputs 0/1 depending on if any are true . . .

That's basically right, but in code (not 'green'), AND and OR work along the bits in each number, and'ing and or'ing things one bit at a time - so bit 0 of the output comes from bit 0 of each input value, and so on...
When you do a comparison in code, the result is a value with either ALL of the bits on (true), or ALL of the bits OFF false) - different than the simple 0/1 of 'green'. And that gives us the familiar behaviour of comparisons in code, where "TRUE & x = x" and "FALSE & x = 0".
However if you start AND'ing and OR'ing other number combinations, things get a little more, erm, "interesting"...

A float number has 32bits (well, not always, but it does in FS) - and the very last of them is the sign-bit that says whether a number is positive or negative - when that bit is ON, the number is negative.

So to get the ABS of a float number, you could just make sure that the sign bit is off - the other bits would stay the same, and abracadabra, we would always have a positive number. Hmm, but how?

Well, there is a way using a bitmask - you just need a number with all of the bits set to ON except for the sign-bit. You then do an AND (&) operation (which works one bit at a time), to get a result something like this...

0 1111111111111111111111111111111 (Special bitmask)
AND
1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (A negative number because the sign bit is ON)
EQUALS
0 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (the same number but positive)

And somewhere in your code, i bet you will find exactly that... "answer = some_value & abs".

But there's a problem here; the bit 'pattern' in that special bitmask doesn't actually represent any particular float number that you could just write down in code - if you send 'abs' to a stream out and look at it with a readout, it will say "#.QNAN", the error message for "Not A Number".
However, like the AND '&' operator, the OR '|' also works one bit at a time - and by OR'ing those particular three numbers together, you can create exactly the bit pattern that you need for the ABS bitmask.

I first saw that very early on in my SM days, and I have no idea who worked it out - but it is a mighty fine bit of hacking, because doing "& abs" takes way less CPU than the usual ways of making an ABS() function.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Audio click/pop using selector & filters

Postby Drnkhobo » Mon May 27, 2013 8:05 pm

:o
Thanks a million Trog, you do know your stuff! LOL experience I guess!

Its still quite tricky!

Code: Select all
out = ((out&abs) > 1e-11)&out;


there's that & !!!!!

Its quite a clever trick :D
Drnkhobo
 
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Audio click/pop using selector & filters

Postby MyCo » Mon May 27, 2013 8:50 pm

FIY a shorter version for the abs hack:

Code: Select all
stage(0)
{
  abs = 2|1.9999999;
}
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany


Return to General

Who is online

Users browsing this forum: Google [Bot] and 67 guests