Good morning,
I am currently trying to implement simple audio effects such as echo reverberation... When i run my program the audio output is really dirty. I am not sure why my code doesnt work.
My code :
#include "dsk6455.h"
#include "dsk6455_aic23.h"
/* Codec configuration settings */
DSK6455_AIC23_Config config = {
0x0117, // 0 DSK6455_AIC23_LEFTINVOL Left line input channel volume
0x0017, // 1 DSK6455_AIC23_RIGHTINVOL Right line input channel volume
0x00d8, // 2 DSK6455_AIC23_LEFTHPVOL Left channel headphone volume
0x00d8, // 3 DSK6455_AIC23_RIGHTHPVOL Right channel headphone volume
0x0011, // 4 DSK6455_AIC23_ANAPATH Analog audio path control
0x0001, // 5 DSK6455_AIC23_DIGPATH Digital audio path control
0x0000, // 6 DSK6455_AIC23_POWERDOWN Power down control
0x0043, // 7 DSK6455_AIC23_DIGIF Digital audio interface format
0x0081, // 8 DSK6455_AIC23_SAMPLERATE Sample rate control
0x0001 // 9 DSK6455_AIC23_DIGACT Digital interface activation
};
void main()
{
DSK6455_AIC23_CodecHandle hCodec;
Uint32 leftsample,x[2201], y=0;
Int16 i;
// initailize x with zeros
for(i=0;i<22000;i++)
x[i] =0
// initializes the board
DSK6455_init();
DSK6455_DIP_init();
/* Start the codec */
hCodec = DSK6455_AIC23_openCodec(0, &config);
DSK6455_AIC23_setFreq(hCodec,DSK6455_AIC23_FREQ_44KHZ); //set sampling frequency to 44Khz
while(1)
{
/* read a sample from the left channel */
while (!DSK6455_AIC23_read32(hCodec, &leftsample));
// 0.5s delay line
for(i=0;i<22000;i++)
x[i] = x[i-1];
x[0] = leftsample+y;
y = leftsample + x[22000] /2 ;
leftsample = y;
/* Send a sample to the left channel */
while (!DSK6455_AIC23_write32(hCodec, 2*leftsample));
}
/* Close the codec */
DSK6455_AIC23_closeCodec(hCodec);
}
For exemple when i replace the part in red with
for(i=0;i<5;i++)
x[i] = x[i-1];
x[0] = leftsample+y;
y = leftsample + x[5] /2 ;
leftsample = y;
i can hear the sound of music input with good quality. The more i increases the worst the audio output gets. So I thought that the DSP doesnt process fast enougth betweem to samples. The TMS320C6455 is 1Ghz fast. If this is the problem, how can I implement delay lines?
Thank you for your help
Regards
Samuel