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:

  1. 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).
  2. Algorithmic generation of waves. Calculate the value of the sine function between a set of equally spaced points (e.g., 0 to tex2html_wrap_inline107 in steps of tex2html_wrap_inline109 ). 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 tex2html_wrap_inline111 s). Incrementing your table index (mod 2048) by 200 each time unit will yield a period of tex2html_wrap_inline113 s, or f=978kHz, a flat tex2html_wrap_inline117 . Incrementing by one each time step will yield f=4.88Hz. Incrementing by 90 will approximate tex2html_wrap_inline121 (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:

  1. Multiple outputs. If two keys have been pressed, sum their waveforms and send to the DAC, possibly decreasing the amplitude of one.
  2. 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.
  3. Sampling synthesizer. Check out some extra memory and use the ADC to sample waveforms (you'll have to hook up a microphone as well).
  4. 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.
  5. 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 tex2html_wrap_inline123 . This will produce a tremolo effect: periodic variation of the volume of a sound.
  6. 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.
  7. Other waveforms (triangular, saw tooth, and so on).
  8. Keyboard control to initiate the reading of a waveform from the A/D.
  9. 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.

Report

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

  1. (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.
  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, tex2html_wrap_inline129 . The digitalization error is at most 0.391% ( tex2html_wrap_inline131 ) per sample, but will average out and not affect the frequency.

    1. (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], tex2html_wrap_inline135 , ..., or in general, tex2html_wrap_inline137 , for tex2html_wrap_inline139 .
    2. (15) What is the formula for picking a constant stride in terms of the desired frequency?
    3. (15) Calculate the best stride for each `C' within the frequency range. What is the percent error for each? What notes are the result?
    4. (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.
    5. (20) What are the parameters for your method for producing a (pick one) two-octave scale in the C tex2html_wrap_inline141 -C tex2html_wrap_inline143 range? How accurate are the frequencies in comparison to the equitempered scale?


Richard Hughey
Thu Feb 20 11:43:03 PST 1997