# HCI/CprE/ComS 575: Homework #5

Your Name
< Your Email>

List of Audio Libraries and References

The following list of C / C++ libraries and references for audio processing is provided for your convenience only. You are not required to use any of these libraries / references for this homework.

- Fastest Fourier Transform in the West library.
- The Fourier Transform and its Applications: A Video Course.
- Keep It Simple, Stupid FFT library.
- Audacity. Useful for analyzing raw audio (waves) and modifying audio files (ie. stereo <--> mono).
- Programming for the Pac-Man or Pengo arcade platforms. Contains information regarding the original Pac-Man hardware architecture, as well as descriptions of the sound ROMs.
- Full Pac-Man Z80 disassembly code. Use with caution.
- Z80 full instruction set. Use to read the disassembly above.
- Pac-Man Emulation Guide. Qualitative description of the Pac-Man ROM and hardware usage.

## Part 1a

Implement the Fast Fourier Transform in C or MATLAB. Note that you are not allowed to use MATLAB's implementation nor any of the libraries linked above for this problem.

Source

    // Insert your code here

## Part 1b

Using your implementation from Part A, compute the Discrete Fourier Transform of the following vector:

Vector 'x'

####

    [0, 0.7071, 1, 0.7071, 0, -0.7071, -1, -0.7071]

Note that you may use sqrt(2)/2 instead of 0.7071.

Result

    // Insert your resulting vector here

## Part 1c

Compare your output from part 1b with the output generated by MATLAB's fft() method for the same vector 'x'. Include the result below, and any discrepancies.
You may also use one of the FFT libraries above, if you choose.

Result & Analysis

    // Insert your new resulting vector here

    // Insert any comments here

## Part 2a

Implement the Inverse Fast Fourier Transform in C or MATLAB. Note that you are not allowed to use MATLAB's implementation nor any of the libraries linked above for this problem.

Source

    // Insert your code here

## Part 2b

Using your implementation from Part A, compute the inverse Discrete Fourier Transform of the following vector:

Vector 'X'

####

    [0, -4i, 0, 0, 0, 0, 0, 4i]

Result

    // Insert your resulting vector here

## Part 2c

Compare your output from part 2b with the output generated by MATLAB's ifft() method for the same vector 'X'. Include the result below, and any discrepancies.
You may also use one of the IFFT libraries above, if you choose.

Result & Analysis

    // Insert your new resulting vector here

    // Insert any comments here

## Part 3

Using any FFT and IFFT implementation, compute and plot the spectrograms for the following 5 audio files.
Note that there are three versions of each file - the original sound from the Pac-Man hardware, in both mono and stereo, and a generated version.
The generated wave will likely produce a cleaner spectrogram to analyze, but they are there for you to use as you see fit.

Audio Data | Spectrogram
--- | ---
01-extralife |
02-siren1 |
03-fruiteaten |
04-ghosteaten |
05-pacmandeath |

Source

    // Insert your code here

## Part 4

Given the code to synthesize siren #1 (siren1.wav, siren1-generated.wav), modify it to synthesize the remaining 4 sirens.
Your synthesized waves should sound approximately like the provided samples - check both the frequencies used and the periodicity of the wave.
Again note that there are two versions of each file - mono and stereo versions. You are only expected to generate a mono version.
Spectrograms are your friend! Use them to get as similar as possible to the original wave.

Original | Synthesized
--- | ---
siren1 | siren1-generated
siren2 | siren2-generated
siren3 | siren3-generated
siren4 | siren4-generated
siren5 | siren5-generated

Source: Siren 2

    // Insert your code for Siren 2 here

Source: Siren 3

    // Insert your code for Siren 3 here

Source: Siren 4

    // Insert your code for Siren 4 here

Source: Siren 5

    // Insert your code for Siren 5 here

## Part 5

Synthesize the Extra Life (extralife.wav) sound.
Do not use the original version of the sound to synthesize the new one - instead, generate it from scratch, similar to the process used in Part 4. Your synthesized wave should sound approximately like the provided sample - in this case, check the frequencies, the periodicity of the sound, and the amplitude of the wave.
Again, both mono and stereo versions are available. You are only expected to generate a mono version.
Make heavy use of spectrogram analysis to judge the quality of your wave, as compared to the original wave.

Original | Synthesized
--- | ---
extralife | extralife-generated

Source

    // Insert your code here

# Extra Credit

## Part 6

Repeat Part 5, but this time for the Fruit Eaten (fruiteaten.wav), Ghost Eaten (ghosteaten.wav), and Death Bloop (pacmandeath.wav) sounds.
All the same restrictions apply.

Original | Synthesized
--- | ---
fruiteaten | fruiteaten-generated
ghosteaten | ghosteaten-generated
pacmandeath | pacmandeath-generated

Source: Fruit Eaten

    // Insert your code for Fruit Eaten here

Source: Ghost Eaten

    // Insert your code for Ghost Eaten here

Source: Death Bloop

    // Insert your code for Death Bloop here