Codec de Audio
Codec de Audio
The points in Figure 2 provide a sampled waveform. All points are spaced equally in time and they trace the
original waveform.
The Altera DE1 board is equipped with an audio CODEC capable of sampling sound from a microphone and
providing it as input to a circuit. By default, the CODEC provides 48000 samples per second, which is sufficient
to accurately represent audible sounds.
In this exercise you will create several designs that take input from an Audio CODEC on the Altera DE1
board, record and process the sound from a microphone, and play it back through the speakers. To simplify your
task, a simple system that can record and playback sounds on an Altera DE1 board is provided for you. The
system, shown in Figure 3, comprises a Clock Generator, an Audio CODEC Interface, and an Audio/Video
Configuration modules. This interface is a simplified version of the Altera University Program Audio IP Cores
you can find at http://university.altera.com.
I2C_SCLK
I2C_SDAT
Audio/Video
Configuration
CLOCK_50
read_ready
write_ready
read
write
readdata_left
readdata_right
writedata_left
writedata_right
AUD_BCLK
AUD_ADCLRCK
AUD_DACLRCK
AUD_ADCDAT
Audio
CODEC
Interface
AUD_DACDAT
Your Circuit
AUD_XCK
CLOCK_27
Clock Generator
Part I
In this part of the exercise, you are to make a simple modification to the provided circuit to pass the input from
the microphone to the speakers. You should take care to read data from and write data to the Audio CODEC
Interface only when its ready signals are asserted.
Compile your circuit and download it onto the Altera DE1 board. Connect microphone and speakers to the
Mic and Line Out ports of the DE1 board and speak to the microphone to hear your voice through the speakers.
After resetting the circuit, you should hear your own voice through the speakers when you talk to the microphone.
Part II
In this part, you will learn a basic signal processing technique known as filtering. Filtering is a process of adjusting
a signal - for example, removing noise. Noise in a sound waveform is represented by small, but frequent changes
to the amplitude of the signal. A simple logic circuit that achieves the task of noise-filtering is an averaging Finite
Impulse Response (FIR) filter. The schematic diagram of the filter is shown in Figure 4.
Data in
DQ
24
DQ
DQ
DQ
DQ
DQ
DQ
24
Data out
LIBRARY ieee;
USE ieee.std logic 1164.all;
USE ieee.std logic signed.all;
ENTITY noise generator IS
PORT ( CLOCK 50, read s
noise
END noise generator;
: IN
: OUT
STD LOGIC;
STD LOGIC VECTOR(23 DOWNTO 0));
24
Datain
Dataout
FIFO of size N
Accumulator
QD
*(-1)
24
Data out
sure the value in the accumulator is the average of the last N samples, the circuit subtracts the value that comes
out of the FIFO, which represents the (n + 1)th sample.
Implement, compule and download the circuit onto Altera DE1 board. Connect microphone and speakers to
the Mic and Line Out ports of the DE1 board and speak to the microphone to hear your voice through the speakers.
Experiment with different values of N to see what happens to your voice and any background noise, remembering
to divide the samples by appropriate value. We recommend experimenting with values of N that are a power of 2,
to make the division easier.
If you have a portable music player, with a connector such that you can supply input to your circuit through
the Mic port, try experimenting with different sizes of the filter and its effect on the song you play.
c
Copyright
2011
Altera Corporation.