# This script will draw an LPC spectrum from a given selection in the editor window. # The script is adapted from a script by Mietta Lennes using a fixed window around # the cursor. # Note that the prediction order does not have to be specified; it is derived from the # sample rate: # Prediction_order = sampling rate/1000 + 4 # # 20020423 Niels Reinholt Petersen # Ask the user for some necessary information: form Draw an LPC spectrum from a small window around the cursor comment LPC options: (note: prediction order is derived automatically from sample rate) positive Analysis_width_(seconds) 0.025 positive Time_step_(seconds) 0.005 positive Preemphasis_from_(Hz) 50.0 comment Options for drawing the spectrum from LPC: integer Minimum_frequency_resolution_(Hz) 20 positive Bandwidth_reduction_(Hz) 0.1 positive Deemphasis_frequency_(Hz) 50.0 endform start = Get begin of selection end = Get end of selection window = Get selection length windowx = round (window * 1000) window = window/2 # name the new Sound object according to the duration of the selection Extract windowed selection... LPC_'windowx'ms Hanning 1 no # leave the Sound editor for a while to calculate and draw the spectrum endeditor sr = Get sample rate prediction_order = round (sr/1000) + 4 # Make an LPC object from the new Sound To LPC (burg)... prediction_order analysis_width time_step preemphasis_from To Spectrum (slice)... 0.0 minimum_frequency_resolution bandwidth_reduction deemphasis_frequency Edit editor Spectrum LPC_'windowx'ms # zoom the spectrum to a comfortable frequency view... Zoom... 0 5000 endeditor # select and remove the temporary Sound and LPC objects select Sound LPC_'windowx'ms Remove select LPC LPC_'windowx'ms Remove # return to the Sound editor window and recall the original cursor position editor Select... start end