- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to take an inputted Audio file and trying to save it to the SDRAM (ie recording a word said into a microphone to the memory).
My system uses a DE2 board with a Nios II Processor and Quartus 7.2 software. The Nios II system uses the University program's audio codec IP cores. I have created a C program using the functions provided by the audio core (found on the Altera website), but am having trouble saving an audio stream to the memory and then playing it back. Below is my code and any help you could provide would be greatly appreciated. Thanks, Mel # include <Z:\try3\app_software\include\alt_up_audio.h> # define Switch (volatile char *) 0x01001020 # define MAX_DATA 4096 int main() { unsigned len[2000]; alt_u32 audiobuf[128]; //audio buffer alt_u32 audiostream[MAX_DATA]; //for audio storage unsigned index= 0; int ii,jj,NUM=0; // Switch 0 should be off for playback alt_up_audio_reset_audio_core(); //initiating the Audio Core while(1){ if ((*Switch) & 0x01){ // if Switch 0 is on, read data in through microphone len[NUM] = alt_up_audio_read_left_channel(audiobuf,128); //array of lengths stored for playback if((index + len[NUM]) < MAX_DATA){ // check for data overflow for(ii = 0; ii < len[NUM]; ii++){ audiostream[ii+index] = audiobuf[ii]; //saving all the data to an array for playback } index = index+len[NUM++]; } } else if((*Switch) & 0x02){ // if Switch 2 is on, playback data to line-out index = 0; for (jj = 0; jj < NUM; jj++){ alt_up_audio_write_left_channel(audiostream+index,len[jj]); alt_up_audio_write_right_channel(audiostream+index,len[jj]); index=index+len[jj]; } NUM = 0; } } }Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anyone Can Help Me To Find Tutorial For C/c++ Nios Language.
I Can't Interface My Accelerator To Avalon Bus; Because I Dont Know The Instructions To Access In Different Bus . I Wait Your Help .
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page