# Is there such thing as harmony independent timbre characteristic of a sound?

I was wondering if any of you know about any technique to extract a harmony (e.g. harmony in a shape of a chromagram) independent timbre characteristic of a sound frame.

What I'm after is a version of spectrum that will make all the piano notes look almost the same despite the fact they occupy different parts of the actual frequency spectrum.

Googling that didn't give me much yet.

EDIT: Great folks in comments pointed out some ambiguity in my question. I'm interested in a metric that is independent of the notes themselves, but captures the whole set of timbral characteristics that could help describe the instrument independently of the note content. It could be a psychoacoustical metric. I'm really curious if anyone knows anything that could fit this task. Thanks a lot!

• there may be an answer to your question, but we have to be more specific about what you mean by "harmony" and "timbre". i wouldn't use the work "harmony" to refer to the overtones of a single note (sometimes called "harmonics" when the overtone frequencies are an integer multiple of a common "fundamental"). do you mean a measure of how "bright" a note is that is independent of the pitch of the note? – robert bristow-johnson May 8 '18 at 1:08
• Piano “notes” do not have one timbre. Grouping sounds into a identifiable timbre is a human psychoacoustic behavior. – hotpaw2 May 8 '18 at 1:45
• @robertbristow-johnson thanks for pointing that out! Exactly, I was referring to the timbral characteristics that are detached from the notes themselves, i.e. if one sound has a specific set of overtones and stochastic content when you play a note with this sound, and another one has another set of said characteristics, I'm only interested in measuring said characteristics. Not really the "brightness" of the note, as a chromagram already does that to some degree, I want to essentially differentiate a piano from a guitar independently of the musical content. What kind of metric might help? – Lyosha May 8 '18 at 16:14
• @hotpaw2 thanks a lot for pointing that out! Is there a good term to call a set of timbral characteristics of a sound independently of which notes are played? I realise that piano strings, for example, might have a different timbral characteristics, so there's a spectrum there, but still - I'm interested in anything that could help me to describe this kind of thing, psychoacoustically or not. – Lyosha May 8 '18 at 16:17
• Read about piano synth physical modelling to know the topic well, especially the information on timbral adjustments as a factor of note range. Compare single note graphs for high snd low notes on a quality illustrated and readable spectrogram app to really see sound in depth, the changes per octave. – com.prehensible Nov 6 '18 at 9:16

well, since timbre is a multi-dimensional perceptual phenomenon, there is no single metric. so lotsa different metrics.

possibly the most common metric is obtained by high-pass filtering the note, measuring the average power, and normalizing that against the power of the unfiltered note and also normalizing against the pitch. and it yields a "brightness" measure. the HPF is a digital differentiator.

let your input note be $x[n]$.

differentiator output: $$x_1[n] = x[n] - x[n-1]$$

"sliding" average-power of HPF

$$x_2[n] = \sum\limits_{m=0}^{M-1} (x_1[n-m])^2 \, w[m]$$

$x_2[n] \ge 0$ and $w[m]$ is a window function.

Normalized against the note power (so that louder notes having the same timbre do not get a larger measure of brightness:

$$x_3[n] = \frac{x_2[n]}{\sum\limits_{m=0}^{M-1} (x[n-m])^2 \, w[m] + \epsilon}$$

$x_3[n] \ge 0$ and you can multiply $x[n]$ by nearly any value you want and get virtually the same $x_3[n]$. $\epsilon>0$ is necessary to add to the denominator to preclude division by zero. but $\epsilon \ll |x[n]|^2$ for most non-zero $x[n]$.

now this is normalized against different note loudness, but is not normalized against the pitch of the note. higher pitched notes will result in higher values of $x_3[n]$, even if the waveform is otherwise identical.

to normalize against the pitch of the note, you will need a pitch detector or a fundamental frequency detector. that's another whole problem and i have discussed it here on SE.

If you used a cepstrum transform which is basically a double Fourier that gives you an accurate frequency peak. You could then attenuate that and it's harmonics and/or normalize the frequency of note to a reference frequency leaving what I think you're asking for.