CE121L - Microprocessor System Design
Final Project
March 3-17, 1997
The basic project is to build a keyboard controlled synthesizer.
The following features are required:
- Keyboard (PC) control of output sound. Each note has a
corresponding key. Pressing a key will change the output waveform.
Implement at least a two octave scale (see the handout on the
frequencies of notes). Rudimentary volume control should be available
as well, as well as prompts so that people other than the designer can
use the equipment (this is a common problem in commercial products).
- Algorithmic generation of waves. Calculate the value of the
sine function between a set of equally spaced points (e.g., 0 to
in steps of ). Insert the data into your
EEPROM program.
Suppose you store a single sine wave in 1024 consecutive memory
locations and you send data to the DAC at 10KHz (every 100 s).
Incrementing your table index (mod 2048) by 200 each time unit will
yield a period of s, or f=978kHz,
a flat . Incrementing by one each time step will yield
f=4.88Hz. Incrementing by 90 will approximate (439.4Hz
rather than 440Hz). Increasing the size of the table, or perhaps
more importantly, improving the algorithm, will enable more accurate
tuning. If you have a sufficiently accurate algorithm, 64 or fewer
sample points can produce excellent results.
To send samples at 10KHz, you can either use timer interrupts or
or a carefully tune a busy loop.
In addition, implement at least two special features. Some ideas
include:
- Multiple outputs. If two keys have been pressed, sum their
waveforms and send to the DAC, possibly decreasing the amplitude of
one.
- RAM wave table definitions. Generate some waveforms on the PC
and download them to your system. This will enable quick
experimentation with different signals. It may require writing a PC
program to monitor keyboard commands and send data out the PC's serial
port as required.
- Sampling synthesizer. Check out some extra memory and use the
ADC to sample waveforms (you'll have to hook up a microphone as well).
- Harmonics. Harmonics are integral multiples of the base
frequency. Add in even and odd harmonics at different attenuations
(reductions in amplitude). Various combinations of harmonics can
simulate different sounds (see attached sheets), though the higher
harmonics will not reproduce well in this system. You could allocate
additional space in RAM or ROM for these wave tables and generate them
on the PC.
- Envelopes. Waves can be enveloped by either multiplying two
waves or adding two waves of slightly different frequency.
The envelope frequency of adding two waves will be . This will produce a tremolo effect: periodic variation of the
volume of a sound.
- Vibrato is a periodic variation of frequency. This could be
implemented as a difference equation. In addition to stepping your
wave table index, cycle through small variations, positive and
negative, in the size of your table stride.
- Other waveforms (triangular, saw tooth, and so on).
- Keyboard control to initiate the reading of a waveform from the
A/D.
- Piano keyboard. We have an electric keyboard sitting around
in lab. It's been used in the past, as have MIDI keyboards.
Perform a timing analysis on your special feature code to ensure you
can perform all your calculations before the next write to the DAC.
You may wish to use timer interrupts to ensure everything runs at
speed. Timing is not critical for the keyboard I/O side of the
program.
Additional information on the physics of music can be found in the
ML3805 section in the basement of McHenry Library.
The projects will be demonstrated to the class during the last class
period. You may wish to have a tune ready to play on your
synthesizer.
The final report format is discussed in the first laboratory handout.
There is a lot of flexibility to this project. Be sure to design the
user interface, code, and functions logically and to document them
thoroughly.
The final report can be handed in on the last day of class.
Alternatively, you can hand it in at my office or the board office by
5:00pm on Wednesday, March 19. Late reports will not be accepted.
CE121 -- Microprocessor System Design
Assignment 8
Out: February 26, 1997
Due: March 5, 1997
- (10 points) Trig identity refresher. Prove that when two sine
waves of approximately the same frequency and of the same amplitude
are added, the resulting waveform has a frequency of (F1 + F2)/2
with an envelope frequency of (F1 - F2)/2.
- (80 points) Suppose that one sine waves is stored in 4096 memory
locations and values are sent to the DAC at 10kHz.
That is,
. The digitalization error
is at most 0.391% ( ) per sample, but will average out
and not affect the frequency.
- (10) What are the minimum and maximum representable frequencies?
Assume that there must be four samples per wave period for a reasonable
output waveform, and that indexes to the table are performed as
M[0], , ..., or in general, , for .
- (15) What is the formula for picking a constant stride in terms of the
desired frequency?
- (15) Calculate the best stride for each `C' within the frequency
range. What is the percent error for each? What notes are the result?
- (20) How could you generate these notes more accurately, and what are
the advantages of your solution over alternative possibilities? Give
some thought to this question -- there are many correct answers.
- (20) What are the parameters for your method for producing a (pick
one) two-octave scale in the C -C range? How accurate are the
frequencies in comparison to the equitempered scale?
Richard Hughey
Thu Feb 20 11:43:03 PST 1997