Page 1 of 2

How change X-axis range in Spectrum Analysis Plot

Posted: Thu Apr 24, 2014 5:50 pm
by Spriter1275
Hello,
I am analysing some noise from industrial equipment and have been asked by a noise expert to do the spectrum analysis with a linear scale on the x-axis such that harmonics are more easily recognisable. At the moment the range goes to 40,000Hz while I'm only interested in <500Hz. Is this possible to do ?!

Thanks.........Steve

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Thu Apr 24, 2014 6:14 pm
by kozikowski
Zoom In to a spectrum analysis is a Feature Request.
The work-around, since the accuracy of the display goes up as the dragged size of the window goes up is to repeatedly drag the window larger and push it off the left of the screen as you go. Then reposition the window so the portion of interest is in screen center.

Koz

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Thu Apr 24, 2014 11:10 pm
by Trebor
Using the log(arithmic) scale makes the lower frequencies more conspicuous ...
log-linear#.gif
log-linear#.gif (81.25 KiB) Viewed 3474 times

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Fri Apr 25, 2014 4:51 pm
by steve
Note also that selecting a higher "Size" setting will show more detail in the low frequency range.

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Fri Apr 25, 2014 7:34 pm
by Spriter1275
OK, thanks. Using Trebor's pictures it does look like the harmonics are easier to pick out with the linear plot which I think is what the acoustics guy suggested. I've just spent an hour downloading other software to try and achieve this with no success. Unfortunately I can't zoom in and get the definition between the frequencies I'm interested in with Audacity on the linear scale so guess I'm stuck with using the log scales which I daresay will be OK..........

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Sat Apr 26, 2014 12:09 am
by Trebor
If you re-sample a copy of your audio by dividing its sample-rate by four,
that will effectively allow you to zoom-in on the lower frequencies on the spectrogram ...
down-sample by factor of 4.gif
44100Hz re-sampled to 11025Hz (1/4)
down-sample by factor of 4.gif (41.63 KiB) Viewed 3293 times
[click on this image to see it in its entirety].

NB: you'll have to click-on "replot" after resampling , (as the frequency analysis won't automatically update itself).

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Sun Apr 27, 2014 9:37 pm
by Spriter1275
OK, thanks, re-sampling and trying to extend the window gives a better linear plot with a reduced x axis. Not great though but may be usable.......

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Mon Apr 28, 2014 6:42 am
by Trebor
IIRC the spectrograms generated by the free program SoX allow you to specify a frequency window.

[ but SoX is not very user-friendly : is has a command line interface ]

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Mon Apr 28, 2014 2:59 pm
by steve
Trebor wrote:IIRC the spectrograms generated by the free program SoX allow you to specify a frequency window.
SoX has nice spectrogram plotting feature.
SoX does not have an equivalent to Audacity's "Plot Spectrum", but it does have "stat" and "stats" effects that can output a wide range of statistical data.
SoX is documented here: http://sox.sourceforge.net/sox.html

The basic syntax for a spectrogram is:

Code: Select all

sox my.wav −n spectrogram
where "my.wav" is the file to be analyzed.

To plot a spectrum up to, say, 500 Hz with SoX:

Code: Select all

sox my.wav −n rate 1k spectrogram
The "rate 1k" parameters tell SoX to analyze with a sample rate of 1 kHz, which thus outputs a range up to 500 Hz (half the sample rate).

Here is an example output from the above command:
spectrogram.png
spectrogram.png (169.36 KiB) Viewed 3055 times
The same idea can be used with Audacity's Plot Spectrum. Here I have resampled a file to 1 kHz (using "Tracks > Resample")
500HzPlot.png
500HzPlot.png (42.29 KiB) Viewed 3055 times
Note that "Plot Spectrum" in Audacity can output the analysed data as a text file, which can then be imported into any suitable graph plotting application to create custom graphs.
http://manual.audacityteam.org/o/man/plot_spectrum.html

Re: How change X-axis range in Spectrum Analysis Plot

Posted: Sun May 04, 2014 8:45 pm
by Spriter1275
OK, thanks.

I haven't managed to get SOX working in Windows 7 but the export function and then graphing in excel works really well although quite time consuming. Plus the resampling rate also works but I find I have to use a value of 3500 rather than 1000 otherwise I get an error message saying there is not enough data. My recordings are ~20 seconds and done in wav 24bit 96k format.