I'm now processing PCM codes extracted from .wav file and want render the spectrum myself. First I try to read a spectrum on my foobar2000 player as below.

enter image description here

My problem with this spectrum is: what do x-axis and y-axis represent? IIRC, the x-axis represents different frequency(or angular speed) and the scale should be whole-number times of fundamental, i.e. 50. However, when I divide next by its preceding, e.g. $94\div 69$, the outcome is roughly always 1.37. As to the y-axis, why the scale is negative? What is the calibrated value, i.e. $P_2$ in $10\log_{10}{\frac{P_1}{P_2}}$.

If I want to render the amplitude spectrum with PCM code, should some normalization be first taken(I know the original 8-bit PCM code ranges from -128 to 127, even normalized range is -1.0 to 1.0. It seems I can't use these values directly to represent amplitude of the signals)?

Thanks and Best Regards!


The x-axis is indeed frequency, but the numbers are quite strange to me. One would expect a scale in powers of 2 (octaves) or of powers of 10 (decades).

The y-axis represents the relative magnitude of the signal at that particular frequency. The 0dB level is what you would get from a sine wave with the maximum amplitude (-1..+1). So your P2 is 1.0.

| improve this answer | |
  • $\begingroup$ Thanks. But what if $P_1$ is 0.0? How to evaluate the $\log$? By the way, how could I determine the fundamental frequency after fourier transformation? IIRC, I will get a sequence of angular frequency after DFT. $\endgroup$ – Summer_More_More_Tea Mar 14 '12 at 17:12
  • $\begingroup$ If P1 is 0.0, the magnitude in dB would be -infinity. You'll have to define a cutoff point. Preferably one that corresponds with the dynamic range (some 48dB for 8-bit PCM). Finding the fundamental is a different problem altogether. It involves finding the peak frequency, but ignoring the harmonics. Also there is something called the missing fundamental which makes this problem ever so interesting. $\endgroup$ – Han Mar 14 '12 at 20:14
  • $\begingroup$ Suddenly realize that fundamental frequency of signals is different from those of DFT. Then what does the frequency $\frac{k}{N}$(correct me if wrong) used in Fourier Transform represent physically? Thanks in advance! $\endgroup$ – Summer_More_More_Tea Mar 15 '12 at 5:16
  • $\begingroup$ If you (Fourier) transform N samples of a signal with a samplerate of F, then the highest frequency in the transform is F/2 (the Nyquist frequency). The N samples in the transform each represent a frequency (bin) with size of F/2N Hz. The k/N represents the kth frequency bin or kF/2N Hz. $\endgroup$ – Han Mar 15 '12 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.