Search
  • Paul Schrage

You should learn a programming language

Introduction

In this post I’ll describe the value of a musician using a programming language to further their organization or career, and provide a specific project I just did using a scripting language. You’re already probably quite adept at using a computer. You’re probably pretty good at Excel, Word, and PowerPoint. Maybe you use QuickBooks, Sibelius, or other specialized software. Learning a programming language would be just one more tool in your digital toolbox to make your life easier and your career more productive.


What is a scripting language?

A scripting language is a high-level computer programming language that allows you quickly write a program, or “script”, that you can run in seconds to accomplish a task that would take hours or days if tackled manually. Learning a scripting language is like learning to drive a car – you can do a lot without needing to know how the car works. Using scripting languages requires less programming sophistication than many other types of languages do. These days, scripting languages are a regular part of many middle school STEM curricula. Even if you’ve never programmed before and haven’t been in school for years, you can learn to use a scripting language. In 10 or 15 years, I wouldn’t be surprised if basic knowledge of a scripting language is as common among younger musicians as basic knowledge of PowerPoint or Excel. Python, Ruby, and JavaScript are popular examples of scripting languages.


What types of tasks are good for a scripting language?

Typically, anything repetitive where the usual tools are inadequate. You might use a scripting language to:

  • Convert the information from a PDF into an Excel spreadsheet with thousands of rows.

  • Parse the contents of hundreds of websites every day.

  • Merge 2 or more donor lists in different formats into a single list.

A scripting language can help you automate a mundane task so you spend less time gathering and formatting information and more time making good decisions for yourself or your organization.


I recently used scripting languages to build a helpful map of orchestras and opera companies in Germany. I’ll go through each step I took to get a very useful answer to a career question. This project would be a little too difficult for a complete beginner, but should be within grasp after a little practice.


The question I wanted to answer

I was recently speaking with a very well established conductor in Europe who was kind enough to hop on a call with me and give me some career advice. Based on my interest in opera conducting, he advised me to consider moving to Germany. As an American I’ve traveled to Germany but never considered moving there. I don’t know anything about building a classical music career in Germany. I know Berlin is an important musical city and Munich and Frankfurt are also major cities, but otherwise I don’t know where to begin even thinking about exploring opportunities in Germany.

One thing I love about living in San Francisco is the quantity and quality of performing arts organizations in the broader set of cities throughout the Bay Area. There are numerous professional and community opera companies and orchestras I can work with without spending a night away from home. If I were to leave the Bay Area, I would want a similar density of organizations. To narrow down where in Germany I might want to consider moving, it would be helpful if I had a map showing where all the professional orchestras and opera houses are located. Let’s see what Google Maps gives me.

This mapping of 15 organizations isn’t very helpful. I want to see lots of organizations, especially the smaller, regional ones. I know musicalchairs.info keeps a list of organizations, Let’s see how many they have.

171 orchestras and opera houses: that’s more like it. Even if this list is a bit out of date, it still gives me a good starting point. But I don’t know where most of these cities are. What I need is each organization on this list in a map.

Let’s first get this information in a more useful format: a list. I know webpages are written in HTML, so I need to parse the HTML and copy the important information - organization name and city - into a list. I also know Python has a great HTML parser called BeautifulSoup, so let’s use that. 20 lines of code later and I have my list:

[{"name": "Anhaltischen Theater Dessau /", "location": "Dessau"},
 {"name": "Bad Reichenhaller Philharmonie", "location": "Bad Reichenhall"}, 
 {"name": "Baden-Badener Philharmonie", "location": "Baden-Baden"}, 
 {"name": "Badisches Staatstheater Karlsruhe /", "location": "Karlsruhe"},
 ...

The city name is important, but I know to map it out I also need the latitude and longitude for each city. A quick search tells me Python has a library called geocoder that will return latitude and longitude for a city. Another 18 lines of code and now I have all the information I need:

[{"lat": 51.8346801, "lon": 12.2468705, "name": "Anhaltischen Theater Dessau /", "location": "Dessau"}, 
 {"lat": 47.7222676, "lon": 12.8760923, "name": "Bad Reichenhaller Philharmonie", "location": "Bad Reichenhall"},
 {"lat": 48.7580777, "lon": 8.2415239, "name": "Baden-Badener Philharmonie", "location": "Baden-Baden"}, 
 {"lat": 49.0068705, "lon": 8.4034195, "name": "Badisches Staatstheater Karlsruhe /", "location": "Karlsruhe"}
 ...

Getting the information in this format took me about an hour, and I’m all set to map out my list of organizations. Because I’m building a map, I know I’ll run this in a browser, which means I’ll use JavaScript. Basically I’ll build a website that I’ll run only on my computer. After some looking around, I settle on the TomTom maps API. An hour and 30 more lines of code later I had what a wanted, a map of the orchestras and opera houses in Germany:

If I zoom in on the cluster on the left, I see a nice density of organizations in the Dusseldorf area:

I can also click each marker to see the name of the organization:

I’ve never been to Dusseldorf, and would never thought of moving there. But as it turns out, it might be one of the best places in Germany to live. Complementing the strong cluster of performance organizations, according to Mercer Dusseldorf ranks 6th of 231 cities in the world in quality of living.


Wrap up

If you invest time to learn the tools, scripting languages can offer you a lot of power to solve a range of problems. In a few (pretty fun, if you like solving puzzles) hours I went from having a lot of information in an unhelpful format to a working interactive map containing all the information. The best thing about this project is that now I have the tools to replicate for any country or state. To illustrate, here’s a map of orchestras and opera houses in Italy, which only took me 5 minutes:

Where to learn scripting languages

There are numerous free online options to learn basic programming using a scripting language. Here are a few well-known options:

19 views

Recent Posts

See All

It's a great time to network

I was watching PBS NewsHour, as I usually do when making dinner. Of course, Coronavirus was dominating the news. A segment aired in which an employment expert discussed the difficulty of looking for a