# This script will draw an fft spectrum from a selection in the editor window. # The script is adapted from Mietta Lennes' script which uses a fixed window of 40 ms, # whereas the present script will use a window width equal to the selection specified by the user # 20020414 niels reinholt petersen # Make a temporary selection from the original sound: # cursor = Get cursor start = Get begin of selection end = Get end of selection Select... start end # name the new Sound object according to the time point where the cursor was milliseconds = round (start * 1000) window = Get selection length window = round (window * 1000) Extract windowed selection... FFT_'window'ms Hanning 1 no # leave the Sound editor for a while to calculate and draw the spectrum endeditor # Make the Spectrum object from the new Sound To Spectrum (fft) Edit editor Spectrum FFT_'window'ms # zoom the spectrum to a comfortable frequency view... Zoom... 0 5000 endeditor # select and remove the temporary Sound object select Sound FFT_'window'ms Remove # return to the Sound editor window and recall the original cursor position editor Select... start end