Attentate Echo >> ?

Store Forums Audio Hacker Discussion and Project Ideas Attentate Echo >> ?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13298
    finnwoodman
    Participant

    Hi everyone,

    in the echo example there is this line of code:

    echo = echo >> 1; // attenuate echo

    What does it mean? Does it attentuate the echo by bitshifting it?

    If so, how can I decrease the echo in smaller steps?

    Best, Max

    #13299
    Michael
    Keymaster

    Yes, it reduces the amplitude of the echo signal by half. Shifting to the right by one bit is division by 2. It’s the same as:

    echo = echo / 2;

    but faster.

    You can try reducing by a smaller amount, but it will require expensive math operations. If the math takes too long, the code doesn’t have enough time to run.

    Try dividing by 1.5:

    echo = ((echo >> 1) + echo) >> 1;

    This is the average of echo and echo/2, which is effectively echo/1.5. I’m not sure how many cycles this operation will take, so you might want to reduce your sample rate to give the loop more time.

    #13301
    finnwoodman
    Participant

    Thank you Michael. This works great for my needs. What does cycles in this context mean?

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.