News for hackers. Stuff that matters.
Re:Music theory for nerds (2016) by criddell on Wednesday February 16, 2022 @10:03AM (#30360868)
You seems to know a lot about the art and science of music so maybe you can answer a question I’ve had lately: what’s the difference between pitch and frequency? When a person talks about middle C on a piano, is that ‘C’ more closely related to pitch or frequency?
Re:Music theory for nerds (2016) by acjohnson55 on Wednesday February 16, 2022 @10:20AM (#30361070)
Pitch is a perceptual feature of sound, quantized within a musical scale. It is relational, in the sense that pitch probably wouldn't have meaning outside of a musical context that defines multiple pitches.

Frequency is a physical measurement of a periodic waveform.

Generally, a tone is composed of harmonics, which have frequencies that are integer multiples of a fundamental frequency. The pitch physically corresponds to the fundamental frequency of harmonic sound (or a sound that is mostly harmonic). But the relationship is complicated, as we can perceive two tones as having the same pitch (and fundamental frequency) even if the actual spectrum of one of them does not actually contain a component at the fundamental frequency (see https://en.wikipedia.org/wiki/Missing_fundamental).

This is because our brain will fill in the fundamental frequency if a tone has most of its harmonics. This is why you can hear bass notes of a song even if the speaker you're listening to doesn't have the frequency response to actually reproduce the fundamental frequency.

I hope some of this nuance is making this make sense.

There's also a concept of "pitch class", which is the idea of what you might call "C-ness" of every C note on the piano. In other words, octave equivalance, or the fact that you can substitute nearby C for each other without ruining harmony. Pitch, in some ways, is the intersection of pitch class and a specific fundamental frequency.

Re:Music theory for nerds (2016) by sevagh on Wednesday February 16, 2022 @10:11AM (#30360945)
Frequency is the repetition rate of the sound wave created by the instrument.

Pitch is the perceptual (i.e., human auditory perception) correlate of frequency. Pitch is what your brain/auditory system interprets that it hears from the sound wave at that frequency.

For a piano chord, there is likely the fundamental frequency (or f0, the lowest frequency), and its upper harmonics (integer multiples of the fundamental). That's why musical instruments (like the piano) sound richer than simple sine waves: their physical bodies create richer, more complex waveforms from the harmonics, giving it a unique timbre.

There are some subtle differences. For example, (very oversimplified), if you were made to listen to a waveform containing the frequencies of 60 Hz and 90 Hz, your auditory system would "hear" a pitch corresponding to a fundamental frequency of 30 Hz, since 60 Hz and 90 Hz are integer multiples of 30 Hz.

Re:Music theory for nerds (2016) by pvarangot on Wednesday February 16, 2022 @01:19PM (#30363581)
> There are some subtle differences. For example, (very oversimplified), if you were made to listen to a waveform containing the frequencies of 60 Hz and 90 Hz, your auditory system would "hear" a pitch corresponding to a fundamental frequency of 30 Hz, since 60 Hz and 90 Hz are integer multiples of 30 Hz.

Eh, so if you add 60hz and 90hz you get a wave that repeats every 33ish milliseconds. You don't "hear a 30hz sine wave" that your brain is inventing, that's a very common misconception. You just hear a 30hz "thing" that is not a sine wave because there's a 30hz thing that is not a sine wave playing. Just try adding an actual 30hz sine wave to the 60+90 thing and you'll see it sounds very different to what you hear when you add those two sine waves. If you keep on adding waves spaced 30hz adding the 30hz or 15hz one wouldn't make much of a difference because what you are listening to is something very similar to a low pass filtered 30hz pulse wave.

Re:Music theory for nerds (2016) by sevagh on Wednesday February 16, 2022 @04:29PM (#30365974)
When did I say you'll hear a 30 Hz sinewave?
Re:Music theory for nerds (2016) by pvarangot on Wednesday February 16, 2022 @04:35PM (#30366048)
I thought that's what you meant with:

> your auditory system would "hear" a pitch corresponding to a fundamental frequency of 30 Hz

Re:Music theory for nerds (2016) by criddell on Wednesday February 16, 2022 @10:45AM (#30361445)
Is the phenomenon you describe in your last paragraph the thing that makes a Shepard scale work?

If one were to make a pitch classifier machine, would it always agree with the human ear?

Re:Music theory for nerds (2016) by sevagh on Wednesday February 16, 2022 @11:33AM (#30362097)
I don't know much about the Shepard scale.

Regarding a pitch classifier machine, typically algorithms for pitch classification/tracking/detection focus only on the fundamental frequency (or f0) of the input sound wave. So, _technically_ pitch and f0 are used interchangeably where they shouldn't be.

I have yet to see a pitch classifier machine that tries to implement the special workings of the human auditory system.

Re:Music theory for nerds (2016) by parenthesis on Wednesday February 16, 2022 @01:05PM (#30363366)
Frequency is measured in hertz (Hz), where 1 Hz means 1 cycle per second, 440 Hz means 440 cycles per second etc.

Periodic sounds above about 20 Hz are perceived is being `pitched'. Our perception of pitch is logarithmic. I.e. if you keep multiplying the frequency of a sound by the same number we perceive the pitch as going up in equal steps.

For example, to go up (an equally-tempered) semitone (aka half step or half tone) — which is usually the smallest pitch distance used in music — you multiply the frequency by 2^(1/12) (roughly 1.059463).

To go up an octave in pitch, you multiply the frequency by 2. But going from the pitch A3 (220 Hz) to the note an octave higher, A4 (440 Hz), sounds like the same `size' of increase in pitch as going up an octave from A4 (440 Hz) to A5 (880 Hz), even though you are now going up 440 Hz instead of 220 Hz for the previous octave.