-
Notifications
You must be signed in to change notification settings - Fork 1
Home
The goal for this project was to create a simple audio module that could take input from Audio CODEC on the FPGA and apply interesting filters to it before sending it to the output. This project was created using a DE2-115 FPGA, Audio played from my computer and streamed to the FPGA using an AUX cord, and a pair of wired headphones plugged into the line out port of the FPGA.
The audio module includes highpass and lowpass filters as well as an attempt at an echo filter. The project works with the Wolfson WM8731 Audio CODEC on the FPGA for converting the Analog input signal to digital, processing it, and converting it back to analog for outputting the resulting signal. The project includes an FSM for communicating with the ADC and DAC of the Audio CODEC which uses the I2C communication protocol for sending and receiving the audio signals.
The Audio Chip first needs to be initialized with some settings this is done by selecting different registers and storing values in them. A table of the different registers and their options can be found in the Manual. In order to load these settings onto the registers we must use I2C to communicate with the Audio Chip.
The Digital signal that goes into the ADC gets sampled at what is called a "sampling rate." The value of each of these samples is the information that we are reading from the ADC. We are reading a 32-bit signed integer from the ADC, but we only get sent one bit at a time on the AUD_ADCDAT wire. So, we need to keep a counter for the number of bits from the 32 that are left to be received and we store the value from current bit into a bus of temporary data. Then once all the bits are ready we can send the full Audio Sample onto the top level module where it can be sent through the filters.
The filters are easily applied by the use of modules. The modules for the filters are created and instantiated in the top level module. Then the Audio sample from the ADC is set as the input and we use a temporary bus to store the result of the filter. Then we just have a simple case statement where, based on some switches, we select which of the outputs from the filters get redirected to the AudioDAC module for output.
The DAC works very similar to the ADC. We have a 32-bit signed integer that we need to send across the AUD_DACDAT wire. This wire is only one bit wide so we have to send one bit of the 32-bit word each clock cycle until they are all sent. This is done using another counter that keeps track of the bits that have been sent. Then a done signal is sent once the entire sample has been sent back through the DAC.
This project was fairly successful. The highpass and lowpass filters seemed to work well, and the audio_module can be used to stream audio from the in line port of the DE2-115 FPGA to the out line port. The echo filter did have an effect on the audio that was output, so I believe I was on the right track. The echo filter only seemed to increase the volume of the output leaving me to believe that I was not holding onto the sample long enough for an echo to be distinguishable from the audio that was played once clock cycle earlier. I believe that giving more of a pause between when the old input is fed back in would have created a more recognizable effect.