FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5234 Discussions

DE2-115 - MP3 decoding from Flash with libMAD - searching examples

Altera_Forum
Honored Contributor II
1,002 Views

Hello Alteraforum, 

 

I am searching for help, with the libMAD, because it drives me mad. :) I am working on an easy example to decode a MP3-file from flash, decode it into sram and output the PCM from there. 

 

I have verified, that the output is working. So when I read an PCM (16bit, 44.1kHz) from the flash and output it, it plays nice. I then tried to write and read from sram, no problem. I then tried the same with a MP3 and libMAD. As codebase I tried to adept the minimad.c example, but I do not get it working and I even can't really determine where the error occurs. There is audio output, but just plain noise. 

 

Has someone here an easy example for the DE2-Family that he would share with me, where you decode an MP3 with libMAD and use the Wolfson to output the data?  

 

(please don't refer to the Neek-Example, because there they do so much more to output the id-tags and read the files, I have looked quite deep into that example already). 

 

I think my problem lies somewhere in the scale function or I get mixed up with the endians. 

 

Any example code would be really appreciated. 

 

Yours, Peter.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
131 Views

Ok, I got it running now. The problem was the output method of the minimad.c example. I have now written some new code for it, see below. 

 

//j is a global variable, that i use to count the length of the pcm. //I use it to output from the sram in another method while (nsamples--) { unsigned int sample; //i am sure, that i only decode stereo, so I don't check nsamples == 2 unsigned int audioausgabe = 0; //sample = scale(*left_ch++); sample = (*left_ch++); audioausgabe = sample&0xFFFF; audioausgabe = audioausgabe << 16; //sample = scale(*right_ch++); sample = (*right_ch++); audioausgabe = audioausgabe|(sample & 0xFFFF); //write to sram the resulting 32bit word IOWR(SRAM_BASE,j,audioausgabe); j++; }
Altera_Forum
Honored Contributor II
131 Views

Could you provide me with the working project? 

 

Jeff Goeders 

jeffrey.goeders (GMAIL)
Reply