LSylvia wrote:Thank you. Actually the 2nd one is a bandstop filter. SO I think the energy between the upper and lower limit of the filter will be removed. There is a 400Hz spectral notch. In the middle of the notch is a 1000Hz pure tone and in the middle of the other masking noise (with no bandstop filter) there is also a 1000Hz pure tone.
To my understanding, a "bandpass" filters allows frequencies
between the filter's lower and upper bound to pass through, while other frequencies (outside the filter's range) are suppressed. For the example, I had configured a bandpass filter with 1000 Hz lower bound and 2000 Hz upper bound. And indeed, as can be seen in the picture, frequencies below 1000 Hz and above 2000 Hz have been reduced to near-zero. Only frequencies in the 1000 to 2000 Hz range remain - with some "fade in" and "fade out" at the boundaries. The fade-in/fade-out at the boundaries of the filter are controlled by the "order" of the filter. Higher order means "steeper" fade-in/fade-out, and vice versa.
With a "bandstop" filter, on the other hand, we would expect that only frequencies within the filter's range are removed, while the frequencies
outside of the filter's range remain. So that would be the opposite of what we see here.
LSylvia wrote:I have a pretty good idea of what both of those stimuli would look like but I'm not sure of how to get to it using "plot spectogram".
Well, pretty much any audio editor has a "Spectrogram" or "FFT" view. But it's also pretty straight forward to compute yourself, as explain before. Especially if you defer the hard work (the DFT computation) to
FFTW
LSylvia wrote:The other variables such as: encoding, byte order, start offset, and sample rate, I dont really understand. Also, the plots I am getting think have time across the top and maybe SPL on the left side.
You don't really have to care. If you use a library, such as
libsndfile, the exact file format (encoding, byte order, start offset, etc.) will be hidden from you. All you do is feed the input file into
libsndfile (it supports pretty much anything from WAVE to W64, AU/SND and AIFF), and what you get back from the library is simply a sequence of
sample values - stored as floating point values in the
-1 to
1 range - that you can pump trough your FFT analysis. Couldn't be easier.
The
sample rate does matter, of course. According to
Nyquist's Theorem, the highest frequency you can have is the sample rate divided by two. So if you have a sample rate of 44100 Hz (i.e. 44100 samples per second), for example, then the highest frequency that is retained in that signal is 22050 Hz. That becomes important as soon as you want to map the FFT coefficients to the corresponding frequency in Hertz!
(If I know the sample rate is 44100 Hz, then I know the highest FFT index corresponds to a frequency of 22050 Hz, for example)