HW1 Howto

Howto: CS 410/510 SOUND HW1

Bart Massey

  1. Build a Goertzel filter.

    1. The linked articles contain filter equations.

    2. Use floating point numbers for everything.

    3. The filter should support length 160, although it would be better to take the length as a parameter.

    4. You will want to be able to save and reuse the filter coefficients, instead of regnerating them each time the filter is run.

  2. Test your Goertzel filter by feeding it a sine wave of known frequency and measuring the filter output for frequencies around the target frequency. It should have a bell-shaped response curve with the peak at the target.

  3. Read the samples in from a target WAV file. Use a WAV library to do this.

  4. Convert the samples to floating point (if your library doesn't do this for you) by scaling them appropriately.

  5. The samples are a sequence of 1/300th-second sine waves representing bits. At 48000 samples per second, that is 160 samples per bit.

  6. Set up two instances of your Goertzel filter: one at the "mark" (1) frequency of 2225Hz and the other at the "space" frequency of 2025Hz; both with length 160.

  7. For each chunk of 160 samples:

    1. Measure the mark and space filter amplitudes of that chunk.

    2. If the mark amplitude is higher than the space amplitude, treat the chunk as a 1 bit, otherwise as a zero bit.

    3. For each chunk of 10 bits:

      1. Verify that the first bit in the 10-bit chunk is a 0 bit ("start bit") and the last bit is a 1 bit ("space bit").

      2. The eight bits in between will be a byte representing an ASCII character ("data bits"). The first data bit in the chunk will be the least-significant bit in the byte, and so forth ("little-endian bit order").

      3. Extract and save that byte.

  8. The sequence of bytes saved is the ASCII message.

Last modified: Monday, 22 April 2019, 12:49 PM