Altera_Forum
Honored Contributor
10 years agoI get a big noise when I echo the audio data from microphone
I designed a audio system in Qsys. I read the fifo data from the microphone input and write it to the audio write fifo. Although I can hear the microphone echo, it also generate a very big noise. I can't figure out why it will generate so much noise. Dose anyone have any idea why it is happened? I am not sure the setting of the audio codec is correct or not. Another problem is that how can I generate the sound with specific frequency?
I think the design in Qsys is correct. I generate the correct clock frequency to the audio and av_config core. I am using de2-115 board. I use these functions : alt_up_audio_read_fifo alt_up_audio_write_fifo Here is my c code to achieve the echo system.int main(){
alt_up_audio_dev * audio_dev = alt_up_audio_open_dev ("/dev/audio");
alt_up_av_config_dev* av_config_dev = alt_up_av_config_open_dev("/dev/audio_and_video_config");
/* used for audio record/playback */
unsigned int l_buf ;
unsigned int r_buf ;
// initialize the audio core
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x00, 0b000011000);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x01, 0b000011000);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x02, 0b000111100);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x03, 0b000111100);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x04, 0b000010100);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x05, 0b000000110);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x06, 0b000000000);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x07, 0b001001101);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x08, 0b000000000);
alt_up_av_config_write_audio_cfg_register(av_config_dev, 0x09, 0b000000001);
while(1)
{
// read audio buffer
alt_up_audio_read_fifo (audio_dev, &(r_buf), 80, ALT_UP_AUDIO_RIGHT);
alt_up_audio_read_fifo (audio_dev, &(l_buf), 80, ALT_UP_AUDIO_LEFT);
// write audio buffer
alt_up_audio_write_fifo (audio_dev, &(r_buf), 80, ALT_UP_AUDIO_RIGHT);
alt_up_audio_write_fifo (audio_dev, &(l_buf), 80, ALT_UP_AUDIO_LEFT);
}
}
}