If you blog it they will come?

Showing posts with label probability. Show all posts
Showing posts with label probability. Show all posts

Sunday, February 12, 2012

This weekend was one well spent as I participated in Music Hack Day SF for the first time.

I initially partnered with Kelly Dunn, who has been working on a project to send OSC messages triggered by Sifteo cube user interaction events (more here: Siftosc).

From 2pm on, we toyed with the idea of creating an air drum setup, which treats the cubes as shakers or drum sticks, using Renoise's built-in OSC server. Ultimately this didn't pan out since we weren't able to trigger note events without preprogramming a beat into Renoise, but Kelly did get the shaker implementation working and went on to do a crazy hack where he used the Sifteo cubes to manipulate his monome controller .

I moved on to experimenting with PureData on iOS with libpd a good 3-4 hours later. I got a basic grid-based synth working, but was unhappy with the sound quality on the iPhone simulator, which is a known issue with libpd. I learned a lot about puredata and could have potentially demoed the app despite its annoying distortion issues, but since I didn't have a device to deploy to and it was still before midnight on the first day, I decided to start over with something else.

Looking for examples of manipulating microphone input on iOS, I found aurioTouch, a powerful demo app created by Apple to showcase audio processing with the microphone. I started tinkering with this but was starting to feel fatigued from wrangling libpd and wanted to move on from audio low level synthesis.

I took an hour break and decided to work on a zany, assuredly demo-able project.

Enter sideTrack. It's a Rube Goldberg-esque python script which leverages many different APIs to mutate an initial seed song many times over until it eventually plays a completely unpredictable song, while speaking the nonsensical phrases it uses to perform each search.

Similarly to how one might fall down a wikipedia hole, this python script uses random lyrics, geography, song titles and more to repeatedly mutate different searches into a track with a spotify url, which is finally played via AppleScript after exceeding a depth limit parameter.

It leverages APIs from MusiXMatch, EchoNest, Spotify, and google maps to mutate the songs at each depth level. It worked and the results were always surprising. I was grateful to receive generous prizes from spotify and 3scale.

Here's a screen cap of sideTrack:


Regardless of frustration from my numerous aborted project ideas, music hack day was a ton of fun. I met some very talented and passionate folks, and eagerly await the next music hackathon.

Thursday, July 16, 2009

Loblaw's law

When you have numbers that are really really really big, you can stop talking about probabilities and start talking about laws.

Statistics are often unintuitive for people, and the Monty Hall Problem is a famous example of that un-intuition in action.

And of course, as humans, we distrust machines. And statistics are, so far, the best tool machines have for imitating humans in areas such as language and vision. How we hate these machines, with their statistics.

Yes, so if you are a human reading this, you may feel a certain amount of smugness knowing that language is a built-in feature for you; you can read an article and comprehend with absolute certainty its key points and discuss it in an intelligent and natural way. Even if a computer were able to analyze the same article, it could only offer up soulless suggestions of meaning with varying degrees of certainty, and with little or no actual intelligence.

But as it turns out, you and I live in a crazy universe not governed by laws so much as statistics.

Mandatory Djikstra quote: The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.

On their own, atoms can be in several possible states, each with varying probabilities, where the most probable state has lowest energy.

With more heat added to a closed system such as a gas, the likelihood that each atom is in a higher energy state increases. Each macro state view of the entire system is equally likely, keeping in mind that particles are coaxed from lower micro energy levels with likelihood directly linked to the work performed on the system. All arrangements of molecules in the container are equally likely and they are all interchangeable with one another.

Now if you were to take each of these equally likely macro energy states and group them in buckets by total energy level of the system, the distribution would produce a bell curve. So, looking at this bell curve, you could state with some amount of certainty the likely range of energy (temperature actually).

EXCEPT, that's not how the universe actually works!!

The contradiction arises because the number of particles is on the order of 10^23.

So there's still a bell curve, but it's not really a curve so much as an extremely tall spike with almost zero width and almost no variance. Temperature and entropy and the first and second "laws" of thermodynamics all work because 10^23 is an enormous, enormous number, and the expected value (the center of the curve) is the only value anyone actually ever experiences.

To illustrate I'll create a law right now, named after a brilliant attorney, called Loblaw's law. Loblaw's law states that it is not possible to flip a (normal) coin 10^23 times and produce only heads each time. You may say, well technically that is still possible, so how can it be a law?

Well, technically it is (sort of) also possible for the entropy of the universe to decrease for a few minutes. Technically, it is also possible that heat could flow from a cold object to a hot object. Technically, a broken egg could assemble itself from the floor and leap back into my hand...blah blah blah, Loblaw's law is a law because these events are so unlikely that it they will never happen.

That's the way it goes with ginormous numbers, and that's why we can call them the laws of thermodyamics, although a better name for the field is actually Statistical Mechanics.

Back to computers, the point is that statistics is a strength, not a weakness of computers which may perform natural language processing, image recognition, or other tasks wherein humans naturally have the upper hand. Feed a somewhat sophisticated AI a few petabytes of salient data and I believe suddenly that Dijkstra quote will ring true.