SynthMaker

DSP, MMX registers and floating point de-normalization

Archive · 2008 9 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

steph_tsf ·

Hi,

I got lucky, this code is actually working flawless. Of course, it needs the coefficients, calculated using green math on Excel based on omega, alpha and Q, and supplied by float labels (entered the values manually) to the code module. A quick and dirty way, but quite effective !

streamin input; streamout hi; streamout med; streamout lo; streamout notch;

// denominator coeff streamin d0; streamin d1; streamin d2;

// numerator coeff streamin n0hi; streamin n1hi; streamin n2hi; streamin n0med; streamin n1med; streamin n2med; streamin n0lo; streamin n1lo; streamin n2lo; streamin n0notch; streamin n1notch; streamin n2notch;

// mem float in; float z0; float z1; float z2; float epsilon = 0.00000000001;

// resonating cell input = input + epsilon; in = input; z0 = (in + (d1*z1) + (d2*z2))*d0 ; // hi output hi = (n0hi*z0) + (n1hi*z1) + (n2hi*z2); // med output med = (n0med*z0) + (n1med*z1) + (n2med*z2); // lo output lo = (n0lo*z0) + (n1lo*z1) + (n2lo*z2); // notch output notch = (n0notch*z0) + (n1notch*z1) + (n2notch*z2);

// update cells input = input - epsilon; z2 = z1; z1 = z0;

Can somebody explain to me :

1) Why the trick "input = input + epsilon;" at the beginning ? 2) Why the trick "input = input - epsilon;" at the end ? 3) What is the definition of de-normalization ? 4) As there are 3 MMX registers used here, can I use the "Pack4" feature ? 5) Can somebody give an example of code compatible with "Pack4" feature and how do we get the required "Pack4" symbol as connector instead of the "stream" connector ?

Any reply welcome. Steph

infuzion ·

1-2) search for "denormalization" or "denormal" & "CPU" on the forum 3) search for "denormalization" in Google 4) Oui 5) SM's Toolbox:Effect:Compressor

Acrobat ·

how do we get the required "Pack4" symbol as connector instead of the "stream" connector ?

right-clicking on the source/target connection.. 🙂

steph_tsf ·

Hello infuzion,

Unfortunately, using the seaches you advised, I got no help about the exact meaning of the specific SynthMaker "tricks" I was referring. To me it still looks like a "kitchen receipt".

I am still searching detailed info about the "trick". Surely a few weblinks would have been more effective.

As an example :

Intel is now writing about the x87 hardware FTZ (Flush-to-Zero ) and DAZ (Denormals Are Zero ) modes in the context of both the x87 and SSE and SSE2 XMM registers. http://softwarecommunity.intel.com/arti ... g/2088.htm Dated January 22, 2008.

However, with SSE and SSE2, a hardware Flush-to-Zero (FTZ) mode is possible. Some of the later processors that support SSE2 also support Denormals-Are-Zero (DAZ) modes. To determine whether a processor supports the DAZ mode, a software check must be performed (see Application Note 485 in References for further information). Both of these modes are less precise than using the IEEE 754 standard method, and so they are not compatible with the standard, but do provide substantially faster execution times when absolute accuracy according to the standard is not needed. FTZ and DAZ modes both handle the cases when invalid floating-point data occurs or is processed with underflow or denormal conditions. See Table 1 for a layout of what floating point numbers look like in these cases. The difference between a number that is handled by FTZ and DAZ is very subtle. FTZ handles underflow conditions while DAZ handles denormals. An underflow condition occurs when a computation results in a denormal. In this case, FTZ mode sets the output to zero. DAZ fixes the cases when denormals are used as input, either as constants or by reading invalid memory into registers. DAZ mode sets the inputs of the calculation to zero before computation. FTZ can then be said to handle SSE Output Assists while DAZ handles SSE Input Assists.

Could it be, from this, that there will be cleaner ways to deal with denormalization ?

Remember the reason I have opened this post is to concentrate info about the denormalization "tricks" here, precisely. Instead of having to deal with hundreds of webpages not specifically related to SynthMaker. Let us continue.

Steph

MyCo ·

There are only 2 methods to get around denormals, you can find both here: Smallest small volume null? (bitmask help?)

The first method is clipping which means: Set value to zero when its absolute value is below a clipping value.

The second method is the round off hack, which uses CPU internal rounding functions to round denormals to normals. This goes like this: denormal+normal = normal, normal-normal=normal

There is nothing more to know about the "tricks", to understand what denormals are, read this: http://en.wikipedia.org/wiki/Denormals

but first you have to know how floating values are represented in modern processors: http://en.wikipedia.org/wiki/IEEE_float ... t_standard

To detect denormals, you can use my stream inspector: A geek toy: Stream inspector

Got enough infos now? 🙂

infuzion ·

steph_tsf, MyCo is right & has great advice! Here is another older post: Runaway CPU / Polyphony / Denormal Problem ?

I understand that the CPU can be made to help rid of denormals also. We users don't have access to CPU flag-setting in SM as far as I know. Could be a good suggestion.

-- BTW, what kind of filter is that? How is it unique? cheers

steph_tsf ·

Hi MyCo, Hi infuzion,

Woaw ! Now this is fantastic ! Especially the stream analyzer, tracking de-normalization. SynthMaker contributors are fantastic people.

Now I know about de-normalization.

By the way, the IIR filter taken as example at the beginning of this post is a quick and dirty one, absolutely not "unique" and only for illustration purpose. It is not optimized, there is still a d0 coefficient (different to one) put into the resonating cell (dénominator). The resonating cell calculation is at the begining, so we can reuse its result (z0,z1,z2) when calculating the various summation networks after it. That'all, nothing complicated, nothing "unique".

Steph

infuzion ·

Yes, MyCo's tool is very nice!

This filter does seem more complicated than others I've seen. How do you get all the coeff please?

steph_tsf ·

Hello infuzion,

This filter does seem more complicated than others I've seen. How do you get all the coeff please?

. I am using an Excel spreadsheet using RBJ GreenMaths. Just added one topic about that here. RBJ Filters - Audio Biquad - GreenMaths in Excel

Regards, Steph

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.