Understand audio signals

Most audio signal are described by a curve having two parameters: The amplitude and the frequency (amount of time from positive to negative amplitude value).

What I want to understand is how the sound level and absolute pitch are encoded to these two values. How would amplitude and frequency change if I'd change volume or pitch?

-

We can think of a sound signal either as a function of time or as a function of frequency. The two ways are related by what is called a Fourier transform, so they are often written as $f(t)$ and as $\tilde f(\omega)$, using the same letter, but with the "tilde" above one of them indicating that one is the Fourier transform of the other. From these functions it is also possible to construct other functions of both time and frequency, such as the Wigner function.

I would take "pitch" as more-or-less another name for frequency. Audacity help says "Generally synonymous with the fundamental frequency of a note, but in music, often also taken to imply a perceived measurement that can be affected by overtones above the fundamental."

The squared amplitude of a function is the square of the function, properly speaking the norm, written as $|f(t)|^2$ and $|\tilde f(\omega)|^2$. This function of time or of frequency is always positive or zero, whereas the original function can be positive or negative (or it can be a 2-valued function, which in the time coordinates represent both the signal and its rate of change at a given time). It's common to call the "squared amplitude" the amplitude, just to confuse matters.

Sound level sometimes refers to the logarithm of the squared amplitude, as Georg says, but sometimes not. Wikipedia, for example, suggests that a loudness meter reports on a logarithmic scale, whereas sound level might mean either linear or logarithmic scale. One test for what is meant is whether the signal level is followed by "dB", which will always indicate a logarithmic scale.

Ultimately I'd say that it's the mathematical relationships between these objects that one tries to understand, but a lot can be understood just by experimenting with something like Audacity (which I think is simpler to use than the software mentioned by @whoplisp, although also less powerful), using the "Analyze->Plot Spectrum" option for various sounds. Here's a plot for me whistling, apparently at about 1300Hz (the fundamental frequency) in the 0.026 seconds that I analyzed here, but with various higher frequencies also represented. When reading something about sound or music, there are various technical usages that are not very standardized, and one often has to figure out what's meant by the overall context. There are many different expert groups that have a strong interest in signal analysis of various kinds, and they have often developed specialized languages appropriate to their own interests.

-
Thank you for that great explanation –  muffel Jul 23 '11 at 17:07
I, and perhaps the OP, would be glad of an explanation of the "not useful". –  Peter Morgan Jul 23 '11 at 19:41

The waveform in the image below is the signal, that the microphone picks up. When I whistle, the pressure of the air fluctuates in this manner.

For the each line in the picture below the 2048 samples of the waveform were Fourier transformed and the magnitude is plotted.

When I whistled, I changed pitch between two values and you can nicely see this in the waterfall plot of the time-slice Fourier transform.

The screenshot was taken while I emitted a low pitch.

Volume and pitch are just axes in those plots. The software is from http://www.baudline.com. It's not free software but you can download and run it on your Linux. I don't know anything easier/better and suggest you try it, its fun.

You can tune a guitar, figure out the quality of MP3 files or your recording equipment, see where the instruments are in stereo recordings. The coolest thing I did with this was to display an image that I encoded into sound.

-
You can do something approximately similar using "audacity", which is freeware, eg at audacity.sourceforge.net, which allows you to look at recorded signals at your leisure, edit and merge them in various ways, and save the results in various formats. –  Peter Morgan Jul 23 '11 at 14:11
I didn't know audacity displays a waterfall plot of the spectrum youtube.com/watch?v=VZbZa99ocPU. I know of ccrma.stanford.edu/software/snd/snd/snd.html#viewfft, which is like emacs for sound. –  whoplisp Jul 23 '11 at 14:23
There's "Analyze->Plot Spectrum", which does just that. A "Waterfall Plot" (a term I didn't know because my interest is in the mathematical end of signal processing, but there's enough at en.wikipedia.org/wiki/Waterfall_plot to get the idea) is not available, but the window for which the spectrum is computed can be changed arbitrarily, as can other details of the transform. –  Peter Morgan Jul 23 '11 at 14:50
ps Looking at the link in your Comment, it looks like a big learning curve. Good to know of, nonetheless, thanks. That made the jump to "useful for me". –  Peter Morgan Jul 23 '11 at 14:55
Apparently Audacity does support spectrograms, through the track options "Spectrum" or "spectrum(dB)" instead of "Waveform" or "Waveform(dB)". –  Peter Morgan Jul 23 '11 at 15:26

Some folks have put a lot of work into these answers, but they are at the wrong level for the OP. The OP is asking basic questions about sound waves, and therefore will certainly have no idea about Fourier analysis.

If you raise the volume, the amplitude goes up. Physically, the amount of energy in the wave is proportional to the square of the amplitude.

If you raise the pitch, the frequency goes up. In terms of music, if you sing a scale like CDEFGABC, the ratio of the frequencies of the two C's is 2. (This is called an octave in music.)

Note that the frequency is not the "amount of time from positive to negative amplitude value." The time from a positive peak to a negative peak of a sine wave is T/2, half the period. The frequency is 1/T.

-
He is from Mathoverflow, so I assumed he knows Fourier transforms, or can read them up. –  whoplisp Jul 23 '11 at 17:42
Always tricky to judge the level of the OP. –  Peter Morgan Jul 23 '11 at 19:27