 bolted thought to cross my mind. Hi, I'm Gabe, someone like two minutes ago five minutes ago just asked me how practical is my talk. So let's dive into the impractical for a little bit and maybe we can I don't know figure stuff out. I think I think it's fun to have be curious about stuff and dive into things that might not be totally practical whatever that means and then maybe you can come we come to the other side and find something practical. Okay, just a little bit of background of like how why I'm here how I got here what it is that we're doing. For like half of my adult life I used to be in an indie rock band and spent a lot of time writing music recording music touring music is the primary framework that I use to understand life still is. Fast forward some years later and I discovered programming and Python so instead of working with these dorky dudes I'm working with these dorky dudes and women sorry at Magnetic. It's an ad tech company and I mentioned it because there are two parts of what we do at Magnetic that kind of brought me to this interesting question so we do some that's an ad tech company we do something called real-time bidding we deal with a lot of data and a lot of streaming data and we do something called programmatic advertising right which kind of like what I play music I work in programmatic advertising what if we combine the two and make something called programmatic composition which reminded me of John Cage just like this institutional minimalist composer probably not in your playlist daily most famous for I forget the title or the length of time but was just there it is maybe on your place maybe we could listen to that all the time but he had a piece of music called music of changes which was a piano composition that he kind of wrote and based on throws of the I Ching and it led like he made all of the all of the musical composition decisions fall to the I Ching and I thought that was kind of an interesting idea so that's one thread what if we just instead of writing music we write read a batch of code that made all of our musical decisions for us so that's one one threat the other side of it this is a graph this is another graph obviously we do a lot of data visualization right that is a well established beautiful science and art under the hood if you want to call that in data visualization information design we successful data visualization the data visualization works because it kind of accesses our like shared library of things that we already understand visually like we we understand proportions scale and perspective foreground and background like these are like images of like chair a screw up painting and Renaissance painting have been like in our minds and inserted into our brains since forever right so successful data visualization works the most successful data visualization works that I would argue is exploits all of these these beautiful things color theory perspective and scale and of course Edward Tufty is like the guy that talks about this very well much better than I just did in one slide so the other thread is what if we did this for for sound like why do we visualize just visualize it oh I don't we also audiate data data audience so it's a term that that I found by this guy Edwin Gordon who he does like writes about music theory and music learning primarily so the idea is basically to come up with a way to like access our shared knowledge base of Western music if we can do that just as data visualization and codes data visually in a way that accesses the shared knowledge space of of like Western art let's say I thought it'd be interesting to try to try and that's like the main main term the impractical term that to try to do that using scales harmonic series dissidents a tempo arpeggiation things that we use in music and we listen to music all the time and it's in our brains anyway right well like this is just this experiment so that's what this is this is what this is just an experiment to see what that might be like so I wrote this little library that really is just like a wrapper for two other libraries called tonal that the idea is to parse numeric data and kind of normalize it in a way and and put it into note buckets that are that might make sense to our ears as Western music listeners I'm not gonna get into microtonal Eastern stuff but that's also really like five years from now after I figure this one out so yeah so what I did in this project is I wanted to just do this very simply rudimentary so what I did is I wrote this thing that queries like a weather free weather API that gets like temperature humidity dewpoint all these all these things parses that uses some some some Python libraries I'll talk about that kind of put puts everything into note buckets right and then creates MIDI data which is MIDI is like musical instrument digital interface something like that and it's like if you have like a like an electronic keyboard and you plug it into it's like the it's the way that notes get passed it's just like a standard form and I'm using this software called Ableton live it's like I don't know it's like I made not electronic music I used to call warm organic music as it is warm and organic and I was like shied away from a lot of digital music but it's a really great piece of software if you know make such things but they're a bunch of like reason logic they're like a whole host of things so it basically like wanted to it's funny because when at work people make fun of me for the for my I don't know what you call these things for whatever these things are because I was to pick the wrong shapes so I was like screw it it's gonna be like a cloud into a box like no one's here to comment that I chose the wrong shapes for the but then there are two people that work with you guys might make it later so yeah so that's what the sense I'm just gonna go through the steps this is like I saw this talk is like a like a kind of a novice Python talk you know like I originally I was like I can toss the toss the data in a Kafka cluster and topic and read off of that but that's what's got silly okay so here's what I used to do this midu is a Python library that's really easy to use to send MIDI data it's pretty straightforward and it worked was like the one that worked properly for me there's this great library called Mingus that's like it's a music theory library so it's like you give it like you give it like a scale that you want to use and a key and it just tells you like the the notes in that scale and key so use that there's this library called Pi live which interfaces with Ableton not using it in here but it's also like I was playing with things that would it's a way to control Ableton but it's it's not like in the scope of this talk and of course like requests to get the stuff and just so in this live demo which hopefully the Internet work I used data dog and the stats to your library which was written by Etsy to just like so you can see what we're hearing hopefully hopefully that will happen and then Ableton I just talked about in tonal is the thing that hopefully we'll do this properly okay so just to go through the the steps the basic steps you get the data so get requests parse the data I'm doing it doing just weather data for like lower Manhattan I think City Hall of Latin Logitude looks comes back like this we all know what Jason looks like and I'm pulling out it's the the get request is a like an hourly log it's like you get like 50 to 60 ish depending on how it feels for some reason pieces of these things it gives you like an hourly log and just cycles through pulls out things so we can hear what this weather might sound like if we were wanting to make a composition out of it for some impractical reason so what my guy does is like it builds basically MIDI has a range of zero to 120 this is like the full octaves on like a piano starting with something and anything else notes and we know it's all integers and the data comes in pull out the pull out the value and after telling after deciding what what key and what scale you want to use generate this array this list of integers and my I just like kind of stupidly if it's like between you know sign it to one of these guys randomly so it's not like the most sophisticated thing does that then we send them in we use midu to send the MIDI notes so under the hood for this guy is that Mingus library that gives you like the base range so it'll give you 1 through 8 or 11 there or 0 through 11 and then we build the octaves around around these base these space set of notes then we send the MIDI notes and then midu as I said is a very simple library and just says turn the note on and you could you know the mapping here that mapping function is the value and if it's a value that doesn't fit into the range it normalizes it so that it can't fit into the range based on like the other ones that it's seen before and the velocity is kind of like how hard you would strike a key let's say and the channel is the MIDI channel okay so let's see if this thing works really talked fast through that okay so it's been running this whole time that's fun so this is the representation of what I'm sending in okay so script okay let's give it a harmonic major because we are happy today so that's the scale and let's start it in the key of a so this is the it's parsing it getting the value and sending into these different channels here and then this is already started up so this is all the data feeding into one all of the tracks and what all of the channels fed into one so it's it's kind of cycling through the past hour of our pitch so I'm building like a arpeggiating chord let's make a record out of this thing right yeah I was thinking that'd be really actually really interesting to go through like historical like replaying data right I don't know like financial markets stock crash you know just like what does that sound like and then like make make songs out of this maybe not something so depressing but I don't know just seems like it would be really interesting like crescendo or draw for me that it opens this path to just experiment and try different there's no established there's like a really good vocabulary for it's not as practical and that is like you know it's like but I feel like it can lead to something really interesting so that's that's well this is just the past like hour going back so yeah so like to go through and just like when we have to sit and listen to stuff and then it was someone that I was talking to saying maybe you could listen to music that's generated by your keystrokes of it's like strange like the github is the github.com back slash gable of G A B E L E V like Victor yeah because I'm applying that order to it yeah for sure yeah so like this is like the this is the my aesthetic decision to make it not sound because I had it going all over the place right so like I like through the arpeggiation you're deciding how fast the notes that are coming in right it's just iterating over a set of notes in a chord so it's like yeah or scale but a chord okay that's any other questions yeah that'd be really interesting yeah because I'm making I mean like I you know I call I'm calling a programmatic composition but I am of course making a lot of decisions but I would love to like abstract it out further and further to to have the data itself make these decisions so that's what's happening right now it's like a very simple way to do that right no I haven't I haven't this was just say that again I haven't done that yet so we'd like taking the taking the the MIDI and setting it or just like we're disregarding all right yeah no it's definitely like things to to explore in that no so no I have not five minutes early three minutes early two minutes early that's not too bad thank you everybody