Old 04-19-2014, 04:04 AM   #1
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default Splitting at different levels...

How would you split a signal by amplitude ?
(Not frequency bands !)
I'm having a compressor in mind that should process ranges between threshold levels individually. Like the elemental audio neodynium.

Here is a prototype. The output sounds nasty, so lower the master volume when testing it. At the moment it is also splitted into individual channels. The final product will use the splitted signal only internally for riding the 'envelopes'.

Code:
slider1:0,L 1+2
slider2:0,R 1+2
slider3:0,L 3+4
slider4:0,R 3+4
slider5:0,L 5+6
slider6:0,R 5+6
slider7:-24<-50,0,1>thresh 1
slider8:-48<-50,0,1>thresh 2

@init
db2log = 0.11512925464970228420089957273422; 

@sample
abs0 = abs(spl0);
abs1 = abs(spl1);

db0 = max(20*log10(abs0),slider7);
db1 = max(20*log10(abs1),slider7);
slider1=db0;
sliderchange(slider1);
slider2=db1;
sliderchange(slider2);

db2 = min(max(20*log10(abs0),slider8),slider7);
db3 = min(max(20*log10(abs1),slider8),slider7);
slider3=db2;
sliderchange(slider3);
slider4=db3;
sliderchange(slider4);

db4 = min(20*log10(abs0),slider8);
db5 = min(20*log10(abs1),slider8);
slider5=db4;
sliderchange(slider5);
slider6=db5;
sliderchange(slider6);

spl0=exp(db0 * db2log);
spl1=exp(db1 * db2log);
spl2=exp(db2 * db2log);
spl3=exp(db3 * db2log);
spl4=exp(db4 * db2log);
spl5=exp(db5 * db2log);
witti is offline   Reply With Quote
Old 05-08-2014, 05:30 AM   #2
Anomaly
Human being with feelings
 
Anomaly's Avatar
 
Join Date: Sep 2007
Posts: 642
Default

Greetings,

Some while ago I pondered similar idea as you. This is my basic idea of splitting signal into dynamic bands. However, things are not so simple. Whatever individual processing you wish to do with the bands, it will cause distortion into the composed waveform. For example, altering the output volume of one of the zones also alters the final composed waveform similar way a waveshaper does. You can make it sound nicer by putting longer release time for the envelope follower.

I hope this helps, good luck!

Code:
desc:Dynamic Splitter

slider1:-21<-40,0,1>dB Zone 1
slider2:-15<-40,0,1>dB Zone 2
slider3:-9<-40,0,1>dB Zone 3
slider4:-3<-40,0,1>dB Zone 4

@init

t10 = exp(-1/(srate*0.01));

function calc_pos(pos,rmin,rmax)
instance (curval,L,H) (
    pos = max(pos,rmin);
    pos = min(pos,rmax);
    pos = (pos - rmin) * 1/(rmax-rmin);
    curval = pos;
    L = min( max((1-pos)/1,0), 1 );
    H = min( max(pos,0), 1 );
);

function follower(input,att,rel)
instance (env,tmp) (
  tmp = input >= tmp ? input : input + t10 * (tmp-input);
  (tmp > env) ? (
      env = att * (env - tmp) + tmp;
  ) : (
      env = rel * (env - tmp) + tmp;
  );
);

@slider

z1t = 10 ^ (slider1 / 20);
z2t = 10 ^ (slider2 / 20);
z3t = 10 ^ (slider3 / 20);
z4t = 10 ^ (slider4 / 20);

@block

@sample

input = spl0;

env = e0.follower(abs(input),0,t10);

p1.calc_pos(env,z1t,z2t);
p2.calc_pos(env,z2t,z3t);
p3.calc_pos(env,z3t,z4t);

z1 = p1.L;
z2 = p1.H * p2.L;
z3 = p2.H * p3.L;
z4 = p3.H;

output = (z1*input) + (z2*input) + (z3*input) + (z4*input); // sum all volume zones...

// ...or send to audio channels
spl0 = spl1 = input*z1;
spl2 = spl3 = input*z2;
spl4 = spl5 = input*z3;
spl6 = spl7 = input*z4;
__________________
___________________________
Sonic Anomaly | free JSFX & VST Plugins
Anomaly is offline   Reply With Quote
Old 05-08-2014, 09:21 AM   #3
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Thanks Anomaly ! Will have a look at this !
witti is offline   Reply With Quote
Old 05-19-2014, 03:21 PM   #4
reapercurious
Human being with feelings
 
reapercurious's Avatar
 
Join Date: Jul 2007
Posts: 1,890
Default

i don't think the waveforms on compressors like neodymium are actually split by amplitude, i think the compressor has more knees. it's probably possible to chop up pieces of a waveform and reassemble it, but that seems like a wasted step if the same thing could be accomplished using a series of compressors whose threshold ranges are limited by (butted against) each other. or at least it would be a good start?
reapercurious is offline   Reply With Quote
Old 05-19-2014, 03:36 PM   #5
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Quote:
Originally Posted by reapercurious View Post
...i think the compressor has more knees.
Yeah, that might be true and sounds logic. The neodynium compressor is quite unique and i was wondering how the devs accomplish that. My first thought was that the signal gets splitted somehow before being processed. Will think about the 'knee' stuff. Implementing a 'correct' knee is not the easiest stuff to do, though.
witti is offline   Reply With Quote
Old 05-19-2014, 04:50 PM   #6
reapercurious
Human being with feelings
 
reapercurious's Avatar
 
Join Date: Jul 2007
Posts: 1,890
Default

if you have a stack of compressors sitting on an amplitude ladder, and all of them are set at 1:1 except for the bottom zone, then would the peak of the output of this compressor be reduced, or would the noise floor be sucked up higher? not really sure what goes on with this sort of plugin.

i did notice that JB Red Phatt Pro has 2 ratios.

https://www.youtube.com/watch?v=80V0FZ9eGJ4

anything that passes a lower threshold/ratio should trigger its compression, unless its deactivated at the point where the amplitude surpasses the upper threshold, but since that happens fast, i guess there would be distortion or waveshaping unless there's a decent release, and suddenly i think i understand what anomaly was saying.

since there _must_ be a longish release to the compression 'zones' this makes me think that if you compress in a lower zone, the total output would be attenuated by that amount, so this to me starts to look like a series of compressors with a linear sequence of thresholds. (threshold of one compressor can't pass the threshold of the compressor 'above' or 'below' it.) in this case, the compressors should give similar if not the same results as neodymium. (edit: also auto-gain probably goes in there somewhere)
reapercurious is offline   Reply With Quote
Old 02-19-2015, 09:04 AM   #7
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Thanks again for the replies !

Here is another idea for splitting signals by amplitude.

If you simply cut off the signal at threshold, the waveform looks squared.

Now the plugin should count 'the number of samples which looks squared'. At a given threshold level.

If the count goes over two or three samples, these samples will not get compressed. Only values below gets compressed.

So that squared waveforms belong to the upper threshold range and 'peaks' belong to the lower threshold range.

Again, this will be splitted internally, only to ride the envelopes, so no signal actually gets 'splitted'...


Does it make sense ?


(I have a js plugin in my arsenal which can count the number of clipped samples. Have to have a look at it again. Maybe it's a good starting point...)

witti
witti is offline   Reply With Quote
Old 02-21-2015, 04:47 AM   #8
planetnine
Human being with feelings
 
planetnine's Avatar
 
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
Default

How are "variable mu" compressors achieved digitally? Is that by multiple knees?



>
__________________
Nathan, Lincoln, UK. | Item Marker Tool. (happily retired) | Source Time Position Tool. | CD Track Marker Tool. | Timer Recording Tool. | dB marks on MCP faders FR.
planetnine is offline   Reply With Quote
Old 02-21-2015, 06:55 AM   #9
Quest The Wordsmith
Human being with feelings
 
Quest The Wordsmith's Avatar
 
Join Date: May 2011
Location: Shaolin => NJ
Posts: 1,213
Default

How can you filter an audio signal into dynamic bands? I'm likening the process to frequency splitting, but at least with frequencies, whether loud or soft, we have a variable we look for, the given Hz. But in dynamic splitting, what would you look for? How would you separate 2 sounds, one loud, one soft, being played at the same time? Wouldn't that require something like what Melodyne does? Totally curious about this conceptually.
__________________
freestylefam.com
Quest The Wordsmith is offline   Reply With Quote
Old 02-26-2015, 10:56 AM   #10
Quest The Wordsmith
Human being with feelings
 
Quest The Wordsmith's Avatar
 
Join Date: May 2011
Location: Shaolin => NJ
Posts: 1,213
Default

I was really interested in this...
__________________
freestylefam.com
Quest The Wordsmith is offline   Reply With Quote
Old 02-27-2015, 12:48 AM   #11
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Quote:
Originally Posted by Quest The Wordsmith View Post
How can you filter an audio signal into dynamic bands?
Don't know. Unfortunately the source code of the elemental neodynium plugin is not available. Would really like to know how they did it. That's why i started this thread...
witti is offline   Reply With Quote
Old 02-27-2015, 04:23 AM   #12
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
Default

ive seen it done well with a transient designer method where by you take the incoming "spewed" signal and compare it against different envelope slopes for the attack and release parts and switch where the audio is sent based on that.

I'm in a rush now so can't go into details but have a look at how transient shapers/designers work and it might give you some ideas on other ways of doing it.
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
musicbynumbers is offline   Reply With Quote
Old 02-27-2015, 08:16 AM   #13
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

witti - The first thing that this does is full wave rectify the signal. I understand why it's kind of necessary here, but I think you're really going to want to re-impose the sign of the original sample before you kick it out. But first, I think you should strip out the DC offset. The lowest part should be fine. The middle part you just subtract the average of the two thresholds, but I'm not sure about the top. It's going to take a hi-pass, I think, like JS dc remove, but I'm a little afraid of what that will do.

If you leave that DC offset in, but reimpose the original sign, the upper bands will end up looking like little wiggles riding on top of a square wave. But you don't need that square wave, because it's encoded in your lower band's clipped off top. If you strip the DC from the upper band and then add them back together, it should give you back the original wave. If you don't, I think you end up doubling the amplitude of that square wave...which I don't think you want! Also, if the outputs are "AC coupled" they will play nicer with the outside world. I'm pretty sure you can just run each input through a seperate compressor and then mix them back together at that point.

Edit - also, if you convert the slider values to linear one time each instead of converting every sample to log and back, it'll be more efficient and easier to read.
ashcat_lt is offline   Reply With Quote
Old 02-27-2015, 08:36 AM   #14
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Thanks guys ! I'm currently (again) in the middle of a big flu. So i can't think at the moment. Will be back when i'm well again...
witti is offline   Reply With Quote
Old 02-28-2015, 03:05 PM   #15
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Actually, it was even easier than I thought. Just plain subtracting the threshold (for the middle part, it's the lower threshold) before reapplying the sign strips the DC offset and lets them all add back together like nothing happened. Using the DC Remove made things weird, but this simple solution just works.

Put a compressor on one of them and it looks kind of interesting. I haven't been able to actually listen, but looking at it on the scope, I think we might be on to something. This probably wants oversampling somewhere along the line...

Code:
desc:DYNAMOSPLITIFY

slider1:-18<-60,0,0.1>bottom (dbfs)
slider2:-6<-60,0,0.1>top

@slider
bottom_ratio = slider1 / 20;
top_ratio = slider2 / 20;
bottom_line = 10 ^ bottom_ratio;
top_line = 10 ^ top_ratio;

@sample
in_l = spl0;
in_r = spl1;

abs_l = abs(in_l);
abs_r = abs(in_r);

bot_out_l = min(abs_l, bottom_line) * sign(in_l);
bot_out_r = min(abs_r, bottom_line) * sign(in_r);

mid_out_l = max(min(abs_l, top_line), bottom_line);
mid_out_r = max(min(abs_r, top_line), bottom_line);

mid_out_l = (mid_out_l - bottom_line) * sign(in_l);
mid_out_r = (mid_out_r - bottom_line) * sign(in_r);



top_out_l = max(abs_l, top_line);
top_out_r = max(abs_r, top_line);

top_out_l = (top_out_l - top_line) * sign(in_l);
top_out_r = (top_out_r - top_line) * sign(in_r);

spl0 = bot_out_l;
spl1 = bot_out_r;
spl2 = mid_out_l;
spl3 = mid_out_r;
spl4 = top_out_l;
spl5 = top_out_r;
ashcat_lt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.