# Analyze Menu

### From Audacity Manual

The Analyze menu contains tools for finding out about the characteristics of your audio, or labeling key features. Plug-ins that accept input but produce no audio output will also be placed in the Analyze menu.
Although by default, no keyboard shortcuts are provided for most of the analysis tools, it is possible to set up your own shortcut for any Analyze command. For instructions on how to do this please see Keyboard Preferences.

## Built-in analysis tools

Most of the analysis tools included in Audacity are Nyquist plug-ins. You can download some additional Nyquist analysis plug-ins from the Download Nyquist Plug-ins page on our Wiki. Some LADSPA analysis plug-ins for Linux can be downloaded from the LADSPA site.

### Contrast...

Contrast Analysis analyzes a selected, single non-stereo audio track to determine the average rms difference in volume (contrast) between foreground (the speech) and background (music, audience noise or similar). The purpose is to determine if the speech will be intelligible to the hard of hearing.

To use Contrast Analysis, select in either a single mono speech track, or in the left or right channel only of a stereo speech track.

If you have an unsplit stereo track (meaning that it states "Stereo" to left of the waveform), use the Track Drop-Down Menu, choose Split Stereo Track, then select in either the resulting left or right channel.

With the single track selected, choose Analyze > Contrast... then:

Step One:

- Select a region containing the speech (this is the "foreground" selection)
- Click the Measure selection button in the "Parameters" box in the "Foreground:" row; the start and end times of the selection will be displayed
- The average rms of the selected foreground audio will be displayed in the "Volume" box at the end of the row.

Step Two:

- Select a region containing only the background sound (this is the "background" selection)
- Click on the Measure selection button in the "Parameters" box in the "Background:" row ; the start and end times of the selection will be displayed
- The average rms of the selected background audio will be displayed in the "Volume" box at the end of the row.

Result:

- Contrast Result: Shows if the difference between foreground and background gives a pass or fail against the "WCAG 2.0, Success Criteria 1.4.7" guideline for accessible audio. A pass is given if the difference is 20 dB or more.
- Difference: The actual average rms difference value found.
- Reset: Clears all the parameters and result values.
- Export: Saves the foreground/background values and the result to a text file for proof that you checked your audio file. If you export again to the same file, the new result will be appended underneath the previous one.
- WCAG2 Help: Links to an external illustrated tutorial for this tool.
- Close: Closes the Contrast Analysis window, retaining foreground/background and result values for the duration of the Audacity session.

| To ensure the track is fully compliant with WCAG2, you should check the contrast between foreground and background in several places.

### Plot Spectrum...

This takes the selected audio (which is a set of sound pressure values at points in time) and converts it to a graph of frequencies (the horizontal scale in Hz) against amplitudes (the vertical scale in dB). You can reduce the lowest displayable dB range by lowering the default -60 dB value for "Meter/Waveform dB range" in the Interface Preferences, as has been done for the image above.

Plots are made using a mathematical algorithm known as a Fast Fourier Transform or FFT. This gives a value for each narrow band of frequencies that represents how much of those frequencies is present. All the values are then interpolated to create the graph.

Plot Spectrum take the audio in blocks of 'Size' samples, does the FFT, and averages all the blocks together.

There is an audio version of the Uncertainty Principle that says "Frequency_Resolution*Time_Resolution = 2." Size lets you choose the FFT size which is the number of consecutive audio samples to be analyzed. If you choose 1024 samples, you will get 512 frequency bins covering the frequency range up to half the sampling frquency. Most projects use 44.1kHz sampling frequency. Thus, in this example, Time_Resolution = 1024/44.1 = 23.2 milliseconds and the frequency resolution is 44100/2/512 = 43 Hz.

Function offers choices like Rectangular, Hanning, Hamming and others. We suggest you use Hanning (actually it is a Hann window, but Hanning is widely accepted) for most situations. The fundamental principle at work here is that the way we observe our data changes what we see. The "true spectrum" of your project would be computed over the entire project and would provide very detailed frequency resolution but essentially no time resolution at all. In other words, this "true spectrum" would offer an average frequency distribution over the entire project. If we select a short interval of audio, the short-time spectrum has frequency resolution limited by the observation window time AND the result is affected by the spectrum of the window itself. For general audio analysis, the Rectangular window is least desirable, and the other options offer slightly different effects.

Note that currently only the first 237.8 seconds of selected audio can be analyzed.

The image above is a spectrum of the word 'Audacity' spoken aloud. The same word used as part of the example on the Track Drop-Down Menu page, but by a different user.

The following controls let you configure the way the plot is calculated and displayed:

#### Algorithm

Determines what type of processing is done on the audio data.

- Spectrum: (default) - Plots the FFT of the data as described above.
- Autocorrelation: These options measure to what extent the sound repeats itself. This is done by taking two copies of the audio, and moving one forward by one sample. The two copies are then multiplied together, and all the values added up. This is repeated for two samples difference and so on, up to the number of samples in the size option. This gives a small result if the waveform is random (for example, noise) and a large result if it is repetitive (like a musical note). By looking at the peaks in the plot, the key frequencies present can be determined even if there is a lot of noise.
- Cepstrum: The cepstrum of an audio signal is related to the spectrum, but presents the rate of change in the different spectrum bands. It's particularly useful for properties of vocal tracks and is used, for example, in software to identify speakers by their voice characteristics.

#### Size

This controls how many frequency divisions are used for the spectrum, or how many samples are used for autocorrelation. In Spectrum, a larger size gives more accurate frequency resolution (narrow bands), but averages the result over a longer period of time (because more samples are needed for the calculation). In Autocorrelation, a larger size looks for repeating patterns over a larger range of time offsets, and so will detect lower frequency patterns. With either algorithm, Audacity will show a warning if the selected region is too short for the chosen size.

#### Export ...

Exports the spectrum to a text file. You could open this text file in another program for further analysis. Note that if you export again to the same file, the new spectrum will be appended underneath the previous one.

#### Replot

Allows you to replot the spectrum when the selection changes.

#### Function

Selects which mathematical function is used to pre-process the data. The basic forms of the FFT and autocorrelation algorithm require infinitely long sections of audio to work on, and so take infinitely long to complete. Hence the available audio must be faded in and out so that the finite length of the audio has minimum effect. The available functions are known as "windows" and fade in and out using different methods. There is a trade-off between frequency resolution and spillage from one frequency band to another.

- Rectangular: is the simplest - it just cuts off the given block of samples with a sharp cut (no fading), and so leaves a sharp click at each end of the data. This means that you get a lot of spillage into other frequency bands. Not a good plan.
- The rest fade in and out using various methods. The default (Hanning) is a good compromise, although opinions vary.

#### Axis

When using the Spectrum, the frequencies can be displayed on a linear scale (default, which gives equal width to each increment on the scale) or on a logarithmic scale.

#### Grids

Turn the measurement grids on and off.

### Find Clipping...

Displays runs of clipped samples in a Label Track, as a screen-reader accessible alternative to View > Show Clipping. A run must include at least one clipped sample, but may include unclipped samples too.

Start Threshold (default 3 samples) is the number of contiguous clipped samples that must be present before they will be labeled as an individual run. The higher the threshold, the less likely a clipped region will be recognized and the fewer labels that will be generated.

Stop Threshold (default 3 samples) is the number of contiguous unclipped samples that must be present before the run of clipped samples will be terminated. The higher the threshold, the longer a clipped region will be and the fewer labels that will be generated.

Each individual run of clipped samples is marked in the format "number of number". For example, "11 of 11" means there are 11 samples in this run of clipped samples and all of them are clipped, while "9 of 11" means only nine samples in the run of 11 are clipped. Note that in the case of a stereo track, each channel will have its own label, so if at one point both channels are clipped, two labels will appear above each other.

Note that unlike Show Clipping or Meter Toolbar, "Find Clipping" is not automatic, so after any editing that affects volume, or after import or recording of a new track, Find Clipping must be run again. Labels from another run of Find Clipping will be added to the existing label track - close the label track using the [X] on the left of the track if you want to view only labels for the current clipping.

### Beat Finder...

Beat Finder attempts to place labels at beats which are much louder than the surrounding audio. It's a fairly rough and ready tool, and won't necessarily work well on a typical modern pop music track with compressed dynamic range. If you don't get enough beats detected, try reducing the "Threshold Percentage" setting.

### Regular Interval Labels...

Places labels in a long track so as to divide it into smaller, equally sized segments. For example, this can be useful for distributing a large file on the internet. You can either choose the number of labels to be created, or the interval between them. Each label produced contains the chosen label text.

You can choose whether or not to add a sequential number for each label, whether the number comes before or after the label text, and the minimum number of digits to use in the label numbers. The default is to have minimum two digits before the label. With that setting, if you had 10 labels with "Label" as the label text, the first label would be "01Label" and the last would be "10Label". "Begin numbering from" lets you start the numbering sequence from any number, even a negative number if desired.

When labels are created by choosing the interval between the labels, by default the label interval is adjusted slightly if needs be so that all the audio segments are of equal length. If you wish the chosen label interval to be respected even if this makes the final audio segment unequal, set "Adjust label interval to fit length" to "No".

After running "Regular Interval Labels", choose File > Export Multiple... to export all the files in one process based on the label points.

### Sample Analyze Nyquist Plug-in

This is an example of a Nyquist analyze plug-in (this only ships with the Mac OS X version of Audacity). All it does is put labels at the start and end of the selection. If you are interested in writing Nyquist analyze plug-ins, this provides a simple starting point. Open the "analyze.ny" file (found in the "Plug-ins" folder) in a text editor to see the Nyquist code. For more information on the Nyquist programming language and how to use it within Audacity, see Audacity and Nyquist and Nyquist in Audacity.

The following two related "Silence Finder" and "Sound Finder" tools are very useful to label the different songs or sections in a long recording, such as the tracks from an LP or cassette. The labels can contain the name of the album track or audio section, then File > Export Multiple... will export audio files in one process corresponding to each album track or section in the recording. See our tutorial Splitting a recording into separate tracks.

### Sample Data Export...

Sample Data Export reads the values of successive samples from the selected audio and prints this data to a plain text, CSV or HTML file.

### Silence Finder...

Silence Finder divides a track up by placing point labels inside areas of silence. Use this if you just want to split the recording into tracks at a specific point without removing the silences between them.

If labels are produced in the middle of tracks, increase the silence level and duration. If some tracks don't have a label between them, reduce the silence level and duration. See Setting Parameters for more help choosing values to place the labels correctly.

### Sound Finder...

Sound Finder divides a track up by placing region labels for areas of sound that are separated by silence. Use this to make the labels show the exact region of each track to be exported. This lets you remove some or all of the silence between the tracks.

If any tracks have more than one label, increase the silence level and duration. If any labels extend into other tracks, reduce the silence level and duration.

## Vamp Analysis Plug-ins

You can also add some additional analysis tools in the Vamp plug-in format for viewing and analysing the descriptive contents of music audio files. Typical things that a Vamp plug-in might calculate include the locations of moments such as note onset times and power or fundamental frequency data.

To run a Vamp plug-in, select the audio and run the plug-in from the menu. An annotated label track appears showing the result. At this time, Audacity cannot display graphical output such as histograms or curves.

Currently Audacity cannot load Vamp plug-ins from the Audacity Plug-Ins folder. Vamp plug-ins are loaded from the standard directories defined by the Vamp SDK as follows:

- On all platforms: any directories listed in the VAMP_PATH environment variable
- additionally on Windows:
  - %%PROGRAMFILES%%\Vamp Plugins (a directory named "Vamp Plugins" within the system Program Files directory, however localized and on whatever drive is relevant to this install of Windows)
- additionally on OS X:
  - ~/Library/Audio/Plug-Ins/Vamp (user plug-ins)
  - /Library/Audio/Plug-Ins/Vamp (system-wide plug-ins)
- additionally on Linux/Unix:
  - $HOME/vamp
  - $HOME/.vamp
  - /usr/local/lib/vamp (user plug-ins)
  - /usr/lib/vamp (system-wide plug-ins)

##### Views

##### Help Location

- Local manual in use
- Internet manual