Tutorial - Understanding spectrograms

From Audacity Development Manual
Revision as of 16:33, 10 June 2015 by Paul L (talk | contribs) (Example sounds: code for overtone scale)
Jump to: navigation, search

Under construction

Introduction

Example sounds

In this tutorial, several example sounds are shown repeatedly with variations of settings. Follow these instructions to recreate those sounds.

  • Silence: Use the Silence generator to create silence of any given duration.
  • Impulses: To create the briefest possible click sound or "impulse," enable the Draw Tool, then zoom the view of a track until individual samples are visible. Hold CTRL and drag one sample upward or downward as far as possible.
  • Chromatic Scale: Generate one second of silence. Select the silence. Use the Nyquist_Prompt effect, and copy and paste the following code into the text entry. Click OK. The result is an ascending chromatic scale of pure tones separated by rests. The notes begin at middle C and continue for four octaves. Each is one-half second long with a tapering envelope.
  (let ((scale (s-rest 0))
        (env (hzosc (/ (get-duration 1)))))
     (dotimes (ii 49)
        (setq scale
           (sum scale
              (at ii
                 (seq
                    (prod
                       (cue env)
                       (cue env)
                       (cue (osc (+ 60 ii) 0.5)))
                    (s-rest 0.5))))))
   (prod 0.99 scale))
  • Overtone scale: The following code generates the note two octaves below middle C, and successive whole-number multiples of that frequency.
  (let ((scale (s-rest 0))
          (env (hzosc (/ (get-duration 1)))))
     (dotimes (ii 32)
        (setq scale
           (sum scale
              (at ii
                 (seq
                    (prod
                       (cue env)
                       (cue env)
                       (cue (osc (hz-to-step (* 65.406 (1+ ii))) 0.5)))
                    (s-rest 0.5))))))
     (prod 0.99 scale))
  • Pluck: The Pluck generator simulates a plucked string.
  • Chirp: The Chirp generator creates a continuously varying tone, rising or falling linearly or exponentially in frequency.

Default Preferences

Unless otherwise specified, all images use default values for Spectrogram Preferences. These are:

  • WindowSize: 256
  • WindowType: Hanning
  • Zero Padding Factor: 1
  • Minimum Frequency: 0 Hz
  • Maximum Frequency: 8000 Hz
  • Gain: 20 dB
  • Range: 80 dB
  • Frequency gain: 0 dB/decade
  • Grayscale: off

Linear and logarithmic scales

See the linear view of a pluck, up to 22050 Hz (shift-right click in vertical scale). The overtone series appears evenly spaced. Many naturally occurring sounds have similar series. See the logarithmic view. Now the spacing between overtones grows ever smaller as frequency increases.

Compare linear and logarithmic views of a chromatic scale (from 200 to 4800 Hz, window size 4096). The logarithmic view spaces musical semitones evenly on the vertical scale, so that the sequence of notes falls on a straight line.

Maybe generate an overtone scale and make the same contrast.

Spectral selection

Preferences

Window size

Window type

Minimum and Maximum Frequencies

Gain, Range, and Frequency gain

Grayscale