Hi there,I have been tinkering with the media.c example using the DE2 Media Computer through the Altera Monitor Program, and I was wondering about the speech input and how it is stored. I see that it is stored in the left and right buffers in the audio core through the following code: left_buffer[buffer_index] = *(audio_ptr + 2); right_buffer[buffer_index] = *(audio_ptr + 3); ++buffer_index; This example deals with simply playing back the recorded speech. Is there any way I can manipulate this data before it is played back? Save it to other memory? Possible save it in the .WAV format? I'm relatively new to this, so I'm curious as to what can be done with this recorded speech. Thanks
Well, I guess there are endless possibilities :)You could write the data to SRAM/SDRAM/FLASH, transmit it over a TCP/IP socket connection, save it to a .WAV file on an SD-card - lots of different ways to manipulate it. Since the data is in digital format, you could write C/C++ functions to perform DSP or even use RTL functions written in VHDL/Verilog to peform on-the-fly signal processing. With Speech, you can even venture into the real-time of basic voice recognition and vocal matching. I have attached a couple of links below you may find interesting. Audio-related projects on the DE2, mostly done by university students (incl source code): VOIP (Voice Over IP Phone using DE2 BoarD) http://www1.cs.columbia.edu/~sedwards/classes/2009/4840/reports/voip.pdf http://www1.cs.columbia.edu/~sedwards/classes/2009/4840/reports/voip.tar.gz Internet-based Music Player (DE2 Board) http://www1.cs.columbia.edu/~sedwards/classes/2009/4840/reports/player-i.pdf http://www1.cs.columbia.edu/~sedwards/classes/2009/4840/reports/player-i.tar.gz
Can I write the data from the buffers into SRAM within the C code provided by the Media Computer? Can I do the transmission (over TCP/IP like you said) within the C code as well?Thanks!
Haven't actually used the DE2 Media Computer example myself before, but in the case of a normal project in which you create the SOPC system, you would simply create your Nios CPU, SRAM controller first in SOPC builder. Then...when you create a new app and board-support package (BSP) in Nios II build tools, the IDE will automatically create a BSP to support your desired hardware incl a HAL driver to enable read/write operations to the SRAM in your C code.To transmit data over TCP/IP, you'll need to use Nichestack provided by Altera (as your best option). Alternatively, for simple communications using the UDP protocol, BTXSistemas (another forum user) has some good code based on the DE2_NET example provided by Terrasic. Check out my post on using Altera's socket server ref design on the DE2 board: http://www.alteraforum.com/forum/showthread.php?t=24020 And yes, all TCP/IP and socket comms are handled in C. In the case of the socket server example (provided by Altera), Nichestack is a C library which provides TCP/IP communications support on the Nios II platform. Nichestack requires the MicroC/OS-II RTOS provided by Altera to run - although everything is built into the ref design (included in Nios II build tools). Once everything is running, you can easily write and receive data over a socket using simple C commands such as send and recv. I have also developed a custom handshaking protocol which provides a basis for sending large quanitities of data over a socket ie. to a PC.