# Sound analysis and visualisation

The first thing to know, before trying to generate or modify sound signals, is how existing sound is visualised and how some established parameters can be extracted from it. This is important because it facilitates gaining an intuitive picture of what is happening and gives one the opportunity of learning more about common sound sources and the way we hear sound, in general.

## Waveform visualisation

From the mathematical standpoint, this is the most straight‐forward way of visualising sound—since we model sound as a signal, i.e. a function, the easiest way to represent sound is to plot the function. What results is just a plot of sound pressure variations against time in some point of space. The scales may vary—sometimes it is convenient to draw the pressure axis as a logarithmic one—but the most common form is to use linear pressure against linear time. Since such visualisation is often done by computers, natural signals (which are, to great accuracy, continuous and differentiable), are drawn in time sampled form, leading to some choppiness of the signal (as time is discrete in this case, the signal certainly doesn’t appear differentiable or even continuous if we do not generate a continuous wave between adjacent sample times). Often this choppiness is, then, reduced by interpolating between sample values—most often, linear interpolation is used, i.e. we draw a straight line between adjacent sample values, although scaling the signal considerably (zooming in) creates the need to use more sophisticated (often cubic B‐spline or equivalent) interpolation to give a coherent picture of how the signal should look.

Usually waveform plots can be produced at different scales so that we can see the different levels of detail in a sample. When scaling, aliasing becomes, of course, a problem if we down‐sample (fit a longer waveform segment on the screen at once). This means that, in this case, we no longer visualise the original signal but an aliased version which can be quite ugly indeed. The simplest way is to ignore the problem. This leads to workable visualisation, if accurate editing is not a requirement. However, we miss some of the detail in the signal (for example, a signal rich in high frequency components gets aliased so that it is quite difficult to spot amplitude envelopes and other detail in the signal). Another way would be to use an anti‐alias filter, but now we would ignore the high‐frequency part entirely (this is used by some editing software and it works if we are interested in highly composite signals where we can sufficiently safely assume that most significant information is always present in the low frequencies). All this happens because we cannot down‐sample and not lose information at the same time. So how about encoding at least some of the lost information in another way? (This is possible since we now have a two‐dimensional, often colorable surface on which we can fit much more data than in a 1‐D signal.) This leads to a simple solution which preserves amplitude envelopes quite well: for each sample period of the down‐sampled signal, find the largest and smallest values the original signal takes during the period and draw the period as a vertical bar between these values, possibly with some smoothing between adjacent sample periods. This approach—and quite a few variations thereof—are used in practical applications and seem to be the best for audio editing purposes where the overall amplitude envelope of the signal is a key factor.

## Amplitude envelope extraction—VU meters and envelope followers

Envelope extraction was already touched above. The idea, here, is to give an indication of the overall amplitude of the signal at a given moment in time. The problem is a bit more subtle than it would seem at first:how, exactly, do we define amplitude at some specific time? Is it the actual amplitude of the signal (meaning it can contain arbitrarily high frequency components) or a somehow less time‐localized version? Should all frequencies be handled equally? In the case of non‐localized representations, what aspect of the signal do we want to use—a smoothed version, some non‐linear function of the original signal (e.g. absolute maximum value) or some combination?

Usually two main paths are taken—both are the result of taking a non‐linear function of the signal over some time. In the first case, we get an RMS (Root Mean Square) amplitude envelope. This is obtained by low‐pass filtering (averaging) a squared version of the signal over some time‐period (usually from 10 to 100 milliseconds) and taking a square root. Through some Fourier analysis, the result is roughly proportional to the aggregate power present in the signal over the whole frequency spectrum. The second approach takes the maximum absolute value of the signal over the time‐period we are interested in, producing the so called peak amplitude envelope. Both methods can be implemented rather easily in analog circuitry, and have been used since the inception of recording technology. The difference between the methods is in the fact that even if two signals have the same exact frequency content, phase relationships between the different components can lead to widely varying peak amplitudes. Since the human hearing is much more sensitive to frequency variations than to phase relationships, the perceived loudness of a signal correlates better with the RMS envelope. However, electrical circuits are time‐domain, not frequency domain devices, so peak amplitude envelopes are more relevant to them; for example, clipping occurs (especially in digital equipment) if the signal has large peak amplitudes. This means that when matching a program source to digital transmission, amplitude adjustments are usually made based on peak amplitudes, not RMS.

After extracting an amplitude parameter, all that needs to be done is to visualise it somehow. One way is to interpret it as a time‐varying quantity, i.e. a signal, and visualise it as a function. This is usually a bit too much. VU meters provide an alternative way: here we present the time‐variable amplitude as a stack of lights whose height depends on the momentary amplitude. Color coding the lights (usually LEDs) enables us to note immediately if the signal is too loud for our equipment to handle or if there is no signal at all (a cable has come loose etc.). In some applications, only an indication of some binary condition is needed. Here we can just threshold the amplitude and give a visible signal (e.g. turn on a red LED) if the condition comes true. Such indicators are to be seen everywhere in studio equipment. (Examples include the little red lights indicating analog input overshoot and the little green ones signaling a present signal.)

Of course, now that we have extracted an abstract parameter from the signal, nobody says we actually have to visualise it—we can do anything with it. This is the idea of envelope followers—they extract instantaneous amplitude information from signals and pass it on for processing. Most effects, for example, can be controlled by amplitude envelopes extracted from the input signal. This is how automatic wah‐wah pedals and other such devices work.

## Spectral analysis

``` ‐multiple bandpass
‐FFT
‐MDCT
‐ARMA
‐wavelets
‐Prony
‐MacAulay‐Quatieri (MQ)
‐autocorrelative/autoregressive
‐Wigner distributions
‐statistical maximum likelihood methods
‐line/sine decompositions (like in MPEG4 low rate voice codecs‼)
‐LPC and format extraction (interpolation and peak estimation)
‐multiresolution variants of conventional spectral decompositions
```

## Energy waterfalls

```For overcomplete time/frequency analysis ⇒ always ’smooth’!
```

## Pitch tracking

``` ‐zero crossings
‐autocorrelation analysis
‐FFT binning and interpolation
‐cepstrum based analysis (not dependent on the precence of the fundamental problems with nonlinearity and harmonic sounds with little content other than fundamental)
‐autocovariance
‐cochleagram and/or gamma filterbank based functional descriptions of the ear
‐Eric Schreier’s work on modelless cybernetics principles
‐the old+new heuristic
```

## Tempo tracking and rhythm extraction

``` ‐amplitude/power extraction/thresholding
‐autocorrelation
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.9164307,"math_prob":0.93551534,"size":8025,"snap":"2021-21-2021-25","text_gpt3_token_len":1645,"char_repetition_ratio":0.122303955,"word_repetition_ratio":0.0015898251,"special_character_ratio":0.18641745,"punctuation_ratio":0.083508775,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9529301,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-07T22:05:33Z\",\"WARC-Record-ID\":\"<urn:uuid:895201f9-344c-4d9f-9c2e-0b623bbe2040>\",\"Content-Length\":\"16092\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:9800870b-24e4-41c1-aae1-544cb314ec32>\",\"WARC-Concurrent-To\":\"<urn:uuid:95bb3cb9-bedd-4572-946b-94f946546a9f>\",\"WARC-IP-Address\":\"91.232.156.82\",\"WARC-Target-URI\":\"http://decoy.iki.fi/dsound/dsound-c-06\",\"WARC-Payload-Digest\":\"sha1:DDGFB66NIKLI75N2GMUHAW732AZT2OLM\",\"WARC-Block-Digest\":\"sha1:JWMMXR2Q3UWB6GELVOSILKX52RKYBCXN\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243988828.76_warc_CC-MAIN-20210507211141-20210508001141-00576.warc.gz\"}"}