|
| Notices |
Welcome to the DriverHeaven.net forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
 |
|
Feb 20, 2007, 08:59 PM
|
#1
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Auto Mute plugin?
Is there a plugin - that exists that will act as a sort of binary 'ducker'.
Binary in that - it acts as a switch (on or off only, not mix amount like a traditional ducker would do with say a sidechannel input of a compressor)
What Im looking to do is...
Say I am using Prologica to upmix stereo signals. Which I send FXBuss 0/1 to.
I mix the REAR outputs of prologica with FXBuss 6/7 - and output to epilogs rear outputs.
This works fine EXCEPT - that when I say, use foobar to UPMIX - or play a DVD, I would like so way to automatically mute the prologica REAR from going to epilog - so FXBUSS 6/7 is ONLY heard..
I realize this may be possible with dynamics processor, I havent tried yet, but its kinda a resource hog to as I dont want compression/expansion - just a simple ON or OFF 'ducker'.
Does this exist, if not - how is 'ON or OFF' figured in KX DSP (more precisely, DANE ONLY).
*Hopes that made sense*
Thanks,
Mark
|
|
|
Feb 20, 2007, 09:26 PM
|
#2
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Assuming that the audio to FxBus 6/7 is not gated (so that when something is playing, there is always some minimum level to use for detection), then it should be pretty easy to do using conditional logic (use skip instructions).
Something like (pseudocode):
if (abs(in2) > 0)
out = in2
else
out = in1
Is this something that you want to try and make yourself?
<edit>
Actually the abs (above) is not even necessary, since you can just check for a non-zero value at the input (use a skip instruction using 0x100 as the test_value) .
i.e.
if (in2 != 0)
out = in2
else
out = in1
</edit>
Last edited by Russ; Feb 20, 2007 at 09:53 PM.
Reason: typo
|
|
|
Feb 20, 2007, 10:10 PM
|
#3
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Quote:
Originally Posted by Russ
Is this something that you want to try and make yourself?
<edit>
Actually the abs (above) is not even necessary, since you can just check for a non-zero value at the input (use a skip instruction using 0x100 as the test_value) .
i.e.
if (in2 != 0)
out = in2
else
out = in1
</edit>
|
Ahh - ok the skip instruction - yes I would like to make this myself in DANE - I guess I was making sure I didnt set out on an impossible quest. 
(I wasnt sure if it was possible with DANE only)
Thank you sir...
|
|
|
Feb 20, 2007, 10:19 PM
|
#4
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Just remember that the skip instruction, skips if the test condition is true (sort of the opposite of using if..then).
Let me know if you need any help with it.
|
|
|
Feb 20, 2007, 11:13 PM
|
#5
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Ok - here it is, I added level controls too.
edit:
Description: If signal is present on FXBIn - then mute PL inputs. With level controls
Code:
input FXBInL, FXBInR, PLInL, PLInR
output OutL, OutR
control FXB=1, PL =1
temp t1, t2
; code
macs t1, 0, FXBInL, FXB ; t1 = T1 + PLInL * PL
macs t2, 0, FXBInR, FXB ; t2 = T2 + PLInR * PL
skip t1, ccr, 0x100, 2 ; if FXBInL = 0.. then Skip next 2 instructions
macs t1, 0, PLInL, PL ; t1 = T1 + PLInL * PL
macs t2, 0, PLInR, PL ; t2 = T2 + PLInR * PL
macs OutL, 0, t1, 1 ;
macs OutR, 0, t2, 1 ;
Edit: Fixed as per Russ' keen eye - pointing out this dumb guy. 
(Now!) Seems to work as I expect - but any suggestions to optimize or potential problems please post em...
Thanks again Russ.
Last edited by Maddogg6; Feb 21, 2007 at 01:12 AM.
|
|
|
Feb 20, 2007, 11:56 PM
|
#6
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Ok, there are some optimizations that you can do:
Use Outputs instead of temp registers when possible (save gprs).
Add the 2 channels together so that it is triggered if there is a signal from either channel.
Your code was not working for me, and I am not sure why, I will have to take a closer look at it.
In the mean time, here is the code I used while I was waiting (to show another (very similar) way of doing it)...
input in1_left, in1_right;
input in2_left, in2_right;
output out_left, out_right;
macs out_left, in2_left, 0, 0;
macs out_right, in2_right, 0, 0;
acc3 0, out_left, out_right, 0;
skip ccr, ccr, 0x100, 2;
macs out_left, in1_left, 0, 0;
macs out_right, in1_right, 0, 0;
To add volume controls, you would just change the first 2 and last 2 instructions to apply the volumes.
Ok, now let me figure out why your code is not working for me...
Last edited by Russ; Feb 21, 2007 at 03:35 PM.
|
|
|
Feb 21, 2007, 12:36 AM
|
#7
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Ok, I see what the problem is, you have the conditions backwards (those skip instructions can be confusing).
i.e.
if (in1 != 0)
out = in2 // in2 only plays when a signal is at in1
else
out = in1 // only gets here if in1 is 0, so nothing plays at all if it gets here
BTW:
Why use this:
-----------
macs OutL, 0x0, t1, 0x7fffffff;
macs OutR, 0x0, t2, 0x7fffffff;
-----------
instead of:
-----------
macs OutL, t1, 0, 0;
macs OutR, t2, 0, 0;
-----------
Not that it really matters, I am just curious...
<edit>
One more thing...
I would swap the positions of your volume controls, such that top slider controls volume for the top inputs, and the bottom slider controls the volume for the bottom inputs. Just because it is what I am used to with plugins like Stereo Mix, GainHQ, etc (I kept adjusting the wrong slider).
</edit>
Last edited by Russ; Feb 21, 2007 at 01:38 AM.
|
|
|
Feb 21, 2007, 01:01 AM
|
#8
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
I fixed the post - Ok - NOW it works - Im positively 100% sure - I think.
hehe.
Anyway - I have a question:
Quote:
acc3 0, out_left, out_right, 0;
skip ccr, ccr, 0x100, 2;
|
I was wondering why testing this wasn't good?
Quote:
macs out_right, in2_right, 0, 0;
skip out_right, ccr, 0x100, 2;
|
?? - beside the fact you multiplied by zero (which would always = zero, no??)
(edit: nevermind the above Q - DoH out=in+(0 *0) /end edit)
But the question is more on why you added an extra instruction for the test - does that reset a value or something.
Edit - I gotya - My way is ONLY testing RIGHT - your test the combination of L+R...
Sorry - I dum ....
But then agian - Im saving an instruction - so - 'I dum like skunk'.
Last edited by Maddogg6; Feb 21, 2007 at 01:21 AM.
|
|
|
Feb 21, 2007, 01:14 AM
|
#9
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
MACS instructions takes the form: R = A + (X * Y)
(order of operations does multiplication before addition)
MACS R, A, 0, 0; R = A + (0 * 0) or R = A
MACS R, A, 0, 1; R = A + (0 * 1) or R = A
The above instruction has the same result as the previous one, the 1 does nothing (1 * 0 = 0) except make it confusing as to what the code is supposed to do when reading it.
skip out_right, ccr, 0x100, 2;
Why are you saving the result of the skip instrcution in out_right?
You do not need to save it at all, and further it is modfying the value of out_right.
You did the same thing in your code with your tmp variable, so that when t1 is fed to the output, it is the result of the skip instruction instead on the input. You need to fix that.
Just make it:
skip ccr, ccr, 0x100, 2;
Give me a min and I will look at your update and see if there is anything else.
|
|
|
Feb 21, 2007, 01:25 AM
|
#10
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Ok, the only problem that I see with your new code is with the skip instruction:
Code:
skip t1, ccr, 0x100, 2 ; if FXBInL = 0.. then Skip next 2 instructions
Remove 't1' and use 'ccr' instead as I said in my previous post.
The comment is wrong, should read:
if FXBInR != 0.. then Skip next 2 instructions
(note the 'R' and the "!=")
The rest would just be optimizations to get rid of the temp variables, etc.
The only problem with such a plugin, is with audio sources that have parts in them that are completely silent (i.e. value of 0). With no noise floor (digital material), such silences can cause it to act up. It would be good to add a timer of some sort to keep it from unmuting the other input during short periods of silence, etc.
Last edited by Russ; Feb 21, 2007 at 01:36 AM.
|
|
|
Feb 21, 2007, 01:31 AM
|
#11
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Ok I tried yur optimizations and I think the FIRST macs that SET output registers are causing them to be set for PLIN then AGAIN for FXB - when signal is present on both... so I think the temp registers are needed.
|
|
|
Feb 21, 2007, 01:45 AM
|
#12
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Ok - I got it this time - poor Russ, puttin up with my idiotic ways..
Code:
input FXBInL, FXBInR, PLInL, PLInR
output OutL, OutR
control FXB=1, PL =1
; code
macs OutL, 0, FXBInL, FXB ; OutL = 0 + PLInL * PL
macs OutR, 0, FXBInR, FXB ; OutR = 0 + PLInR * PL
acc3 0, FXBInL, FXBInR,0 ; Add BOTH inputs to test BOTH L & R for any signal
skip ccr, ccr, 0x100, 2 ; If FXBInL+FXBInR != 0.. then Skip next 2 instructions
macs OutL, 0, PLInL, PL ; OutL = 0 + PLInL * PL
macs OutR, 0, PLInR, PL ; OutR = 0 + PLInR * PL
I should have beed using headphones for test this whole time to more accurately hear what was happening.
Anyway - its working 100% now - no really - it is...
Thanks again Russ for your patients and suggestions - I'll find that cliff right away... Now did you say I should leap forwards or backwards ?? lolz
edit: I added your suggested ACC3 - as it clicks less durring fade outs when signal id onFXBIn.
Now - 1 more Q - I'm thinking of using iTram (say 10 samples) and adding FXBIn's and sending the sum to that iTram, and adding that as well to the ACC3 instruction - to get a sort of delay in muting - to reduce the artifacts - as we're always crossing 0)
An I still being dum with this idea??
Last edited by Maddogg6; Feb 21, 2007 at 01:59 AM.
|
|
|
Feb 21, 2007, 01:48 AM
|
#13
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Quote:
Originally Posted by Maddogg6
Ok I tried yur optimizations and I think the FIRST macs that SET output registers are causing them to be set for PLIN then AGAIN for FXB - when signal is present on both... so I think the temp registers are needed.
|
I am not sure what you mean, I would have to see how you coded it. It works for me (except my code mutes in1 when a signal is presnt at in2).
<edit>
Just saw your last post... that looks better 
</edit>
Last edited by Russ; Feb 21, 2007 at 01:57 AM.
|
|
|
Feb 21, 2007, 02:04 AM
|
#14
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Quote:
Originally Posted by Maddogg6
Now - 1 more Q - I'm thinking of using iTram (say 10 samples) and adding FXBIn's and sending the sum to that iTram, and adding that as well to the ACC3 instruction - to get a sort of delay in muting - to reduce the artifacts - as we're always crossing 0)
An I still being dum with this idea??
|
Sounds ok to me... Give it a try, that is part of the fun with making your own plugins, trying out ideas and seeing if/how well they work.
|
|
|
Feb 21, 2007, 02:04 AM
|
#15
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Something like this...
Code:
itramsize 10
; xtramsize 0
input FXBInL, FXBInR, PLInL, PLInR
output OutL, OutR
control FXB=1, PL =1
; code
idelay write dw at 0x0
macs OutL, 0, FXBInL, FXB ; t1 = T1 + PLInL * PL
macs OutR, 0, FXBInR, FXB ; t2 = T2 + PLInR * PL
acc3 0, FXBInL, FXBInR, dw
skip ccr, ccr, 0x100, 2 ; FXBInR != 0.. then Skip next 2 instructions
macs OutL, 0, PLInL, PL ; t1 = T1 + PLInL * PL
macs OutR, 0, PLInR, PL ; t2 = T2 + PLInR * PL
So far seems to work
|
|
|
Feb 21, 2007, 02:08 AM
|
#16
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Quote:
Originally Posted by Russ
Sounds ok to me... Give it a try, that is part of the fun with making your own plugins, trying out ideas and seeing if/how well they work.
|
Seems alot of trouble is NON OPTIMAL testing methods...
But yes - that definitly seems to have helped smooth out fades.
|
|
|
Feb 21, 2007, 02:10 AM
|
#17
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Quote:
Originally Posted by Maddogg6
So far seems to work
|
Are you sure?
You have no read address, so all you are doing is writing to iTram.
(err, actually you are not even doing that  ... to write to iTram, the write address needs to be the R register in one of the instructions).
Quote:
|
Seems alot of trouble is NON OPTIMAL testing methods...
|
Yeah, good testing methods would help.
<edit>
You would need to do something like this:
iDelay read dr at 10
...
acc3 dw, in1l, in1r, 0;
acc3 0, in1l, in1r, dr;
skip...
But if you have a sound that is less than 10 samples long, then this could cause problems too...
</edit>
Last edited by Russ; Feb 21, 2007 at 02:32 AM.
|
|
|
Feb 21, 2007, 02:44 AM
|
#18
|
|
DriverHeaven Senior Member
Join Date: Jan 2003
Location: The Netherlands
Posts: 1,778
|
I don't mean to spoil the fun but,
Russ, you are making the same mistake as with your Noise gate.
Use average of control signal. Never per sample!
What you guys are doing now is abruptly switching channel_B on *every*
zero crossing of the signal present on channel_A.
The proper way to do such 'channel switching' without introducing distortion/pops&clicks etc, is to design a proper Gate.
So you really can't do without some form of EnvelopeFollower,attack,release + VCA.
(If this plugin has to be any good that is)
HTH,
/Lex.
PS:
Russ, Just noticed your 'itram' attempt.
Go for a 'real' Gate,..trust me 
|
|
|
Feb 21, 2007, 03:16 AM
|
#19
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Yup, you are right....
|
|
|
Feb 21, 2007, 04:12 AM
|
#20
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Hey lex... I have no doubts having the conventional gating would be better,
But I came up with this that works pretty good for my needs.
Quote:
itramsize 96
; xtramsize 0
input FXBInL, FXBInR, PLInL, PLInR
output OutL, OutR
control FXB=1, PL=1
; code
idelay write dw at 0
idelay read dr at 96
macs OutL, 0, FXBInL, FXB ; OutL = 0 + PLInL * PL
macs OutR, 0, FXBInR, FXB ; OutR = 0 + PLInR * PL
acc3 dw, 0, OutL, OutR ;Store mute delay test sample
acc3 0, dr, OutL, OutR ; prepare to test
skip ccr, ccr, 0x100, 3 ; OutR+OutL != 0.. then Skip next 2 instructions
macs OutL, 0, PLInL, PL ; OutL = 0 + PLInL * PL
macs OutR, 0, PLInR, PL ; OutR = 0 + PLInR * PL
|
Its low on resources and all DANE... which is what I was after - I do, on occasion hear some clicking - but this is for TV/DVD watching so its not a big deal
(I can now easily use the same DSP config now for AC3 or DSP upmix - and not have doubled sounds )
Thanks for all the input, suggestions etc etc - Oh, I found that cliff btw Russ 
|
|
|
Feb 21, 2007, 04:33 AM
|
#21
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
Sorry Maddogg6, I do not know where my brain was. I did not even think about zero-crossings, etc.
In any case, I hacked something together that might work a little better. I threw it togther quickly, so it is not optimized (at all) or anything, but I think it might work ok. It may not be the best implemention (it is 4:30 am), but maybe you can make use of it.
Here is the code (hopefully it isn't t bad... I am starting to go cross-eyed):
Code:
input FXBInL, FXBInR, PLInL;
input PLInR;
output OutL, OutR;
control FXB=1, PL=1;
static abs=0, av=0, v1=0;
static v2=0;
temp t1, t2
; code
interp v1, v1, 0.00001, 1;
macs t1, 0, FXBInL, v1;
macs t2, 0, FXBInR, v1;
macs t1, 0, t1, FXB;
macs t2, 0, t2, FXB;
tstneg abs, t1, t1, 0;
interp av, av, 0.0007, abs;
skip ccr, ccr, 0x100, 7;
interp v2, v2, 0.00001, 1;
macs t1, 0, PLInL, v2;
macs t2, 0, PLInR, v2;
macs t1, 0, t1, PL;
macs t2, 0, t2, PL;
macs v1, 0, 0, 0;
skip ccr, ccr, 0x7fffffff, 1
macs v2, 0, 0, 0;
macs OutL, 0, t1, 1;
macs OutR, 0, t2, 1;
It currently only uses FXBInL for testing.
In any case, it is still all Dane code, and what Lex is talking about most likley could be done all in Dane as well, without using too many resources.
Last edited by Russ; Feb 21, 2007 at 05:30 PM.
|
|
|
Feb 21, 2007, 04:38 AM
|
#22
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
Oh - Hey Russ - you need not bothered - I have enough hehe...
But I do appreciate - I will give it a go tomarrow (and maybe learn about the A/D gating too--- maybe not ??)
Anyways -- thanks 1,000,000,004.4674 times.
Get some sleep already....
|
|
|
Feb 21, 2007, 03:17 PM
|
#23
|
|
Tail Razer
Join Date: Jun 2005
Location: Bernyurass, AZ - USA
Posts: 3,721
|
@Russ: thank you again - its working very well..
I do have a question (or 2 or 3 or.... ):
I see the static was used to 'sorta' do what I was thinking with the iTram delay - I get that, or understand why thats a better idea.
But I was wondering if you could to write up psudo code for the logic you used here.? or maybe comment the code possibly...
I think I could learn more that way... maybe not ??
if its too much hassle, I completely understand if you think it will just go over my 'low flying' head.
Again - thank you so much...
edit: it seems to output a mono mix of FXBIns...
(I sent a wide stereo signal into both, and enabled/disabled FXBIns and can hear stereo - mono... )
I would like to understand why and if possible how to fix it myself - but I dont want to be that hemeroid that wont go away either...
Last edited by Maddogg6; Feb 21, 2007 at 03:22 PM.
|
|
|
Feb 21, 2007, 03:54 PM
|
#24
|
|
DriverHeaven Extreme Member
Join Date: Jan 2005
Posts: 4,104
|
The mono problem was due to a typo (I corrected it) on the 5th instruction, that was causing it to only play the left side of that input.
I will add an explanation as soon as I have a chance.
|
|
|
|