dave yarwood
Minutiae #3: alda-clj lightning demo, weather data, Seven Languages in Seven Weeks

date:

August 26, 2019

categories:

alda-clj lightning demo

As I mentioned in my last blog post, I had the pleasure of attending the Heart of Clojure conference in Belgium this month. Somebody suggested that I give a 5-minute lightning talk about Alda, so I signed up at the last minute and (after some hasty preparation) gave a quick demo of alda-clj.

Because it was a Clojure conference, I decided to skim through the basics and save time for some interesting examples of algorithmically generated music that I created by writing Clojure code. Somehow, I managed to get through all of the material in just about 5 minutes.

Here’s the video:

Musical forecast data

I’m continuing to develop the talk I’ll be giving at Strange Loop next month, and I think it’s coming along nicely. One focus of my talk is what alda-clj can bring to the table that isn’t possible with embedded Clojure code in an Alda score.

To demonstrate this, I came up with a fun example Clojure program that pulls weather forecast data from the National Weather Service API and uses it to generate a musical score. The generated score consists of several instrument parts, each one representing the weather forecast for a different city, and the notes’ pitch, duration, volume, and panning are influenced by the temperature, wind speed and wind direction during a one-hour period in that city.

As usual, writing a program like this in Clojure, one that fetches data from some API and transforms it into a desired result, was dead simple. It’s exactly the sort of task at which Clojure excels.

I was pleasantly surprised at how easy it was to use the National Weather Service API. No API key is required (although the documentation does state that there will be API keys at some point in the future), and the API is based upon JSON-LD (JSON for Linked Data), which makes it easy to discover related data via embedded links in the response body. I would recommend the National Weather Service API to anyone who’s looking for a data source for educational or testing purposes or as an input for generative art.

Seven Languages in Seven Weeks

There’s this really great book by Bruce Tate called Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages. I read it not too long after it came out in 2012, and I found it very inspiring and enjoyable. I’ve been re-reading it recently for no particular reason and seven years later (aeons in the world of software), it still holds up!

The book walks you through the condensed version of learning each language from scratch, providing engaging summaries about what makes the language unique, easy-to-follow code examples, and rigorous self-study exercises at the end of each chapter. The languages covered are Ruby, Io, Prolog, Scala, Erlang, Clojure, and Haskell.

(By the way, Tate released a sequel in 2014, Seven More Languages in Seven Weeks: Languages That Are Shaping the Future, which I also quickly devoured. The second round of languages consisted of Lua, Factor, Elixir, Elm, Julia, miniKanren, and Idris. It’s also well worth reading!)

Comments?

Reply to this tweet with any comments, questions, etc.!