Having finished my programming bootcamp, I thought I’d come back to SuperCollider with a fresh perspective.
I know there’s a right way to do granular synthesis (making sounds from grain-sized pieces of other sounds) in SC. This is not that way, and I’m not even sure it’s granular synthesis, as the grains I am using are pretty large, but you can adjust the size of your grains if you want the sound to be more ‘granular.’
First we load a sample:
~sample = Buffer.read(s, "/Users/matthewhinea/supercollider/buffer_files/inspectorj__wind-chimes-a.wav");
I’m using a free wind chimes .wav file, but you can use any sound file…
I set up my first Twitter bot this weekend, using Jaiden Mispy’s twitter_ebooks tool. It took a bit of tinkering and copy-pasting of JSON files (the bot was for a friend, so I had to ask them to send their JSON archive, which was split up), but the bot wrote its first two tweets from a local server on my computer Friday night and by Saturday afternoon it had tweeted its first scheduled tweet via a worker on Heroku:
As a ‘fresher, let’s define what each data type even is.
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.
A doubly-linked list (DLL) is a linked list where each node contains a reference to the previous node as well as the next node (unless the node is at the head or tail of the list, in the case of non-circular lists).
Given the binary tree below, we should end up with the subsequent DLL.
Looking at the results, it’s…
This one comes from GeeksForGeeks:
Given their example inputs and outputs, I’m going to assume inputs of only lowercase letters. If you want to assume otherwise, the following blog post will still be 99% relevant.
Here is my pseudocode for the naive implementation:
# remember: palindromes must have the same letter at  and [-1],  and [-2], etc.
# scan the string for duplicate letters
# return a single letter if no duplicate letters exist
# when a pair of letters is found, add them to beginning and end of new string, and remove them both…
[Full code available here.]
To flex my newly acquired API and Rails database muscles, I set out yesterday morning to build a Spotify random-ifier. Spotify’s API allows anyone on the web to access 30 second previews of songs, as well as their track, album, and artist info. RSpotify’s Track#search method does almost all the heavy lifting for us. Because we’re not accessing user data, we don’t even need to authenticate our app (although kudos if you do, because Spotify’s server will like you a lot more and will give you better performance). …
Note: This problem is sourced from a popular coding/mathematics website. Chances are you know the one I’m talking about, but I won’t mention it by name because I don’t want give away the answer (as per the site’s policy). That’s not to say I didn’t have to google it myself to get the O(n) down.
The problem: Find the largest prime factor of 600_851_475_143.
We’re going to be using naked Ruby for this one, so no require ‘prime’ or is_prime? magic. Of course, writing your own is_prime? method is the easy part:
Prim’s alrogithm is used to return a minimum spanning tree. For those not yet in the know, an MST is a tree made from a graph of points connected by undirected weighted edges. The MST must include every node in the graph and it must do so as efficiently as possible; that is, the sum of weights must be as low as possible. Conceptually this is not the most complicated data structure, and its potential real-world applications should be immediately apparent. Prim’s algorithm works as follows: pick an arbitrary node, add that node to ‘visited’ list, choose the smallest edge…
Catching ‘Em All
This is a great weekend to be in New York, particularly in Central Park, where there are crowds of being playing Pokemon Go basically with no reason to talk to each other in real life but with everything in common in a virtual world based geographically on our ‘real’ one and shared & inhabited by all users simultaneously — as if I needed more reason to be excited about the intersection of art, storytelling, and technology. Heading into Manhattan Saturday morning after a long first week, I was surprised at a passing feeling that I would rather…
Hello, world. I’m at a fascinating time in my life at the moment so I thought I’d blog about it. Tomorrow I begin Viking Code School, an online programming “bootcamp” I applied for on a whim in the spring when I realized community college courses were only slowing me down. Viking is legit, and I’ve already learned more in the prep work than I did in 18 credits at Spokane Community College (nothing against the faculty there — shouts out!).
On a more personal note, I’m in Brooklyn, New York! I know, random. The circumstances surrounding my arrival aren’t so…