Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

NIOSII for Sound Recording

Altera_Forum
Honored Contributor II
2,003 Views

Hi, 

 

I am an amateur to NIOSII and have very thin knowledge with this features. 

 

Hereby wish to have yours advise how can i start to develop a sound recording and play back system with NIOSII. 

 

I wish to develop an embedded system that use for sound data analysis with Altera DE2. Microphone is attached to Mic port and the RS-232 is connected to laptop.  

 

Other than that, i also wish to ask is it a better choice of using NIOSII rather than Verilog HDL for same purpose? Would it be hard to write the FFT code with Verilog HDL as i know that NIOSII work with C programming. 

Do i need license to implement the NIOSII design on my board? 

 

I do appreciate with more reference or link is provided for me to start the design work. 

 

Many thanks!
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
880 Views

You can use the web edition to develop a Nios II system and just tether it over JTAG when you download to the board. If you were going to ship what you are working on then yes you would need to get a Nios II license. 

 

FFT is a fairly computational algorithm so you might find writing that in C will work for the line rate you need. If I was implementing this I would probably use Nios II for the control plane and use dedicated hardware for the FFT and DMAs to move data around. Here is an example MP3 player that you can take a look at: 

 

http://www.alterawiki.com/wiki/mp3_player
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Thank you for your reply.  

 

So if i m not going to ship my work (I am just work it for academic purpose, my lab project) , i don't need a license to work the NIOS II on my board? I can straightly do the design on my board with NIOSII? The board i have with me is belongs to my university lab. 

 

Thank you for your reference. I have refereed it and it is a cyclone III. May i know any other reference that work the same application on cyclone II DE2?  

 

 

 

Please advise again! 

 

Many thanks. :)
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Other than that, may i know what do you mean by dedicated hardware for FFT? I was planning to work out the FFT function on a single board (The altera DE2).  

 

Other than that, I noticed altera is DSP builder. May i know how can i intergrate the DSP builder's FFT in the C code? Actually i have done with my simulation and my FFT algorithm with MATLAB. Now is going to wok out the thing on FPGA with the purpose to make the system independent from PC processor.  

 

Please advise how can i work out the thing. Thanks again
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

I have refereed to this ftp://ftp.altera.com/up/pub/altera_material/qii_9.1/computer_organization/de2/laboratory_exercises/set2/lab8.pdf 

 

noticed that altera DE2 can work out sound recording and playback. But i have no idea how to get the basic reference (like the pin assignment and basic protocol configuration) to start the project.
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Sorry my knowledge is very limited for the DE2 board so I'm not sure what you should do. Since this is part of a lab project you don't need a license (if your school is using Altera devices they may have the license though). If not basically the way it works is that most Altera IP is free to use for academic and experimental usage, and under such a license you just have to have the JTAG connection present if you want to use the design in actual hardware for demonstration purposes. 

 

As for the FFT algorithm my only experience is implementing it in C code on TI parts and using C code with C2H: 

 

http://www.altera.com/literature/tt/tt_nios2_c2h_accelerating_tutorial.pdf 

http://www.altera.com/literature/tt/c2h_tutorial.zip 

 

it's a pretty standard algorithm so you'll probably find many implementations of it in hardware as well as altera providing it as a megafunction that you parametrize as well. 

0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Also somewhere else in this forum someone was asking about implementing the FFT algorithm in software on Nios II or in dedicated hardware, if you search for it you'll probably find it. I barely remember DSP from school but to me FFT means 2 multiplies and 2 additional/subtractions per input pair using the basic radix 2 algorithm. So per input there is a lot of software calculations going on which is why most people use DSPs and/or dedicated hardware for this sort of thing. 

 

If I was implementing FFT under high bandwidth requirements I would use an FFT with Avalon streaming inputs and outputs and use DMAs that can transfer between memory-mapped and streaming to shovel data in and out of the dedicated FFT hardware. This might be overkill for what you need to implement so consider this the extreme end of the spectrum between all C code and highly parallelized hardware :)
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Thank you for your reference and replies. 

 

So says that if i am going to capture sound from mic then store the sampled sound data to memory, which part of the memory (Flash/SDRAM/SRAM) tat i should use? 

 

And is it correct if i fetch the data from the memory then proceed for FFT using C programming? I have gone through the reference link. may i know where can i get the C code in the example so that i can have a practice b4 i seek for advise again? 

 

It would be great for other reference that shows the way to record sound using NIOSII on DE2.. 

 

Many thanks!
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Sorry... i just noticed the .zip file from u.. So i will try to run the example 1st... Hopefully can get myself more understand with the flow of NIOSII. 

 

Anyway... i still hope to have your advise how can i deal with the audio recording as mentioned. 

 

Thanks again!
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

I would skip the mp3 part of the software since it's probably highly optimized but the general organization of the system should give you an idea of what to do. In a nutshell for what you are doing I think something like this will work: 

 

ADC --> DMA --> RAM --> DMA --> FFT (and other streaming stuff...) --> DMA --> RAM --> whatever you are going to do with the data 

 

This might be overkill but this is how I would keep Nios II out of the data movement path and use it just to control everything.
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

I have tried a simple NIOSII example. Can i know where i can get the C program that used for sound recording? Since NIOSII operates with C program, is it possible to implement the ordinary sound recording source code? 

 

DMA is it a temporary buffer that store the data? But how can i implement the DMA? My Altera DE2 has only SDRAM, SRAM, Flash Memory. 

 

Actually where can i get relevant reference? As i wish to study more 1st and experiment more b4 i get advise again. Currently i m still blur how to implement sound recording with NIOSII. 

 

Thank you.
0 Kudos
Altera_Forum
Honored Contributor II
880 Views

Hi, 

 

It has been a long time.  

 

But i tried to switch my project orientation as below. wish to have you advise again.  

 

I found that the DE2 has a demonstration, Karaok Machine... I m thinking to retrieve the sampled sound signal but i have no idea which of the variable indicated the sound data. 

 

I hope u have heard bout this demo program. As i m still desperate on getting the sound data for further analysis. 

 

Then, at the same time... i have done my algorithm in MATLAB simulink... Is it possible is put my Simulink in De2? The input of my simulink would be the retrieved sound data...  

 

Hope to have your advise again.
0 Kudos
Reply