 ******************** (C) COPYRIGHT 2011 NXPSemiconductors *******************
 * @file    Readme.txt 
 * @author  CT-PIM/NXP
 * @version 1.1
 * @date    
 * @brief   Description of the LPC17xx Speex Vocoder example for LPCXpresso
 *          using code_red RDB1768 board.
 ******************************************************************************
 * Software that is described herein is for illustrative purposes only
 * which provides customers with programming information regarding the
 * products. This software is supplied "AS IS" without any warranties.
 * NXP Semiconductors assumes no responsibility or liability for the
 * use of the software, conveys no license or title under any patent,
 * copyright, or mask work right to the product. NXP Semiconductors
 * reserves the right to make changes in the software without
 * notification. NXP Semiconductors also make no representation or
 * warranty that such application will be suitable for the specified
 * use without further testing or modification.
 ******************************************************************************
  
@Example description:
	Purpose:
		This example describes how to use the libspeex to encode voice, save the encoded audio 
        in RAM, and play a recorded voice by decoding the saved data.
	Process:
        
		A microphone should be plugged into MIC input, and a headphone into HEADPHONE input.
		Due to a hardware bug, a patch on the RDB1768 board is required to get a proper signal
		from the micropone. Please see AN11085, chapter 2.4.3 for more details on this.
		
		The LPC1768 uses the I2C bus to configure the Audio CODEC UDA1380 (RDB1768v2). It uses 
		the I2S bus to transfer audio data between the CODEC and the microcontroller.

		LPC1768 I2C controller configuration:
			- 16kHz;
			- 16 bits
			- MONO;
			- TX master, RX master;

		By navigating in a interative menu user can choose two options: Record and Play. Because UP
		direction of the joystick is connected to I2SRX_CLK pin, only DOWN direction is used to 
		toggle the selected option in menu.
		
		When user select "Record" and push CENTER button in joystick the recording process is started.
		
		Within I2S interrupt handler 16 bit audio samples are captured from RXFIFO and sored into the 
		current IN_Buffer. Everytime a IN_Buffer is completed (frame with 160 samples) it is enabled for 
		encoding and I2S routine begins using the other IN_Buffer. Encoded frames are saved into RAM.
		Recording process ends when a 6 seconds audio stream is captured.
		
		When user select "Play" and push CENTER button in joystick the playback process is started.
		
		There's a loop where speex decoder works during the playback process. Inside this loop 
		a new speex frame is loaded from RAM, decoded, and stored in a OUT_Buffer, which is now 
		available for output.
		For the audio output process, TIMER0 is configured in such way that an interrupt is generated 
		every 125us. So, within TIMER0 Interrupt handler a new sample from the last decoded audio 
		frame is send I2S trasnmitter.

	Build and test enviroment:
		This application was built using LPCXpresso v3.6.3_317
                Hardware: code_red RDB1768v2.
                
@How to run:
	Hardware configuration:		
		This example was tested on:
			Code_Red RDB1768v2 board:
	
	Running mode:
		This example can run on Debug/Release mode.
					
	Step to run:
		- Step 1: Build example.
		- Step 2: Start Debug
		- Step 3: Connect a microphone and a headphone to the board.
		- Step 4: Run example
				  *Voice record:
				  	- Choose "Record" option in App menu:
				  		Say something into the microphone during 6 seconds.
				  *Voice playback:
				  	- Choose "play" option in App menu:
				  		You can hear the last recorded audio sample coming out of the headphone.

