High Level Design

Program/Hardware Design



Appendix A: Code

Appendix B: Schematics

Appendix C: Parts Listing 

Appendix D: Specific Tasks




Xuemin Hang:

Marcel Xu:






The synthesizer (MCU1) outputs an audio signal immediately when a note is played. There is no detectable time delay between the keyboard press and the sound generation.  Similarly, the video generator (MCU2) displays the corresponding note on the television screen with no visible delay.

The operation of both the PC interface and the music keyboard interface are fully concurrent, i.e., the keyboard operates normally even when the instrument to be played is being selected at the PC interface.

Initially, we had the occasional problem of video artifacts appearing when we played too many notes at once. This is due to the once-per-frame calculations spilling over to the next frame. Therefore, we reduced our code to limit the TV display to show chords of up to 2 notes only, so that artifacts would no longer appear. 



The synthesized music frequencies were measured using the oscilloscope and compared with the theoretical music frequencies. The theoretical frequency resolution, for the 24-bit accumulator and 40-cycle loop, is (16 MHz/40)/(2^24) = 0.02 Hz. We should thus be able to achieve frequencies within 0.02 Hz of the ideal.

The measured frequencies and their theoretical values are shown in the following table:

Measured Frequencies

Theoretical Frequencies

493.883 Hz

494 Hz

466.164 Hz

467 Hz

440 Hz

441 Hz

415.305 Hz

416 Hz

391.995 Hz

390 Hz

369.994 Hz

370 Hz

349.228 Hz

350 Hz

329.628 Hz

328 Hz

311.127 Hz

310 Hz

293.665 Hz

 294 Hz

277.183 Hz

 277 Hz

261.626 Hz

 262 Hz

246.942 Hz

 247 Hz

233.082 Hz

 233 Hz

220 Hz

 220 Hz

207.652 Hz

208 Hz

195.998 Hz

196 Hz

184.997 Hz

 185 Hz

174.614 Hz

 175 Hz

164.814 Hz

165 Hz


147 Hz

130.813 Hz

131 Hz


Clearly, in the above table, the discrepancy between the actual and desired frequency varies between 0.2 Hz and 1 Hz (>> 0.02Hz !). To the ear, however, such differences are insignificant. Our frequency accuracies are thus acceptable.   

The video signal timing was precise and accurate. Thus, there is absolutely no problem with the TV screen refresh.


How We Enforced Safety in the Design

As we were using power from the mains, we had to make sure that we were doing everything on the ESD mat just in case charges build up somewhere.

We made a cover for the keyboard (as shown in the pictures) so that the player would not come into contact with any of the wires.

We connected the ground of both MEGA32 chips together on the keyboard so that there would not be a mismatch in ground potentials.


Interference with Other Peopleís Designs

There was no direct interference with other peopleís designs, but our interference concern in this project was that our audio output might disturb those working around us. Thus, we tried to keep the volume down whenever possible.


Usability of our Project

The video portion of the project was built based on the idea of interactive learning. To cater to people of all ages learning music, the music stave and notes are drawn large and clear so that they may be easily recognizable. The menu options are also simple and controlled with only 2 pushbuttons, YY and XX. The menu options are also displayed on screen in the Music Notes display mode. In addition, detailed instructions for the pushbuttons and HyperTerm menu functions are also written clearly on the project setup cover for the userís easy reference. The video portion of our design is thus quite user friendly.

However, because our keyboard is small compared to the ones on the market, people with broader fingers may find it difficult to play running notes on the keyboard.