simulate the emu10kx's LOG instruct need help

Discussion in 'Effects and the DSP' started by JoshuaChang, Apr 28, 2011.

  1. JoshuaChang

    JoshuaChang New Member

    Joined:
    Mar 22, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    0
    hi,
    i'm tring to simulate the emu10kx's LOG instruct using C language, i've read the as10k1 manual and made a rough function, but couldn't get more progress, here is my code:
    Code:
    int emu10k_log(int x, int exp, int bits) {
        int sign;
        if(x>=0)
            sign=0;
        else
        {
            sign=1;
            x=~x+1;
        }
        while((x&0x80000000)==0 && exp>0)
        {
            x=x<<1;
            exp--;
        }
        if((x&0x80000000)==0x80000000)
            return !sign?(x>>bits&(0x1<<31-bits)-1)+(++exp<<31-bits):~((x>>bits&(0x1<<31-bits)-1)+(++exp<<31-bits))+1;
        if(x<0x1<<31-bits)
            return !sign?x:~x+1;
        while(x>0x1<<31-bits)
            x=x>>1;
        return !sign?x&(0x1<<31-bits)-1:~(x&(0x1<<31-bits)-1)+1;
    }
    refer to emu10kx's instruct: LOG R, A, X, Y;
    x is the A, exp is the X, while bits is the sizeof(X), Y has not been implemented yet.
    i have no experience on kx plugin's debug,
    some one could give me these instruct's result(on real emu10kx chip)?
    LOG R, 0x00012345, 0x7, 0x0;
    LOG R, 0x00001234, 0x7, 0x0;
    LOG R, 0x00000123, 0x7, 0x0;
    LOG R, 0x00000012, 0x7, 0x0;
    LOG R, 0x00000001, 0x7, 0x0;
    LOG R, 0x40004000, 0x8, 0x0;
    LOG R, 0x10001000, 0x8, 0x0;
    LOG R, 0x00808000, 0x8, 0x0;
    LOG R, 0x00001234, 0x8, 0x0;
    LOG R, 0x00000001, 0x8, 0x0;

    very thanks~
     
  2. Max M.

    Max M. h/h member-shmember

    Joined:
    Dec 7, 2002
    Messages:
    2,690
    Likes Received:
    9
    Trophy Points:
    63
    Îòâåò: simulate the emu10kx's LOG instruct, need help

    log r, 0x00012345, 0x7, 0; = 0x00123450
    log r, 0x00001234, 0x7, 0; = 0x00012340
    log r, 0x00000123, 0x7, 0; = 0x00001230
    log r, 0x00000012, 0x7, 0; = 0x00000120
    log r, 0x00000001, 0x7, 0; = 0x00000010
    log r, 0x40004000, 0x8, 0; = 0x40000800
    log r, 0x10001000, 0x8, 0; = 0x30000800
    log r, 0x00808000, 0x8, 0; = 0x08080000
    log r, 0x00001234, 0x8, 0; = 0x00012340
    log r, 0x00000001, 0x8, 0; = 0x00000010

    (I assume that you understand this C function is provided only for "educational" purposes and should never be used in real code (unless you're writing some emu10kx debugger) - it's inadmissibly suboptimal).
     
  3. JoshuaChang

    JoshuaChang New Member

    Joined:
    Mar 22, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    0
    wow~Max M!!, you saved my life, big thanks
     
  4. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    since the dsp becomes an "old lady" simulating the whole instruction set would be great. we could use our plugins on every pc with asio output.
     
  5. JoshuaChang

    JoshuaChang New Member

    Joined:
    Mar 22, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    0
    hey stylus02, i'm reading your superspace plugin, in your dsp code, is there any register/constant operand related to frequency? except the control lp_cut=1 and control lp_q=0.3?
     
  6. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    now, you mean a control for tweaking the reverb color? there are only static delay times for early an late reverb. you can achieve a coloration over the delay feedback path (reverb decay time & damping (which is simply a lowpass structure)), but this is nothing special. a second lowpass filter affects generally the sound after the delayline. i gave it a feedback additionaly to get more basement. the late reverb is a duplicate of "freeverb" (open source). the sound itselve is very neutral.

    https://ccrma.stanford.edu/~jos/pasp/img724.png

    http://kxm.dyndns.org/superspace_03.jpg
     
    Last edited: Apr 30, 2011
  7. JoshuaChang

    JoshuaChang New Member

    Joined:
    Mar 22, 2003
    Messages:
    127
    Likes Received:
    0
    Trophy Points:
    0
    thanks for the help.
    i just want to use the superspace in 44.1khz environment, so any values related to times, frequency should be converted.
     
  8. stylus02

    stylus02 New Member

    Joined:
    Jan 11, 2008
    Messages:
    283
    Likes Received:
    2
    Trophy Points:
    0
    the delay times for comb- and allpassfilters were originally for 44,1 khz. i did no conversions to 48 khz (i had it in mind) because i liked the sound.

    btw: if you use my delaylines in a 44,1 khz environment you are closer to jezars "freeverb". this could sound a bit "darker" i fear.
    however, the freeverb was tweaked very well, to avoid resonance frequencies. it should sound allways "real".
     
    Last edited: May 1, 2011

Share This Page

visited