Musical Ngrams

What are the most repeated phrases of musical compositions?  Naturally I wrote a program to tell me!

Terry Riley’s “In C” (in Perl)

The composer Terry Riley was experimenting with generative forms of music and came up with an interesting technique: Give fragments of musical phrases (motifs) to musicians to play in order, but looping however many times they desire.  This results in a sort of “free-form round” – like “Row Your Boat”, only schizophrenic with phrases appearing […]

Prime Group Percentages

As usual, I am curious about the distribution of the primes.  This morning I wondered what percent of numbers with N digits were prime.  Not an earth shattering curiosity…  Naturally, I wrote a little perl program to answer it for me. 

Bach Note Transition Frequency “Music”

What are the note frequencies of music by Bach?  That is, “How often does an F follow a C?” etc.  What does it sound like if you “reconstruct” playable music from these frequencies? Let’s see! First, we find some Bach MIDI.  I chose Jesu Joy of Mans Desiring. Next, we feed that to my note-transition […]

Bach Chorale Diversity

What is the relative statistical diversity of Bach chorale harmonisations? Ever since I stumbled upon this Bach Choral Harmony Data Set I’ve been wanting ways to analyze it! So I set out to do just that today with the Shannon Diversity Index with this handy perl code:

Traveling Salesman with Perl, R and Google Maps

tl;dr: ggplot-nyc & googlemap-nyc & TSP-Map (the Dancer app) One day I decided to glue-together a couple cool Perl modules and the visualization capabilities of R to generate a map of locations and the computed path of a traveling salesman (TSP) – who in this case is a restaurant critic.

Subsequent Prime Number Distribution

In 2016, two mathematicians, Kannan Soundararajan and Robert Lemke Oliver found that the prime numbers do not occur at random when looking at the final digits of subsequent primes.  For instance, a prime ending in 9 is more likely to be followed by a prime ending in 1, than any other digits (1, 3, 7 […]

Inspecting American Inaugural Addresses with Perl and R

Given all the inaugural  addresses of American presidents, what are the readability stats?  What is the sentiment over time? UPDATE: Results charted for 2017 As usual I reach for perl to acquire and format the data for exploration with R.  The code below (and available on github) reads and analyzes a collection of text documents.  […]

Inspecting the English Premier League Player Stats with R

Being a soccer person and programmer, I wanted to inspect player statistics for myself.  I finally found this excellent site for many leagues and primarily with player stats: whoscored.com.  So, seeing that there was no download link, I determined to tediously copy/paste all the records for each player, for defensive, offensive, passing and summary categories, […]

Musical Random Walks Over Weighted Graphs

tl;dr: https://github.com/ology/Music/blob/master/random-walk In this post, I illustrate a simple technique in Perl 5 to perform random walks over (node-edge) graphs, adding the named, “semantic” vertices to a MIDI score. The image on the left is not generated by the random-walk program, but is just a related illustration. :-) OK – on with the code! First, there […]