SynthMaker

Normalizing

Archive · 2008 24 old posts

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

theorize ·

i was just reading another thread about sample instancing and volume (sorta), and it made me think to ask if anyone could point me in the right direction of a good explanation of that process? sorry i haven't done a search and won't be able to until tonight which by then i'll probably be too damn tired, and I'm about to leave here. please don't search it up yourself because i'm just looking for a link if someone already knows of one, i'll do a thorough look myself when I get the time because i'm thinking of trying to do (at least something similar) this to resolving a filter issue that i don't like.

stefan ·

theorize wrote: i was just reading another thread about sample instancing and volume (sorta), and it made me think to ask if anyone could point me in the right direction of a good explanation of that process? sorry i haven't done a search and won't be able to until tonight which by then i'll probably be too damn tired, and I'm about to leave here. please don't search it up yourself because i'm just looking for a link if someone already knows of one, i'll do a thorough look myself when I get the time because i'm thinking of trying to do (at least something similar) this to resolving a filter issue that i don't like.

Normalizing is basically compression but not just "if above" or "if below" threshold, but both. Calculate how much the input signal differs from the wanted level and apply the needed amount of gain.

Of course you can't do this all the way down to -inf dB, so some kind of threshold is needed there.

theorize ·

thank you stefan, i've never used normalizing (maybe back in FL2) before, so i never took the time to learn about it. i'm going to have to think about it some more and explore some more options, as i'm not sure that it would be appropriate yet.

yet it might be cool to have a little "N" button on the filter, because certain filter settings on my filter make it sound weak because of the way i'm mixing it, if i can't find a better way to route and mix it all i might just do it.

stefan ·

theorize wrote: thank you stefan, i've never used normalizing (maybe back in FL2) before, so i never took the time to learn about it. i'm going to have to think about it some more and explore some more options, as i'm not sure that it would be appropriate yet.

yet it might be cool to have a little "N" button on the filter, because certain filter settings on my filter make it sound weak because of the way i'm mixing it, if i can't find a better way to route and mix it all i might just do it.

I think it would be easier to just use heavy compression or a volume-matching curve for that specific scenario.

TomC ·

theorize wrote: thank you stefan, i've never used normalizing (maybe back in FL2) before, so i never took the time to learn about it. i'm going to have to think about it some more and explore some more options, as i'm not sure that it would be appropriate yet.

yet it might be cool to have a little "N" button on the filter, because certain filter settings on my filter make it sound weak because of the way i'm mixing it, if i can't find a better way to route and mix it all i might just do it.

Normalization is applying a constant(!) gain to an audio waveform. It's normally used to make a recording as loud as possible without clipping, and it's very easy there because you only have to search for the loudest peak, find the multiplier to get it to 0 db et voilà.

Now, we're looking at an audio stream(!). We can't know what'll be the loudest signal to come, so we can't do normalization if we don't want to risk clipping.

What you actually want is compression (or limiting which is a special form if compression). Only you know the input's signal level and what you'd like as output level, so my advice is a simple volume knob combined with whatever compressor/limiter is in fashion today.

I don't think a general 'N' for nomalization would help.

Tom

b_ara_ki ·

if you take s&h on the signal, & get the highest peak you can divide the reasult with the out of the signal . and you get........normalizing

TomC ·

b_ara_ki wrote: if you take s&h on the signal, & get the highest peak you can divide the reasult with the out of the signal . and you get........normalizing

No.

See posting above.

Tom

Osseous ·

I agree with TomC. If you use S+H, then the difference in time between one sample being taken and another could see lots of changes in your audio. You might be causing clipping using a method like that.

The best suggestion is limiting, as tom pointed out earlier. AFAIK it's just a severe or 'brickwall' compressor. You could check out the example in the Effects modules. If you put the ratio up full, then i believe that would be a brickwall compressor, or limiter.

You could also check out the Waves L1 and L2 Ultramaximizers to get an idea of how few controls you need on a limiter. I believe the Reaktor ensemble named 'Blue' also had a limiter in it somewhere.

kirkagur ·

if you looking for a limiter, one that eats up the clip and dont harm (match) to the sound....

i made one and i want to shere so here is the osm

oddson ·

I haven't completely figured out what your limit does but I've noticed you take the absolute value of the signal before running it through the envelope follower code. I don't think that's needed as the envelope follower already takes care of that in the first line of code: normIn = in * (1 - in < 0 & 2); (The add part afterwards is part of a denormal remover which is compensated for in the final line of code.)

aliasant ·

kirkagur wrote: if you looking for a limiter, one that eats up the clip and dont harm (match) to the sound....

i made one and i want to shere so here is the osm

hey.

I asm fu'd the threshold code to this. It didnt save much but I think there is something wrong with Andrews Analyzer maybe? Im getting odd results. This Threshold thing used 5 cycles and my optimized version uses 3 cycles. Isnt that to little? Anyways. Here is the asm code:

streamin In;streamout Out;float over=0; float F0=0; //Assignment> sLeft=In movaps xmm0,In; movaps over,xmm0; //movaps xmm0,over; cmpps xmm0,F0,5; //movaps xmm1,xmm0; andps xmm1,over; //Assignment> sLeft=xmm1 movaps over,xmm1; //Assignment> sLeft=over movaps xmm0,over; movaps Out,xmm0;

/ original code /streamin In; streamout Out; float over; over = In; over = over >= 0 & over; Out = over;

kirkagur ·

oops

i didn't notice...

and what will be better to change the envelope follower code ,or delete the assembler ?

aliasant ·

Looking closer at it.

It actually sounds pretty good =) Impressed.

It uses a bit to much cpu though.

Its the dB converters. Is there a faster way to write similar code?

kirkagur, do you have the original code for those two ?

The envelope follower could also be faster. Simply make it asm and remove a few lines. But to be honest. I havent been able to gain enough speed to make it worth while.

I made some small changes to it. The Limiter that is. I changed the fastest release time to 0.1 and I also changed the Threshold code so it now has to go over 2 to let stuff thru. I also changed the Limiter to max 48 from max 24.

Good job kirkagur!

aliasant ·

kirkagur wrote: oops

i didn't notice...

and what will be better to change the envelope follower code ,or delete the assembler ?

Delete the assembler. At least that is what I did. Didnt even think about the other option. But that might have been a mistake =) Who knows.

UPDATE: I asm fu'd the envelope follower and gained another 20 cycles.

From 60 to 40 cycles.

Code:

streamin in;streamout out;streamin release;float normIn=0; float c=0; float F1=1; float F0=0; float F2=2; float F1eM008=1e-008; movaps xmm0,in; cmpps xmm0,F0,1; //movaps xmm1,xmm0; andps xmm0,F2; movaps xmm1,F1; subps xmm1,xmm0; movaps xmm2,in; mulps xmm2,xmm1; //movaps xmm3,xmm2; addps xmm2,F1eM008; //Assignment> sLeft=xmm4 movaps normIn,xmm2; movaps xmm0,normIn; cmpps xmm0,out,5; movaps xmm1,F0; subps xmm1,release; andps xmm0,xmm1; movaps xmm1,release; addps xmm1,xmm0; //Assignment> sLeft=xmm1 //movaps c,xmm1; movaps xmm0,out; subps xmm0,normIn; //movaps xmm1,c; mulps xmm1,xmm0; //movaps xmm2,xmm1; addps xmm1,normIn; //movaps xmm2,xmm1; subps xmm1,F1eM008; //Assignment> sLeft=xmm3 movaps out,xmm1;

/ original code / streamin in; streamout out;

streamin release;

float normIn; float c; normIn = in * (1 - in < 0 & 2) + 0.00000001; c = release + normIn >= out & (0 - release); out = c * (out - normIn) + normIn - 0.00000001;

kirkagur ·

i dont know match assembler to delete those lines in the env follower code...

this is the original code for the db convertor

streamin lin; streamout db; db = log10(lin+0.0000000000001) * 20;

thank you for the comments ill be very happy if this limiter will be faster ,stronger, better

update: just post it and its happens !!! thank you 🙂 🙂 🙂

kirkagur ·

this code dont work well because its output can be below 0 if i put a max(in,0) its will still be faster then the original???

streamin In;streamout Out;float over=0; float F0=0; //Assignment> sLeft=In movaps xmm0,In; movaps over,xmm0; //movaps xmm0,over; cmpps xmm0,F0,5; //movaps xmm1,xmm0; andps xmm1,over; //Assignment> sLeft=xmm1 movaps over,xmm1; //Assignment> sLeft=over movaps xmm0,over; movaps Out,xmm0;

aliasant ·

=)

Here is a faster Power code to use in the dB to Linear module. There is a problem with this code that I dont really understand. It only works in mono. What happens is that, if the inputs are stream and you feed it with a packed stereo signal the output will only be the left channel. The right channel is gone some how.

Maybe this is a feature ? ... it is a very fast code. 211 cycles compared to the one you used that was about 800 or more cycles.

What I did to get around that problem was that I unpacked the signal and used 2 codes, one on each channel and then packed them again. This works and still saves at least 400 cycles.

Heres that code. Only in asm Im afraid.

streamin exp; streamin bas; streamout out; //--- Variables... float fBas = 0.0; float fExp = 0.0; float fAns = 0.0; float fHlf = 0.5; //--- Get the base/exponent values... movaps xmm0,bas; movaps fBas,xmm0; movaps xmm0,exp; movaps fExp,xmm0; //--- base^exponent [0]... fld fExp[0]; fld fBas[0]; fyl2x; fld st(0); fld fHlf[0]; fsub; frndint; fxch; fld st(1); fsub; f2xm1; fld1; fadd; fxch; fld1; fscale; fstp st(1); fmul; fstp fAns[0]; //--- Move the answer into 'out'... movaps xmm0,fAns; movaps out,xmm0; //--- Done!

aliasant ·

kirkagur wrote: this code dont work well because its output can be below 0 if i put a max(in,0) its will still be faster then the original???

streamin In;streamout Out;float over=0; float F0=0; //Assignment> sLeft=In movaps xmm0,In; movaps over,xmm0; //movaps xmm0,over; cmpps xmm0,F0,5; //movaps xmm1,xmm0; andps xmm1,over; //Assignment> sLeft=xmm1 movaps over,xmm1; //Assignment> sLeft=over movaps xmm0,over; movaps Out,xmm0;

OK. Thats the threshold code.. and yes. Something went wrong with it. Looking at it again.

UPDATE:

Here is it working. OBS: I included the mulitply with 0.00001 in this code so that can be removed after it. Must have mixed them up before posting it....

streamin In;streamout Out;float over=0; float F0=0; float F1P00001=1.00001; //Assignment> sLeft=In movaps xmm0,In; movaps over,xmm0; //movaps xmm0,over; cmpps xmm0,F0,5; //movaps xmm1,xmm0; andps xmm0,over; //Assignment> sLeft=xmm1 //movaps over,xmm0; //movaps xmm0,over; mulps xmm0,F1P00001; //Assignment> sLeft=xmm0 movaps Out,xmm0;

/ original code / streamin In; streamout Out; float over; over = In; over = over >= 2 & over; Out = over*1.00001;

aliasant ·

Lol im spamming today.

I just had to tell you that so far I have taken your original limiter 1258cycles down to 883cycles. Pretty good for a noob =)

kirkagur ·

amazing

great work aliasant its even sounds better 🙂

aliasant ·

kirkagur wrote: amazing

great work aliasant its even sounds better 🙂

Yes it does =). But now i found a bug in the threshold code.

Remember that I changed to 0 to a 2? When I hooked an oscillator running at high freqs and gain sometimes I get a harsh high nasty tone. This only happens and some positive gain values. like for now +6.1 dB. This is the gain for the test tone oscillator. I changed that 2 back to a 0 and its gone. No idea what that was all about. I also changed my post here of that threshold code.

Andrew J ·

aliasant wrote: There is a problem with this code that I dont really understand. It only works in mono.

Martin - this code does it's main bit of work in non-SSE ASM. You'll see the fExp[0] that refers to just one channel of the fExp variable for example. If you want this to be fully stream compatible, you have to repeat the calculations on [1], [2] & [3] as well. Of course, this takes 4 times as long. Optimisation will depending on how you need to pack/un-pack the signals. You can either use the code as a mono component, or re-write it to work on 2 channels.

aliasant ·

Andrew J wrote: aliasant wrote: There is a problem with this code that I dont really understand. It only works in mono.

Martin - this code does it's main bit of work in non-SSE ASM. You'll see the fExp[0] that refers to just one channel of the fExp variable for example. If you want this to be fully stream compatible, you have to repeat the calculations on [1], [2] & [3] as well. Of course, this takes 4 times as long. Optimisation will depending on how you need to pack/un-pack the signals. You can either use the code as a mono component, or re-write it to work on 2 channels.

Aaah.

So..

Do you mean llike this?

fld fExp[0]; fld fExp[1]; fld fBas[0]; fld fBas[1]; fyl2x; fld st(0); fld st(1); fld fHlf[0]; fld fHlf[1];

Or this?

fld fExp[0,1]; fld fBas[0,1]; fyl2x; fld st(0,1); fld fHlf[0,1];

Would any of those two work as a stereo code?

Andrew J ·

More like the first one, but you probably have to complete all the calculations on [0] before you do the ones on [1], otherwise you're just going to overwrite variables before anything much is done with them. (Too busy to explain this properly now, but email me the schematic if you like and I'll look at it another day).

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.