Transfer function?

Discussion in 'Effects and the DSP' started by Nappylady, May 19, 2005.

  1. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    I answer to your questions:
    yes, i'm looking for a"good sounding" waveshaper and at the same time learn how to implement things in dane.
    I'm here like a sponge, ready to absorb!:lol:
     
  2. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    ... Hey Guys, i was able to solve the pbloblem... which one?

    i wanted to do: x*(2-x)

    but u told me that this doesn't work because of the macs...

    so i tought that i could do this:

    2x-x^2
    and this is possible and easy to do in dane.

    i did it this way

     
  3. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Looks pretty good. You could optimize it by reusing tmp and out. Don't forget that your original function was x*(2-abs(x)). What you could do with that is check the sign of the input, and if it is postiive then subtract the 'x^2' as you did above, but if it is negative you would instead add the 'x^2'.
     
  4. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
  5. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Yeah, I saw that post, but I thought Max was gonna work on it. Division in microcode is tricky, so I thought I would let the guru's take on that one, and see what tricks they come up with. :)
     
  6. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    .... Right, so let's wait for MAX!
    MAX, the crowd is acclaiming u!!! We hopeful stand here!
     
  7. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    ... Hi, Tiger, how come with this code it clips at -2.5dB instead of zero?

    i intended to do this: 2x-x*abs(x) ----> x*(2-abs(x))

     
  8. Tiger M

    Tiger M kX user

    Joined:
    Apr 14, 2004
    Messages:
    851
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    macints tmp1, 0x0, tmp, 0x2; 2*x
    here you get clipping, because the input exceedes 1
     
  9. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    ... Thanks so much! How come u are so silent lately?:confused:
    Am i annoiyng u?
     
  10. Tiger M

    Tiger M kX user

    Joined:
    Apr 14, 2004
    Messages:
    851
    Likes Received:
    0
    Trophy Points:
    0
    No, actualy quite the opposite. I'm happy to help people who want to learn and create plugins! For the people who take everyting for granted I won't be helping anymore.

    By the way, have you read the kx effects programming guide?
     
  11. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    ... YES, I have the newest one with the plots of log and exp, but u know sometime i need to ask some to solve confusion in my head. I bought a PC on October 2003... and i'm already able to do a lot of things, i record, do the radio, my site and i learned most of things by myself in this short time,
    I really appreciate the help U and Max, Russ are giving me!!! ;)
     
  12. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    ... Hy Guys, I was making tries with the fuction I posted two days ago:

    i tried to set a static k and to change some to avoid overflow and i came up with this that seems to work:

    Let me know what u think!:)
     
    Last edited: Jun 18, 2005
  13. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    .... Ok, since nobody replied to the above post I tried to work on what i wanted to do and i came up with something that for me is working and u can control the amount of "companding" so u can use it on both low and stronger sources.
    If i made some rough error in the code let me know, i'll be glad to learn from my mistakes!!!;)

    http://www.radiocolonel.it/kx/ColHQ_Compander.zip
     
    Last edited: Jun 18, 2005
  14. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Sorry, I was busy the last few days and only had time for quick replies.
    That code looks good to me. It looks as though you are doing:
    f(x) = x / ( 0.25 + (abs(x) * 0.75) )

    And your new version looks like:
    x = input sample, y = amount
    f(x,y) = x * ( 0.25 + (y * 0.75) ) / ( 0.25 + (abs(x) * (y * 0.75)) )

    I do not see any problems with the code, and trying it out, it seems to work pretty good.

    -Russ
     
  15. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Speaking of the kx effects programming guide, where did it go (the new version)? I just noticed that the whole thread about the guide is gone.
     
  16. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    Sorry, after further examination I did notice a problem that is causing the output to be phase inverted.
    You should be using limitn instead of limit.

    i.e.
    limitn tmp_sign, tmp_sign, 0x3, 0x1;

    -Russ
     
  17. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    Thank so much for your interest and help! ;)
    Yes that is the formula i used f(x)=(0.25+k)*x/(0.25+k*abs(x)) k=0.75*amount (i just wrote it differently)

    I'm so glad i've been able to make this little plugin!
    In almost 6 months i made a lot of progresses in dane programming, at the beginning i was just able to make volume controls! :lol:
     
  18. radiocolonel.it

    radiocolonel.it New Member

    Joined:
    Jan 16, 2005
    Messages:
    192
    Likes Received:
    0
    Trophy Points:
    0
    Thanks! I'll correct my code now!

    I uploaded the last version of the programming guide on my site so u can download it:

    http://www.radiocolonel.it/kx/KX_Programming.html
     
  19. Russ

    Russ Well-Known Member

    Joined:
    Jan 17, 2005
    Messages:
    5,722
    Likes Received:
    13
    Trophy Points:
    48
    No problem, glad I could be of some help.
    As for the guide, I do not currently need it (I probably even have a copy of it here somehwere myself), I was just wondering what happened to it. In any case, I am glad that it is still available from your sight.
     
  20. Tiger M

    Tiger M kX user

    Joined:
    Apr 14, 2004
    Messages:
    851
    Likes Received:
    0
    Trophy Points:
    0
    The code is good, it works nice, the problem is that you can never get a perfectly smooth curve with using log and exp in any situation (division,roots etc.), so it's better to do things the traditional way.
     

Share This Page

visited