ECE 4760: Laboratory 2

Cricket Call Generator.


You will construct a cricket-call generator which will produce audio output of a simplified cricket call.
A cricket call may be very complex, but we will limit ourselves to the following form.

  1. A call is made up by indefinitely repeating a chirp and a silent period.
    The chirp starts again after the chirp repeat interval.
  2. A chirp is made up of a certain number of syllables,
    each with specific duration and syllable repeat interval.
  3. A syllable is made up of a sine wave burst at a certain burst frequency.
    The burst starts at low amplitude, which increases quickly to a maximum,
    sustains the maximum amplitude until just before the end, then decreases amplitude to zero.

The image below summerizes the definition ( from Manfred Hartbauer).

cricket song structure

A matlab program generates such songs, but is not real time. The following images are three zoom levels of a song generated with chirp_repeat_interval=0.5 sec, syllable_duration=0.02, syllable_repeat_interval=0.05, syllable_count=4 and burst_freq = 2500 Hz. The syllable rise time was set to 4 mSec. The second image shows one chirp of the first image and the thrid image show one syllable of the second image.
cricket callzoom1zoom2


You will use a keypad to control cricket synthesis with audio output to a speaker. Analog output will be through a SPI controlled DAC. The analog signal will be sine wave bursts generated using Direct Digital Synthesis (DDS) technique to one one channel of the DAC. An example on the DSP page (example 1 or 2) shows how you might implement a DDS, with the SPI DAC. Your DDS unit must resolve 256 table entries. For this lab, you will need to modulate the amplitude on a per-sample basis. The sine wave table will need to be scaled to prevent overflow.


In this lab and every lab, make sure you are running Protothreads 1_2_1.
I suggest organizing the code as:


  1. Write a C program which implements a cricket-call generator with the following specifcations:
  2. Connect the circuit to a speaker audio input (green phone plug) and listen the output. This will aid in debugging and is required for the demo.
  3. Demo this program to a staff member. Show that all specifications are met by verifying frequencies with an oscilloscope.
  4. At no time during the demo should you need to press RESET.
  5. Your written lab report should include the sections mentioned in the policy page, and :


Copyright Cornell University June 15, 2017