http://www.windytan.com/2021/11/spiral-spectrograms-and-intonation.html absorptions a blog about sound & signals by windytan [oona raisanen] Pages * home * list of posts * about & FAQ * my nerd story Spiral spectrograms and intonation illustrations by Oona Raisanen (Oona Raisanen) Sunday, November 28, 2021 I've been experimenting with methods for visualising harmony, intonation (tuning), and overtones in music. Ordinary spectrograms aren't very well suited for that as the harmonic relations are not intuitively visible. Let's see what could be done about this. I'll try to sprinkle the text with Wikipedia links in order to immerse ( nerd snipe?) the reader in the subject. Equal temperament cents against time We can examine how tuning evolves during a recording by choosing a reference pitch and plotting all frequencies relative to it modulo 100 cents. This is similar to what an electronic tuner does, but instead of just showing the fundamental frequency, we'll plot the whole spectrum. Information about the absolute frequencies is lost. This "zoomed-in" plot visualises how the distribution of frequencies fits the 12-tone equal temperament system (12-TET) common in Western music. Here's the first 20 seconds of Debussy's Clair De Lune as found on YouTube, played with a well-tuned (video) and an out-of-tune piano ( video). The second piano sounds out of tune because there are relative differences in tuning between the strings. The first piano looks to be a few cents sharp as a whole, but consistently so, so it's not perceptible. [Image: Two spectrograms labeled 'Piano in tune' and 'Piano out of tune'. The first one shows blobs of light along the center axis. In the second one, the blobs are jumping up and down the graph.] The vertical axis is the same that electronic tuners use. All the notes of a chord will appear in the middle, as long as they are well tuned against the reference pitch of, say, A = 440 Hz. The top edge of the graph is half a semitone sharp (quarter tone = 50c), and the bottom is half a semitone flat. Overtones barely appear in the picture because the first three conveniently hit other notes in tune. But from f5 onwards the harmonic series starts deviating from 12-TET and the harmonics start to look out-of-tune (f5 = -14c, f7 = -31c, ...). These can be cut out by filtering, or hoping that they're lower in volume and setting the color range accordingly. Six months later... You know how you sometimes accidentally delete a project and have to rewrite it from scratch much later, and it's never exactly the same? That's what happened at this point. It's a little scuffed, but here's some piano music that utilises quarter tones (by Wyschnegradsky). I used the same scale on purpose, so the quarter tones wrap around from the top and bottom. [Image: Similar as above, but blobs are also seen at the very top and bottom of the graph.] More examples of these "intonation plots" in a tweet. This suits well for piano music. However, not even all western classical music is tuned to equal temperament; for instance, solo strings may be played with Pythagorean intonation[1], whereas vocal ensembles[2] and string quartets may tune some intervals closer to just intonation. Unlike the piano, these wouldn't look too good in the equal-note plot. Octave spiral If we instead plot the spectrum modulo 1200 cents (1 octave) we get an interesting interval view. We could even ditch the time scale and wind the spectrogram into a spiral to make it prettier and preserve the overtones and absolute frequency information. Now each note is represented by an angle in this spiral; in 12-TET, they're separated by 30 degrees. At any point in the spiral, going 1 turn outwards doubles the frequency. Here's a C major chord on a piano. Note how the harmonic content adds several high-frequency notes on top of the C, E, and G of the triad chord, and how multiple notes can contribute to the same overtone: [Image: 12 note names labeled around a spiral. The C, E, and G notes light up sequentially, and their frequency and harmonics are displayed on the spiral.] I had actually hoped I would get an Ultimate Chord Viewer where any note, regardless of frequency, would have all its harmonics neatly stacked on top of it. But it's not what has happened here: the harmonic series is not a stack of octaves (2^n), but instead of integer multiples (n). Some harmonics appear at seemingly unrelated angles. But it's still a pretty interesting visualisation, and perhaps makes more sense musically. This plot is also better at illustrating different tuning systems. Let's look at a major third interval F-A in equal temperament and just intonation, with a few more harmonics. [Image: The interval alternates between 400 and 386 cents. When it's 386, a few harmonics of the F note merge with those of the A note.] The intuition from this plot is that equal temperament aims for equal distances (angles) between notes and just intonation tries to make more of the harmonics match instead. Even though the Ultimate Chord Viewer was not achieved I now have ideas for Christmas lights... A shader toy This little real-time GLSL demo on shadertoy draws a spiral FFT from microphone audio. But don't get your hopes up: The spectrograms in this blog post were made with a 65536-point FFT. Shadertoy's 512px microphone texture offers a lot less in terms of frequency range and bins. This greatly blurs the frequency resolution, especially towars the low end. Could it be improved with the right colormap? Or a custom FFT with the waveform texture as its input? References * Loosen, F. (1994): Tuning of diatonic scales by violinists, pianists, and nonmusicians. Perception & Psychophysics 56(2): 221-226. * D'Amario, S., Howard, D.M., Daffern, H., Pennill, N. (2020): A Longitudinal Study of Intonation in an a cappella Singing Quintet . Journal of Voice 34(1): 159.e13-159.e27. Labels: music Older Post - 2 comments: 1. [blank] Anonymous28 November, 2021 22:34 What's your opinion on "Constant Q transform"? Compared to DFT, it returns the frequencies on a logarithmic scale instead of linear, which could be useful for music... but if one can afford large windows, perhaps an FFT is all one needs. ReplyDelete Replies 1. [blogger_lo] Oona Raisanen28 November, 2021 22:39 Thanks, I hadn't heard of that! Looks really interesting for the purpose. Delete Replies Reply Reply Add comment Load more... The comments section is pre-moderated; it will take some time for the comment to show up. You might want to check out the FAQ first. Subscribe to: Post Comments (Atom) absorptions Absorptions is one computer geek's personal hobby diary. I write about my research and adventures in the world of signals and sound, and fun things I do with the computer. See the FAQ. I'm on the fediverse and Twitter Labels biohack (2) computer art (8) computer vision (6) cryptography (4) FM subcarriers (9) hardware (15) infodump (16) life hack (2) Linux (5) music (5) Perl (4) puzzle (2) reversing (11) security (5) signals (34) toys (5) two-way radio (4) Popular Posts * [dialup-fin] The sound of the dialup, pictured If you ever connected to the Internet before the 2000s, you probably remember that it made a peculiar sound. But despite becoming so familia... * [bitteja] Mystery signal from a helicopter Last night, YouTube suggested a video for me. It was a raw clip from a news helicopter filming a police chase in Kansas City, Missouri. I q... * [IMG_0541a] Decoding radio-controlled bus stop displays In the previous post I told about the 16 kbps data stream on FM broadcast frequencies, and my suspicion that it's being used by the bus... * [rdstmc] A determined 'hacker' decrypts RDS-TMC As told in a previous post , I like to watch the RDS-TMC traffic messages every now and then, just for fun. Even though I've never had a... * [IMG_4114a] Eavesdropping on a wireless keyboard Some time ago, I needed to find a new wireless keyboard. With the level of digital paranoia that I have, my main priority was security. But ... * [darc] Broadcast messages on the DARC side By now I've rambled quite a lot about RDS, the data subcarrier on the third harmonic of the 19 kHz FM stereo pilot tone. And we know the... * [IMG_7613] The burger pager A multinational burger chain has a restaurant nearby. One day I went there and ordered a take-away burger that was not readily available. (E... Check out these blogs * Hack a Day * Gough's Tech Zone * DataGenetics Powered by Blogger.