ECE 3551 – Microcomputer Systems 1 Fall 2010 Siobhan Ireland Overview of Project Generating Musical Notes Filtering Audio Input Improvements Conclusion The initial idea for my project was to use the BF533 EZ-Kit Lite board to create an electronic vocal coach This project could have real world application in helping people train their vocal ability I implemented the project by splitting it into two parts: generating musical notes, and filtering audio input I calculated note frequencies over a range of four octaves and from each octave chose one note – corresponding with the four push buttons The frequencies were found using the equation: Frequency 440 2 n 12 Hz The algorithm for generating the notes is: f0 xn A sin 2 n A sin 2F0 n A sin 0 n f s Which in code translated to: y = 7*x*sinf[w0*n] if(note==1) //note C3 { n %= 367;//nmax y=7*x*sinf(0.01712335 *n); y0=(int)(y); //send output to left and right audio channels iChannel0LeftOut=y0; iChannel0RightOut=y0; } I had a few difficulties getting the code working Once working I tested various values for amplitude The code for generating musical notes was successful Push Push Push Push Demonstration button button button button PF8 = note C3 PF9 = note D4 PF10 = note F5 PF11 = note A6 The initial purpose for this section of the code was to accept user input in the form of singing and analyze which octave the frequency lies in I chose first to test the code using input in the form of a song from my I-pod The filter values were chosen based on the calculated octave frequency values The algorithm for IIR filters is: b0 b1 z 1 b2 z 2 H z 1 a1 z 1 a 2 z 2 d m xm a 2 d m 2 a1 d m 1 ym b2 d m 2 b1 d m 1 b0 d m The filters were created using MATLAB fdatool IIR filters were chosen over FIR filters because they have less coefficients and produce clearer, crisper filtering The c code for the IIR filters is given below: void low_lowpass_filter(void) { int i = 0; //reset loop (row) counter //set input equal to iChannel0LeftIn shifted by 8 //iChannel0LeftIn>>8 shifts the original audio from 24 bits to 16 bits x_input = iChannel0LeftIn<<8; for(i=0; i<13; i++) //for row 0 to row 13 { //implementation of algorithm //calculate input from d[m] = x[m]-a2d[m-2]-a1d[m-1] D_low[i][0] = x_input - (low_lowpassA[i][2]*D_low[i][2]) - (low_lowpassA[i][1]*D_low[i][1]); //calculate output from y[m] = b2d[m-2]+b1d[m-1]+b0d[m] y = (low_lowpassB[i][0]*D_low[i][0]) + (low_lowpassB[i][1]*D_low[i][1]) + (low_lowpassB[i][2]*D_low[i][2]); x_input = y; //set x_input to previous value of y D_low[i][2] = D_low[i][1]; //shift values stored in array D_low[i][1] = D_low[i][0]; //shift values stored in array } //shift value of y (typecast as int) by 8 bits from 32 bits to 24 bits //send output to left and right output channels iChannel0LeftOut=(((int)y)>>8); iChannel0RightOut=(((int)y)>>8); } Initially I applied band-pass IIR filters with frequencies corresponding to the octaves. There was no audible change to the input Next I applied band-pass IIR filters with large frequency ranges. There was still no audible change I then switched to low and high-pass IIR filters with original frequency values. Still no change was heard Lastly I applied low and high-pass IIR filters with large frequency ranges. They successfully altered the audio input There was no point at this stage of development to add a microphone, as the filters wouldn’t work as originally planned No button, - LED 9 - original audio PF8 pressed - LED 4 - low range filter PF9 pressed - LED 5 -low-mid range filter PF10 pressed - LED 6 - high-mid range filter PF11 pressed - LED 7 - high range filter Demonstration Lab access Equipment access Improve filters Add microphone Design user feedback Combine codes Eventually extend number of notes played Overall I consider the project successful The project utilized and built upon knowledge gained through lecture and lab Generating musical notes was new to me and was implemented successfully Filtering audio was adapted from lab work and while it works correctly, it needs further development to work as originally planned