One of my courses at BCIT was Data Communications, which focussed mainly on the bottom 3 layers of the TCP/IP stack. One of the things we covered was converting between digital and analog signals. PCM stands for Pulse Code Modulation and covers the conversion from analog to digital.
As we talked about simple waves, composite waves, sampling rates, bit rates, and quantization, I realized that this was the perfect case for an interactive tool that would explore the relation between them all. The majority of the program was built over a weekend, and all in all it was one of the smoothest projects I’ve ever developed, with no significant bugs or issues.
- The first pane shows your frequency domain plot. These control your input to the encoder. Click in a blank space to add a new frequency, and click on an existing bar to change it’s frequency, amplitude, or phase.
- The second pane shows the input wave form. Click it to toggle between simple waves overlaid, and a composite wave signal.
- The third pane shows sampling frequency during PCM. The slider above lets you choose the number of samples per second. Nyquist’s law indicate’s the minimum sampling rate be 2x the highest frequency in the input. Your standard mp3 uses 44,100 samples per second.
- The fourth panel shows the quantized wave, based on the samples above. The quantization steps are calculated from the number of bits per sample. Your standard mp3 uses 16 bits per sample, or 2^16 = 65536 quantization levels.
- The final panel shows the reconstructed signal. It takes the quantized form above and smooths the stair-stepping to approximate the original input.
Download the jar file here
Download the source code here