Quantcast
Channel: Processors
Viewing all articles
Browse latest Browse all 124377

Forum Post: RE: mcasp: how to attenuate audio without signal distortion

$
0
0

Thanks for answers,

the problem was in typecasting. When I overtyped input sample into "short" and output sample into "short" too, the attenuation was started to work. I thought I could use  int x,y instead of "float" and could write y direct into txbuffer without overtyping into "short". This works only for direct write back from rxbuffer to txbuffer without processing. There is a working code.

            int i;
            float x,y;

            for(i=0; i<AUDIO_BUF_SIZE/4; i++){
                if(i % 2 == 0){
                    x = (short)*((int *)rxBufPtr[lastFullRxBuf] + i);
                    y = 0.5 * x;
                    *((int *)txBufPtr[lastSentTxBuf] + i) = (short) y;
                }else{
                    x = *((int *)rxBufPtr[lastFullRxBuf] + i);
                    y = x;
                    *((int *)txBufPtr[lastSentTxBuf] + i) = (int) y;
                }
            }


Viewing all articles
Browse latest Browse all 124377

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>