Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Honored Contributor I
698 Views

Audio IP Core Help

I am in the process of attempting to use the Audio IP Core to take input from the Mic, and then output it the Line out. 

 

I have created a system in the SOPC builder with the following components: 

cpu_0 

onchip_memory2_0 

PIO(Input) 

PIO(Output) 

audio_and_video_config_0 

audio_0 

 

For the audio_and_video_config_0, I've set it to initialize both Audio and Video. I've set the In path to Microphone to ADC, and Out to enable DAC. 

 

This will build without error. 

 

I have the following C application to run on this system just to verify the Audio I/O is working. 

# include <system.h># include <altera_up_avalon_audio.h> 

# define Switches (volatile char *) SWITCHES_BASE# define LEDs (char *) LEDS_BASE 

# define BUFFER_SIZE 512 

 

void increaseGain(unsigned int *buffer, unsigned length); 

 

int main() 

alt_up_audio_dev * audioDev = 0; 

unsigned int buffer[BUFFER_SIZE]; 

unsigned length = (BUFFER_SIZE/2); 

int readData = 0; 

 

//Open the Audio device 

audioDev = alt_up_audio_open_dev(AUDIO_0_NAME); 

 

//reset the Audio Device 

alt_up_audio_reset_audio_core(audioDev); 

 

while (1) 

*LEDs = *Switches; 

 

readData = alt_up_audio_read_fifo(audioDev, buffer, length, ALT_UP_AUDIO_LEFT); 

alt_up_audio_write_fifo(audioDev, buffer, readData, ALT_UP_AUDIO_LEFT);  

 

readData = alt_up_audio_read_fifo(audioDev, buffer, length, ALT_UP_AUDIO_RIGHT); 

alt_up_audio_write_fifo(audioDev, buffer, readData, ALT_UP_AUDIO_RIGHT); 

 

}  

 

return 0; 

 

Right now when I download my image, the mic in, is automatically playing out the Line out, however it's very quiet and distorted. 

 

Any assistance is appreciated.
0 Kudos
1 Reply
Highlighted
Honored Contributor I
5 Views

hi! 

i m sorry i cannot answer your question, but can i thinku can help me as i m working on a similar project... 

where should i copy the header file to avoid the long include statement like "c:\dir1\dir2\include\altera_up_avalon_audio.h

or is it possible to do the same in NIOS2 IDE somehow?
0 Kudos