CrossFading

Discussion in 'Effects and the DSP' started by fensoft, Mar 2, 2003.

  1. fensoft

    fensoft New Member

    Joined:
    Feb 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Why not add a crossfading dsp ?
    -------------------
    |-IN1L OUTL-|
    |-IN1R OUTR-|
    |-IN2L |
    |-IN2R |
    -------------------
    when the cursor is put all has right, all the sound of IN1 and no sound of IN2 are sent to OUT
    when one gradually brings the cursor to the center, the sound of IN2 is added gradually to OUT, while leaving the totality of the sound of IN1 with OUT, to finish has an addition of the 2 sources has identical volume.
    and so on for the left ...
    i have an external midi controler, so if someone can build this 'dsp', it will be very useful for me ...
    i think its not harder than build a stereo mixer ...
    thanks a lot, and sorry for my bad english ...
     
  2. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    like that maybe ;)?

    Code:
    
    name "switch-mix"
    copyright "copyright: kX Project 2003."
    created "just after the big boom"
    guid "fcddd587-20ec-4560-bc82-0827f79c4f51"
    
    input in0l, in0r, in1l, in1r      
    output out1, out2
    control switch = 0
    
    interp out1, in0l, switch, in1l    
    interp out2, in0r, switch, in1r
    
    end   
    
     
  3. fensoft

    fensoft New Member

    Joined:
    Feb 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    humm yes, but when set to 50%, 100% In1 and 100% In2 go to Out ...

    maybe :
    Code:
    name "linear crossfade"
    copyright "copyright: kX Project 2003."
    created "just after the big boom;thanks to maxM and kX,the best drivers i ever seen"
    guid "fcddd587-20ec-4560-bc82-0827f79c4f51"
    
    input in0l, in0r, in1l, in1r      
    output out1, out2
    control switch = 0
    
    [i]interp out1, in0l, 2*(switch>0.5)*(switch-0.5), in1l    
    interp out2, in0r, 2*(switch<0.5)*(-switch+0.5), in1r[/i]
    
    end
    
    but it think that 2*(switch>0.5)*(switch-0.5) won't work ...
    is switch is considered as a vars ?
     
    Last edited: Mar 3, 2003
  4. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    ah, i think i understood you incorrectly, then you mean that when switch is at 100% both in1 and in2 should go to out with full level? or? (i think "cross" word confused me).
     
  5. Mata Hari

    Mata Hari Active Member

    Joined:
    Feb 12, 2003
    Messages:
    214
    Likes Received:
    0
    Trophy Points:
    26
    It's a dj cross function, full left = channel 1 goes to out, full right is channel 2 goes to out, and the mid position is both channels go to out (100% of both chans)

    going from left to center, mixes channel 2 increasingly together with chan 1, and from center to right, channel 1 gets mixed out of the output
     
  6. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    ah, i see... ok... then above code does slightely different.. when switch is at 50%, in1/in2 go to out with 50% levels... hmm... let me think...
     
  7. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Then i hope that the following code will do the trick
    (however one should write the real plugin then - since it makes no sence to execute first two instructions 48000 times per second)

    Code:
    
    name "ok, hmm... djcf2003? ;)";
    copyright "kX Project 2003."
    created "almost just after the big boom"
    guid "f8f2ae63-91ea-425d-9dcb-5dbe6ddafd2d";
    
    input in0l, in0r, in1l, in1r
    output outl, outr        
    control switch           
    temp x, y
    
    macints	y, 0, switch, 2i
    macints	x, accum, 1, -2i
    macsn	0, 0, in0l, x   
    macs	outl, accum, in1l, y     
    macsn	0, 0, in0r, x   
    macs	outr, accum, in1r, y
    
    end  
    
    
     
    Last edited: Mar 3, 2003
  8. RIV@NVX

    RIV@NVX Freedom is a feature.

    Joined:
    Jul 10, 2002
    Messages:
    4,476
    Likes Received:
    2
    Trophy Points:
    0
    Will this be included in 3531?;)
    Looks cool:)
     
  9. fensoft

    fensoft New Member

    Joined:
    Feb 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    [OOPS, SORRY, i've erased your post by mistake, my apologies... too many buttons around there... well... sorry again... could it be to hard for you to reproduce some stantments of it?]

    /bad Max ;(
     
    Last edited by a moderator: Mar 3, 2003
  10. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    >>however one should write the real plugin then
    >is it very problematic ? what consequence ?

    well, no (i mean no problemo)...

    >and it seems to corupt the stereo

    it should not, i cannot reproduce such behaviour... maybe you've seen some "clue"... sometimes it happens...

    >and ... it is as10k1 code

    :) it is not as10k1 code, it is Dane code... but since both assemblers are written for the same dsp and syntaxes (at least their pure assembly part) are less or more similiar, as10k1 manual is recommended as the only less or more detailed general guide to emu10kx dsp assembly available for the moment...

    >i think its because of accum...

    maybe... another unknown accum side effect?... although i still cannot reproduce such... nevermind though... ;)

    btw. your card model?
     
  11. eyagos

    eyagos New Member

    Joined:
    Dec 11, 2002
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    0
    Ups, nice use of accum register Max. I writed another one, but mine uses much more registers and instructions. Of course, with a dll this effect would be much more simple.

    Here is my code, larger but more "linear" if a dll is not avaliable:

    Code:
    name "you don't have to be good, to be my girl... :drool: ";
    	copyright "Copyright (c) 2003.";
    	created "03/03/2003";
    	engine "kX";
    	guid "2ad36552-c7ac-4421-a95f-f2440f35d0a7";
    	
        input   in0L,in0R,in1L,in1R
        output  outL, outR      
        control switch = 0.5
        temp    s,i0L,i0R,i1L,i1R
        
        macs    i0L,0,in0L,0.5
        macs    i0R,0,in0R,0.5
        macs    i1L,0,in1L,0.5
        macs    i1R,0,in1R,0.5
        
        macints s,0,switch,0x2
        macs    outL,i0L,i1L,s
        macs    outR,i0R,i1R,s
        macsn   s,switch,0.5,1
        skip    ccr,ccr,0x4,0x3
        macints s,1,s,-2i
        macs    outL,i1L,i0L,s
        macs    outR,i1R,i0R,s
    
    end
    Note that inputs are divided by two to avoid saturations.
     
  12. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    ;) "Linear" - what this means?. "Saturation" - well, the one can just set master level to 0.5 (since saturation occures just right before output in epilog - not in plug-in, there's no sense to put all eggs into one basket)...
     
  13. fensoft

    fensoft New Member

    Joined:
    Feb 27, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    0
    Max's crossfader doesn't work : look at [​IMG] ; input left and output left and right ...
    i remade this code, and seems to work better :) just copy&paste 2 lines
    Code:
    name "ok, hmm... djcf2003? ";
    copyright "kX Project 2003."
    created "almost just after the big boom"
    guid "f8f2ae63-91ea-425d-9dcb-5dbe6ddafd2d";
    
    input in0l, in0r, in1l, in1r
    output outl, outr        
    control switch           
    temp x, y
    
    macints	y, 0, switch, 2i
    macints	x, accum, 1, -2i
    macsn	0, 0, in0l, x
    macs	outl, accum, in1l, y
    macints	y, 0, switch, 2i
    macints	x, accum, 1, -2i
    macsn	0, 0, in0r, x
    macs	outr, accum, in1r, y
    
    end
    
     
  14. eyagos

    eyagos New Member

    Joined:
    Dec 11, 2002
    Messages:
    259
    Likes Received:
    0
    Trophy Points:
    0
    fensoft, Max plugin works correctly. That photo doesn't show his "normal" behavior. Although some times I have observerd such "errors" in other situations. May be that two lines solves some kind of problem with accumulator.

    Max, you are true. In my design, temporal regsiters are needed, so I killed two birds in one shoot dividing inputs by two. But I have made the comparison and both desings gives the same results.
     
  15. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    ok, then we've got something that will work untill integrated one (31?) one way or another. Kxl version will require only four instructions and two registers (excluding i/o). Even additional "gain" fader can be made with no register cost. nice.
     

Share This Page

visited