<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alec Petros on Medium]]></title>
        <description><![CDATA[Stories by Alec Petros on Medium]]></description>
        <link>https://medium.com/@alecpetros?source=rss-74cfddd678e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ac9mtkI9daF3q_bO.</url>
            <title>Stories by Alec Petros on Medium</title>
            <link>https://medium.com/@alecpetros?source=rss-74cfddd678e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 14:09:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alecpetros/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Coding as a Bridge]]></title>
            <link>https://medium.com/@alecpetros/coding-as-a-bridge-bfbe73248ae2?source=rss-74cfddd678e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfbe73248ae2</guid>
            <category><![CDATA[bootcamp]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Alec Petros]]></dc:creator>
            <pubDate>Fri, 10 Aug 2018 18:08:19 GMT</pubDate>
            <atom:updated>2018-08-10T18:08:19.505Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-q2myMZ9E7qARYd_cQOS9g.jpeg" /><figcaption>i will proceed to attach several pictures of nice looking bridges</figcaption></figure><p>When I started my walk down the dark and terrifying path of coding, I did so because it seemed like the only way to link certain applications was through running scripts I found on Github. I remember feeling like a hacking god the first time I got video output from Ableton visual noise generators to show up in the same Processing sketch as my Resolume output. And while my professional path has led me far from my early days of gluing disparate applications together, I still find myself approaching coding as a <em>bridge </em>in many cases.</p><p>In several artforms, there’s a kind of floating sense that nothing is <em>truly</em> original. The simple, great ideas have been spit out and regurgitated over the years, and ‘modern’ trends tend to recycle and alter ideas from 20 years prior. While I don’t think this is entirely true, there’s a nugget of valuable information there: <em>So many</em> great ideas are out there already, building blocks laid down by giants before us, and we can use them to build bigger and better things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*vB6o1pzz2IAhmmDilSoo8g.jpeg" /><figcaption>isn’t that pretty</figcaption></figure><p>Take Ableton and Resolume, for example. The wonderful people at Resolume saw fit to build out what interaction between the two live performance apps they could, but at the end of the day, creative use of Processing, Max 4 Live, and Syphon open up an entire universe of creativity and flexibility that could never realistically be covered efficiently in the core application.</p><p>Similarly, with <a href="http://algorhythm.alec-petros.com/">Algorhythm</a>, I didn’t create some brilliant new relational algorithm, but instead simply found a way to twist Spotify’s wonderful API to provide a service that I found myself wanting — a twist on the recommendation functionality that Spotify already had, but with more direct user control. And I’ve found myself using the functionality time and time again.</p><p>As a new developer, we are frequently told to find a compelling project to work on as a way to learn quickly. For me, independent projects have been absolutely crucial to my learning. However, many people I know seem to get blank-slate anxiety — when faced with the whole world of potential projects, they get freaked out and wind up building yet another task list manager.</p><p>If this sounds like you, consider building a bridge instead of building a whole town. Instead of building some elaborate new suite of functionality, and expecting yourself to Steve Jobs some brilliant idea into existence, simply extend the functionality of an api or program, or build out some link between applications that you like. Don’t reinvent the wheel, hop on the backs of some giants instead and go for a ride.</p><p>And now for some more bridges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*p0ntQtGKJPTsfboJlr5tvg.jpeg" /><figcaption>this seems excessive</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*douayrJsYcaGP_fYIKvVZA.jpeg" /><figcaption>this is where i want to be</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfbe73248ae2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seeing Sound Part 4: A Visual Instrument]]></title>
            <link>https://medium.com/@alecpetros/seeing-sound-part-4-a-visual-instrument-d1cff17e91f0?source=rss-74cfddd678e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1cff17e91f0</guid>
            <category><![CDATA[ableton-live]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[processing]]></category>
            <category><![CDATA[music]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Alec Petros]]></dc:creator>
            <pubDate>Wed, 02 May 2018 17:52:54 GMT</pubDate>
            <atom:updated>2018-05-02T17:52:54.765Z</atom:updated>
            <content:encoded><![CDATA[<p>Music production is a strange beast. On the one hand, you are most certainly a musician of sorts, and a huge majority of producers started out playing <em>something,</em> but on the other, your musical environment is typically sitting in front of a computer &amp; hardware rack, clicking through VSTs and turning knobs and tweaking sounds endlessly until you achieve the sound you want.</p><p>Before I picked up production, I played a variety of instruments. While I was never any kind of decent soloist or improvisational player, I always loved the instant feedback and freeing experience of just jamming. Coming in with nothing planned out, playing a lick, and seeing where it takes you. As much as I loved music production when I started learning, I constantly sought for that level of immersion in my music.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gxP7fhLbBrz2sQlYKeY_Mg.jpeg" /></figure><p>Enter Ableton Live. Ableton is a DAW (Digital Audio Workstation) built around the workflow of old-school samplers and sequencers. Rather than laying out files or strips of MIDI in a linear fashion, like Pro Tools, Logic, or Reaper, you can construct a grid of midi or audio <em>loops</em>, which can keep themselves in time and fire at the tops of measures, so you can coordinate and fire and entire song, in realtime, by yourself. This workflow made sense to me. Suddenly, I could fire a drum loop, improvise some guitar over top, immediately loop it, drop another backing part in the adjacent track, loop <em>that</em>, kill the drums and start a new beat for the break, etc… all in almost-realtime.</p><p>So when I finally got my LED matrix up and running, and could syphon video to it at will, my first instinct was to find a way to make designing visuals for it as intuitive as constructing music in Ableton — and what better way than by leveraging Ableton itself?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqaU3-fJFghQ3oipZVEzHg.jpeg" /></figure><p>All major music software &amp; hardware these days communicates over MIDI. MIDI is a protocol for communicating musical information — a channel can transmit 127 notes, each with a <em>velocity</em> (how hard you hit the key) of 0–127. It can also send CC (Continuous Controller) information, like knobs and faders, with a value of — you guessed it — 0–127. Since this is a nearly universal standard, it’s not uncommon to find all sorts of interesting projects leveraging MIDI. So how hard could it possibly be to rope MIDI into Processing?</p><p>Turns out, not hard at all. MIDIBus is the Processing library that opens the doors to MIDI communication in Processing. By routing MIDI out to a virtual bus in the computer (Mac has built-in utilities for this), MIDIBus can grab the information and pass it in as a series of integer values that we can then put to work within Processing.</p><p>My first task was to get something on the screen. I set up an array to store all the incoming data. The index would reference the note number, and the integer stored would reference the incoming velocity. Within my draw function, I simply iterated through whatever notes I wanted to render an image and set the <em>alpha</em> of the RGBA to whatever the incoming velocity was. Additionally, some funky mapping and math put each of the 64 notes I wanted to display on an 8-by-8 grid across the entire screen. The obvious problem with this, though, is that once the notes are up, they’re there to stay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gAcSHHUKD0xI5D4yz8nxPw.png" /></figure><p>So I included a <em>decay</em> value for every note — each frame, it would decrease in value by a set amount till it reached zero. Cool. Now we’re getting somewhere. Next, I set up more storage for CC values. Since Ableton typically operates in sets of 8 knobs, as does the MIDI hardware I prefer, I can make this a much smaller array. To get some more hands-on control, I mapped one knob to control decay rate, and three to control the R, G and B values of the orb color. Now we’ve got some flexibility. Hitting record and playing with the buttons and knobs lets us loop and modify our orb visuals fluidly, in realtime.</p><p>Following this logic, I’ve continued to build out a massive processing sketch, using MIDI rolls and drum racks in Ableton to control everything from simple full-screen color burst effects, to enabling / disabling audio reactive programmed elements. After a little bit of practice, hopefully, I’ll be able to bring Ableton along to a DJ set and play the visuals along with the music, live. And the beauty of it? Because of Ableton’s modular nature, I can save down midi clips for specific songs if I so desire, and fire them in whatever sequence I want, if I want something more complex than I can realistically do with two hands.</p><p>So, to conclude this four-part adventure into the weird world of mixing Processing with everything under the sun, I’d like to say this: Code is a tool. A phenomenal tool. At the end of the day, all you need is a good idea and some baby steps in the right direction and there’s <em>some way</em> to get there. Before starting this project, I’d never touched Java. I’ve still never touched it outside the context of Processing. Despite that, I’ve been able to wrangle it into the rough shape of a program I could have only dreamed of three months ago.</p><p>Get out there and make something.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1cff17e91f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Learning]]></title>
            <link>https://medium.com/@alecpetros/the-art-of-learning-287287b81c7d?source=rss-74cfddd678e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/287287b81c7d</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[music-production]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Alec Petros]]></dc:creator>
            <pubDate>Tue, 17 Apr 2018 16:47:14 GMT</pubDate>
            <atom:updated>2018-04-17T16:47:14.648Z</atom:updated>
            <content:encoded><![CDATA[<p>Before I took the dive into web development, a decent chunk of my income came from teaching electronic music production. Music production is an unholy tangled mess of a process, with infinitely branching schools of training and process. While the internet is full of educational material, half of it is bad advice by people with no credits, half of it is good advice written in such a way that it scares off new students, and half of it is good advice that somehow conflicts with other good advice.</p><p>So while music production, like coding, has become more accessible than ever before, the body of knowledge available can be outright terrifying to a new student. On top of that, both fields are awash with talent — everywhere you look, you see examples of masters of their craft outputting projects drenched in subtlety, nuance and grace. How can our hapless student ever hope to hold her own work up against such perfection?</p><p>The book that started me down the path to answering this question was <a href="https://www.amazon.com/Art-Learning-Journey-Optimal-Performance/dp/0743277465">The Art of Learning, by Josh Waitzkin</a>. The book tells of his journey from one of the world’s finest chess players, to one of the world’s finest Tai Chi competitors, and how he approaches <em>learning</em>, specifically. I picked this book up on the recommendation of Sean Plott, the man who made Starcraft accessible to the American masses. He recommended it as a path by which to refine Starcraft play — an incredibly complex, competitive, and mentally demanding game. Although my Starcraft play is still mediocre at best, the concepts I picked up in the book have helped me refine my own learning efforts, as well as pass on salient advice to students who hope to reach for the stars.</p><p>First, let’s address the fear. In his book, Josh writes, <em>“The key to pursuing excellence is to embrace an organic, long-term learning process, and not to live in a shell of static, safe mediocrity. Usually, growth comes at the expense of previous comfort or safety.” </em>This quote rocked me particularly hard. Suddenly, a master of his craft was telling me, <em>It’s okay to be scared. It’s okay to be uncomfortable. It’s okay to not be a phenomenal talent right out of the gate. </em>So how has this played into my own learning efforts? I have made an effort to embrace the difficult. When you find yourself sitting down and thinking, <em>Yeah, I could do that, but that sounds like a bit much,</em> quell that part of your mind. It is safe, and boring. Reaching for that slightly-crazy idea, pushing yourself to make your sounds a little more perfect, dumping hours into getting that perfect mix, or chopping dozens of not-quite-right Stack Overflow responses into the function you actually need — this is the valuable learning, the learning that pushes you leaps and bounds ahead in the game.</p><p><em>But Alec</em>, you say, <em>What if it doesn’t work? </em>All the better. We learn best from our mistakes. If you nail something on the first try, great! You’ve learned how to do that thing. But if you flail around and struggle with something for hours, try dozens of different versions, attack the problem from different angles, <em>now</em> you’ve learned countless discrete tidbits of knowledge, and a plethora of new approaches to the issue that, while they weren’t the right approach for that specific problem, will be sitting ready in the back of your mind for the next problem.</p><p>John attacks another critical stumbling block for many new coders and producers in his book — what to learn? <em>“Depth beats breadth any day of the week, because it opens a channel for the intangible, unconscious, creative components of our hidden potential.” </em>This quote brings to mind a concept I learned about while firedancing — <em>flow</em>. Flow is the mental state of peak creativity and performance. Flow happens when your planning, worrying, judging mind cedes the reins to your momentary, creative, and flexible mind. Flow happens when you relinquish a certain element of control, and it can only happen when a thing becomes second nature — when you don’t have to think about how to <em>do</em> the thing, but merely <em>what you want to create</em>.</p><p>While this sounds very artsy and not at all applicable to cerebral tasks like coding or producing, I believe elements certainly apply. Consider the new developer, drowning in a sea of languages, with everyone telling her how she should learn Python — no wait, learn Rust, it’s so flexible! — nonsense, learn C, it’s the best foundation — but Javascript is so marketable — —</p><p>It’s traumatizing, honestly. If that new coder goes off and tries to learn a dozen different languages, she’ll struggle with any piece of code, regardless of what language it is in. But if she picks one — regardless of which one — and dives deep, until that language becomes an extension of her mind, and she can almost unconsciously produce functional and conventional code, all that remains is deciding <em>what to make</em>, instead of wasting time worrying about the syntax and conventions. Similarly, in production, learning two dozen synths leaves the new engineer proficient in none, whereas picking one and sticking with it will let her build almost any kind of sound.</p><p>Finally, there’s the oft-touted concept of <em>ten thousand hours to mastery.</em> At first glance, that phrase seems absolutely terrifying, but after spending some time thinking about it, I find it extremely reassuring. Ten thousand hours is a long time. But that’s ten thousand hours where, <em>no</em>, you <em>shouldn’t</em> feel like a master. It’s <em>okay</em> to be in the dark. It’s <em>okay</em> to struggle and search and flail. Don’t expect yourself to be a master, because you aren’t one. Be a student, always, and be ready to face the struggles of learning and not knowing things. Don’t let it scare you. And, most importantly, it’s not about having ‘the gift,’ but instead putting in the hours and the struggle to reach mastery.</p><p>Learning can be hard. It can be terrifying. It can be demoralizing. But it can also be wonderful, inspiring, invigorating, ecstatic. Setting your sights on a stretch project and making it actually happening is <em>sublime</em>. Learning a new way to handle a problem that’s been plaguing you feels better than a fresh shave. Don’t fear learning, and don’t fear the topic you’re studying. Embrace it, aim high, struggle, fail, and learn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=287287b81c7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seeing Sound Part 3: Beautiful Numbers]]></title>
            <link>https://medium.com/@alecpetros/seeing-sound-part-3-beautiful-numbers-2168e19db253?source=rss-74cfddd678e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2168e19db253</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[processing]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <dc:creator><![CDATA[Alec Petros]]></dc:creator>
            <pubDate>Tue, 03 Apr 2018 17:00:25 GMT</pubDate>
            <atom:updated>2018-04-03T17:00:25.560Z</atom:updated>
            <content:encoded><![CDATA[<p>By and large, there’s no better way to scare me off a project than by throwing a bunch of large numbers at me and telling me to manipulate me. My instincts are all to run, or find the fastest possible method to never look at them again. I remember celebrating the day I finished my last math class in Freshman year of college, rejoicing that I’d never face the mess of big, ugly, unwieldy numbers again.</p><p>At least, until I went back to school for coding.</p><p>While this installation of Seeing Sound doesn’t have any big, flashy set pieces to show off like the last one, I’d like to walk through some of the revelations I’ve had chugging through this project, in hopes that some other souls will glean something of value out of it. Numbers don’t have to be scary, and with a little bit of attention and foresight, can actually be made incredibly friendly in your search to make strange and wonderful software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9yA1JCrVK969MPUYcCe-pg.jpeg" /></figure><p>My stretch goal for my <a href="https://medium.com/@alecpetros/seeing-sound-part-2-building-bridges-9f89ab429582">last project</a> was to create a processing sketch that could handle incoming MIDI data from Ableton Live, and turn it into glorious, live-loopable visuals for my LED matrix. After much finagling and banging of my head against the desk, I’m proud to say I’ve done that… mostly. By using Apple’s built-in IAC driver to create a virtual MIDI bus, and using the Processing <em>midibus</em> library, I was able to get communication set up between the two programs fairly easily. The job didn’t stop there, however. Once I had data on what MIDI notes were being pressed or played, how could I turn those into visuals?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*z1Xwmxvb5kJYwisdpwFUKw.jpeg" /></figure><p>MIDI is the computer’s version of musical notation. Instead of a staff and scales, <em>pianissimo </em>and <em>fortissimo</em>, crescendos and codas, we have a series of possible notes, 0 through 127, each carrying its own <em>velocity</em> (how hard the note was hit) depending on how it was played. On top of that, we have CC (Continuous Control) messages, for all those beautiful knobs and faders, which will send their own values when moved, also from 0 to 127. Various software, from synth plugins to samplers to drum machines and more, can take this MIDI information, and make it feel like you’re actually sitting in front of a grand piano in a concert hall in Stockholm, rather than in a stuffy apartment in front of a goofy looking MIDI keyboard with enough flashing lights on it to read by.</p><p>Processing isn’t concerned with what these numbers mean, it just hands you the numbers to do with what you will. So there I was, once again confronted with a barrage of meaningless digits, and no easy way to turn them into the visuals I want.</p><p>My first approach was to get something on the page that did… <em>anything</em>. To get the data from midibus to the rest of the sketch, I initialized an array of 127 integers, and dropped a piece of code in my sketch to write the velocity of an incoming note to its corresponding spot in the array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*SMS-r2aCzA0vVDnNOEqjkw.png" /></figure><p>Now, hitting low C (MIDI note 0) at a velocity of 100 would set note[0] to 100. Great. In my <em>draw() </em>block, I set up a for loop to iterate through my note array, and draw an ellipse for each one, with the transparency of that ellipse set to the value of that note in the array. As a first draft, it worked — hitting a MIDI note in Ableton, with MIDI out routed to our IAC bus, would cause a circle to appear on the screen. Adding another piece of code to the top of our <em>for</em> loop to reduce every value in the array by a set <em>decay</em> rate until it reaches 0 made it feel a little more functional — now, a note press will reset the transparency to whatever the velocity of the press was, and then it will fade back to invisible at a speed determined by our <em>decay</em> rate.</p><p>Before I knew it, I had a bulky, ugly sketch in which I was multiplying note[i] by all sorts of weird numbers to get the results somewhere usable. RGBA color definitions operate in ranges of 0 to 255 — it wouldn’t be hard to set up an equation to get our 0–127 value to scale from 0–255 — but we might also want to use the note number to change the location of our circle across our scene, or to change our ellipse’s circle. Suddenly we’re writing dozens of ugly equations all over the sketch. There must be a better way.</p><p>Enter map(). The map function allows us to pass in a variable, then that variable’s range, and then a range that we’d like to scale it to. Good: We can use this to replace our transparency equation. Better: We can use this to replace <em>every</em> modification equation on our code. Best: We can map each note <em>once</em>, before it gets stored in the variable, and make it easily applicable to any value in our sketch.</p><p>How, you say? Limit the range to 0–1. While I’m sure this is common practice to many, the idea didn’t occur to me until I was working with the <em>Math.random() </em>function in Javascript. By multiplying the output, a random number between 0 and 1, by any number, you could easily set up the random number range to whatever you wanted. Similarly, if we <em>map()</em> our velocity value to 0–1, all we have to do to set transparency perfectly is drop in <em>note[i] * 255</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*oZzX6ciVhgTU1wuDtGZF8Q.png" /><figcaption>These six lines of code saved me hours.</figcaption></figure><p>On the micro level, this made my Processing sketch infinitely easier. On the macro level, I realized that with just a bit of foresight about how you handle data, and what it will be applied to, you can clean up miles of code. An inch of prevention is worth a pound of cure. Now, these numbers suddenly don’t seem so scary, and my code is infinitely more flexible.</p><p><em>You can dig through the current Processing sketch for my LED matrix, including MIDI control, </em><a href="https://github.com/alec-petros/ableton_sync"><em>here.</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2168e19db253" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seeing Sound Part 2: Building Bridges]]></title>
            <link>https://medium.com/@alecpetros/seeing-sound-part-2-building-bridges-9f89ab429582?source=rss-74cfddd678e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f89ab429582</guid>
            <category><![CDATA[led]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[lighting]]></category>
            <category><![CDATA[adafruit]]></category>
            <dc:creator><![CDATA[Alec Petros]]></dc:creator>
            <pubDate>Tue, 20 Mar 2018 17:50:15 GMT</pubDate>
            <atom:updated>2018-03-20T17:50:15.707Z</atom:updated>
            <content:encoded><![CDATA[<p>Although I’ve spent my time in school and out of it studying sound, I’ve always had an unhealthy fascination with lights. I didn’t get much hands-on experience with theater lighting aside from routine light hangs, focuses, and strikes, but lighting design was always a mystical world of color and flash that held a certain appeal for me. I fantasized about designing lights and visuals for my own inevitable world tour, once I was famous and closing out arenas (still waiting on that).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCbrwWH26zpyCj6ThzK0SA.jpeg" /><figcaption>actual footage of my next concert</figcaption></figure><p>To date, though, I’ve only managed to play in tiny bars with no more than a couple gelled source-4’s pointed at seemingly random directions around the stage. Not exactly the vibrant audiovisual barrage I imagined.</p><p>But everything changed when I learned how awesome Processing could be.</p><p>After my last blog post, I started eyeing the corpse of an old project — an LED matrix made with Neopixels that I’d strapped to the ceiling in my room and used as overly elaborate mood lighting. It was an experiment I took on way before I had any idea what I was doing with code, and I stumbled through the Processing side of things by chopping together bits of other peoples’ code, and had it running for a grand total of a week before I melted the LED strips by running it off a power supply with way too much voltage. Since then, the 5-foot strips of LED haven’t been good for much more than my cat’s entertainment.</p><p>Suddenly, with a newfound handle on Processing and a lesson well learned about how electricity works, it seemed like a great time for a more functional encore of the LED matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HLN-cvCoojjpIuEmHLd2ug.jpeg" /><figcaption>Neopixels, by Adafruit</figcaption></figure><p>Neopixels are a brand-name version of WS2812B LED strips, extremely bright and colorful little buggers that can each be individually addressed by a controller — meaning unlike a lot of LED mood-lighting strips, each one can be told to display a different color, like a TV screen or computer monitor. To drive them, I’ve picked up a Fadecandy, a tiny microcontroller (limited mini computer) designed specifically to drive LEDs. It handles the bulk of the image processing and layers on some extra icing like smoothing out fades — LEDs don’t like fading smoothly to black — and making colors pop. Awesome as the Fadecandy is, though, it has a one-track mind, and it doesn’t have room to think about <em>receiving</em> images, just talking to the LEDs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*MrOT_J-2ChWnwJKrzonZYg.jpeg" /><figcaption>I still haven’t worked out cable management</figcaption></figure><p>For the heavy lifting, I’ve plugged the Fadecandy into a Raspberry Pi, a wonderful little customizable credit card sized computer. Once I got it up and running, I installed the Fadecandy Server, prepped the Pi for communication over a network, and told it to run a Fadecandy Server whenever it boots. Ideally, this means I’ll never have to hook it up to a monitor and keyboard again, and I can handle tweaks and edits from any other computer on my network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*Tq2_9_00PJT0N8TbBgI5PQ.jpeg" /><figcaption>In all its glory</figcaption></figure><p>Next came several hours of soldering. Each of the Fadecandy’s 8 channels can handle up to 64 LEDs. I chose to connect two strips of 30 to each of four channels, for a total of 8 rows of 30 pixels each. Part of the Fadecandy’s magic is that you can tell it, via FCServer’s settings and a Processing library, how your matrix is arranged, so even though each channel is 60 pixels split in two running up and back down the mounting board, it can correctly address each pixel’s location. Finally, I mounted all eight strips on a 4&#39; plank of plywood, leaving some room on the far side to mount the Fadecandy, Raspberry Pi, and some power busses to fuel it all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYevw7U-GsSPDvnjyi3pxg.png" /><figcaption>The magic block of code that makes the matrix work.</figcaption></figure><p>Finally, it was time for the fun stuff. OPC (Open Pixel Control) is a library for Processing that handles orienting the pixels and transmitting — wirelessly! — to the Pi. After working out the block of code to define where each strip should live on the screen, I had a portable initializer for my LED matrix that I could drop into any sketch I wanted. To test, I fired up my visualizer sketch from the last blog — gloriously, impossibly, the board lit up like a Bon Jovi concert. My tiny Brooklyn apartment could barely handle the amount of illumination spilling out of it. I like to imagine that it looked something like the stereotypical mad scientist’s laboratory, with random flashes of light spilling out from the windows and underneath the door.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iAA8csm3HF1uuxqymbKMsw.png" /></figure><p>As cool as the visualizer looked, though, the finer details and small rings didn’t translate well to the extremely low-resolution screen I’d created. Additionally, it wasn’t very flexible. I needed to take it further, make it practical and modular, somehow. After some furious googling, I came across Syphon, a lovely piece of software that routes video between applications on your Mac, much like Loopback, the audio-routing software I’ve been using for the visualizer. After loading in the Syphon library, I could stream video from Resolume, a professional VJ (video jockey) application I picked up during my misguided attempts to do concert visuals in college.</p><p>Syphon turned out to be remarkably easy to work with. The Processing code required is pretty basic — the only stumbling block was matching framerates. Over time, the framerate of Resolume would desynchronize with the refresh rate of Processing, leading to some extreme flickering that looked pretty ugly on the pixels. Telling both Resolume and Processing to operate at 30 frames has largely smoothed that out, though, and now I have a lovely, beat-syncable, wireless, gigantic wall of lights that I can bring with me when I finally start my world tour.</p><p>What’s next? The more I use Resolume, the more I realize it’s a limiting factor to how crazy I can get with the lights. It tempo matching is limited at best, and for someone used to music sequencers, which are extremely flexible and well-integrated, it just couldn’t get me where I wanted. Luckily, I already have a fantastic piece of software that can send detailed signals digitally — Ableton Live. Since Processing can take MIDI signals, I should be able to tell it to listen for MIDI routed out of Ableton, and then use Ableton’s incredibly fluid sequencing and looping functions to create complex visuals on the fly. The catch is I’m going to have to make a monster of a Processing sketch to get all the functions I see in my head, out onto the matrix.</p><p>With any luck, my next blog post will be the glorious and flashy conclusion of this three-part journey into the wonderful world of Processing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f89ab429582" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seeing Sound]]></title>
            <link>https://medium.com/@alecpetros/seeing-sound-101a2d5d67ed?source=rss-74cfddd678e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/101a2d5d67ed</guid>
            <category><![CDATA[processing]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[sound]]></category>
            <dc:creator><![CDATA[Alec Petros]]></dc:creator>
            <pubDate>Tue, 06 Mar 2018 14:06:28 GMT</pubDate>
            <atom:updated>2018-03-06T14:06:28.352Z</atom:updated>
            <content:encoded><![CDATA[<p>For the past ten years, my life has revolved around sound. Both my passion and my livelihood have sprung from presenting, creating, destroying, analyzing, sculpting, recording, and mangling it. We humans have developed a peculiar relationship with sound. Unlike our animal brethren, many of whom rely on it for both self defense and hunting, and even sometimes navigation, we blissfully plug our ears with headphones and earbuds and go about our day pumping a huge variety of pre-recorded or streamed content from around the world. Even our recent ancestors would be baffled to hear our modern music, full of perfect harmonies and impossible sounds forged on synthesizers.</p><p>So, naturally, as soon as I had the barest grasp of some general programming concepts, I started thinking about how I could use my newfound skills to mess with noise. My searches turned up <a href="https://processing.org/">Processing</a>, a language designed around art. It can be used to animate, to create audiovisual experiences, and even to create sound. But for today’s experiment, we’re going to use it to see what our sound is doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Tw3u9apF9p7AOr0jkRpiJA.gif" /><figcaption>It’s beautiful</figcaption></figure><p>Our weapon of choice in this endeavor is the Fast Fourier Transform, or FFT. The FFT will allow us to break an incoming audio signal into separate <em>bands</em>, each spanning only a tiny frequency spectrum, and analyze the amount of signal, or <em>amplitude</em>, in realtime. We’ll accomplish this through Minim, a Processing library. You can download this from within Processing itself, by going to Sketch -&gt; Import Library -&gt; Add Library in the menu bar. Search for Minim and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*sokY5pOqr6p7a3clA2CiJA.png" /></figure><p>Now that we have Minim running, we can get started with the code. First, we need to import and start Minim, prepare our audio input, and get ready for our FFT. In Processing, our <em>setup()</em> block is for functions that need to be prepared before animation, and our <em>draw()</em> block is code that gets processed every frame to create movement and animation.</p><p>Once we have the prep work complete, we can start our <em>void draw()</em> block. Remember, this block repeats <em>every frame</em> of animation — and Processing isn’t particularly smart on its own— so although we could have prepared parameters like background color in our setup, we’ll enter it at the top of Draw instead so that our window refreshes itself every frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*heJlsHIfYRcL7pspLo_IAg.png" /></figure><p>Next, <em>fft.forward(in.mix); </em>will forward our input buffer, and the <em>stroke()</em> command is defining our line color in RGBA. Feel free to get creative. The <em>for</em> loop is where the action happens, though. This loop will iterate through every band of our FFT analysis and draw a line based on its height. The first two arguments of <em>line()</em> are our starting coordinates x and y, and the second two our ending coordinates.</p><p>And voila. If we run our code now, we’ll get a realtime FFT diagram of our mic input. While it might not be the most exciting piece of code, this is the foundation of any audio reactive code you could hope to create. By iterating through the different bands of our FFT analysis, we can check the amount of content at any frequency range — so if you want the background to change color in relation to the bass, you can do that. If you want sparks of light to appear with the high-frequency cymbals, you can do that. So grab a coffee, put on some good music, and experiment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=101a2d5d67ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>