I've spent a bit of time recently on one particular coding project of mine: Go-Sound, which is a library for sound manipulation and analysis written in Golang. When explaining it to people however, it turns out that not many people know how sounds work - indeed, I didn't until recently - which is interesting as it's something we use all the time (statistically, you're probably hearing something while reading this) but don't really know much about. This post is an introduction to the library, but also hopefully serves as a tutorial about what sound actually is.
Sound = changing pressure
When you hear a sound, what are you actually sensing? Sound waves are actually changes in pressure that are picked up by your eardrum. When you hit a drum, or pluck a string, or blow air through a tube, you are vibrating the air, and these pressure changes travel out in all directions - if they hit an ear, those changes will get interpreted as sounds. Once convenient way to represent …
One technique I have to admit to developing for passing short periods of time is watching clips of skilled Mario players streaming on twitch/youtube (e.g. this guy is a good demonstration). I'm also a sucker for informational theories, in particular the asymmetry of knowledge: How you gain information ('learn') is very different from how you lose it ('forget').
At the intersection of Mario and Information systems is a thing called the Kaizo block. What is it?
For some background, Kaizo ('reorganized') Mario is a name that originated from an early hacked version of Mario that upped the difficulty substantially, and is now associated with many of the more complicated mechanics. One in particular can be seen above: a Kaizo block is one that starts off invisible, and only appears when you hit it. Often placed in the most inconvenient locations, they force much more precise movement, but also are very easily hit the first time through when its existence is unk…
If you haven't yet, read Part 1 first, an introduction to what sound is.
I left off last time with a description of sound as changes in pressure, and notes as waves within these. On natural progression from this is: given the samples of a sound, how can you tell what notes are playing?
As I'm doing psychology, I'll take a small diversion here to rephrase that to: how does your ear do it? That is, given vibrations from your ear drum, how does your brain tell what notes are playing?
Before answering that, first it's good to know about resonance frequency - as you can see from this video, items that make noises when hit tend to have a resonant frequency, that is, the rate at which they vibrate in a cycle. Similar to pushing someone on a swing, if you push an object at this frequency, it will strengthen the resonance.
So how is this useful in regards to ears? The leading theory is that there's a section of your ear with lots of tiny hairs along a tube. Based on the…