Description
In this lab, you will combine the low-level ARM programming techniques you have acquired in the course by
implementing a musical synthesizer (or “synth”).
1 Make Waves
We are providing you with drivers for writing to the audio codec, as well as a “.s” file with a wavetable
containing one period of a 1 Hz sine wave at a sampling frequency of 48000 Hz.
To play a note with frequency f using the wavetable, generate a signal using the following equations for
every sampling instant t:
index = (f ∗ t) mod 48000,
signal[t] = amplitude ∗ table[index].
If more than one note is played at the same time, compute the sample for each note and add them
together. If the index is not an integer, you can calculate table[index] by linear interpolation using the two
nearest samples. For example, table[10.73] := (1-0.73)*table[10] + 0.73*table[11].
You should write a function which takes as input f and t and returns signal[t]. Use a timer to feed the
generated samples to the audio codec periodically.
2 Control Waves
It should be possible for the user to play the synth using a PS/2 keyboard. Table 1 shows the notes your
synth should play, the key of the PS/2 keyboard each note should map to, and the frequency of the note in
Hz. You should also implement a volume control with the keyboard so that the user can turn the volume
(amplitude) up or down. This is the minimum functionality you must implement; you can also implement
other notes and features, such as different voices.
3 Display Waves
In addition to playing the waveform, you should display the waveform on the lab computer monitor, as in
Figure 1.
1
Table 1: Note Mapping
Note Key Frequency
C A 130.813 Hz
D S 146.832 Hz
E D 164.814 Hz
F F 174.614 Hz
G J 195.998 Hz
A K 220.000 Hz
B L 246.942 Hz
C ; 261.626 Hz
Figure 1: Waveform display for a single note
4 Presentation
Prepare a 10-minute presentation for the TAs and course instructor describing your synth, its software architecture, the problems you encountered during the design process, and the solutions you developed for those
problems.
5 Grading
You will be evaluated according to the following criteria:
• Audio sounds correct (12.5%)
• Note control works (12.5%)
• Volume control works (12.5%)
• Display works (12.5%)
• Does the code follow good software development principles (style, efficiency, clear commenting, appropriate use of source files, code reuse, etc.)? (25%)
• Presentation quality (25%)
The final date for demoing and submitting the final report is on the last day of classes, 16th April 2018.
A demo timetable and guidelines for submitting the report will be posted on MyCourses.
2