HW1 Howto
Howto: CS 410/510 SOUND HW1
Bart Massey
Build a Goertzel filter.
The linked articles contain filter equations.
Use floating point numbers for everything.
The filter should support length 160, although it would be better to take the length as a parameter.
You will want to be able to save and reuse the filter coefficients, instead of regnerating them each time the filter is run.
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.
Read the samples in from a target WAV file. Use a WAV library to do this.
Convert the samples to floating point (if your library doesn't do this for you) by scaling them appropriately.
The samples are a sequence of 1/300th-second sine waves representing bits. At 48000 samples per second, that is 160 samples per bit.
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.
For each chunk of 160 samples:
Measure the mark and space filter amplitudes of that chunk.
If the mark amplitude is higher than the space amplitude, treat the chunk as a 1 bit, otherwise as a zero bit.
For each chunk of 10 bits:
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").
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").
Extract and save that byte.
The sequence of bytes saved is the ASCII message.