Making Music with Google Sheets and Web MIDI API
With the help of Web MIDI API, we can use Google Sheets as a music sequencer.
Do you know that the modern web browser can access real musical instruments? With the help of Web MIDI API, we can create a web application that can access MIDI devices connected to our computer. In this article, I will explain how I use Google Sheets as a music sequencer for composing and playing ambient music with a hardware synthesizer.
What is a music sequencer?
A music sequencer is a device or software that can record, edit, and play back musical data such as notes, chords, velocity, or any events to automate the process of music creation or music performance. It sends the musical data to musical instruments to produce sound, typically via MIDI, CV/Gate, or OSC protocol.
Recently, I have been interested in a music sequencer in a tracker style. It is a type of music sequencer commonly used in the 80s and 90s. It is a grid-based music sequencer that uses a vertical grid of columns. Each contains several rows and columns to represent different musical data and events. It is similar to a spreadsheet.
Why Google Sheets?
- WEBMIDI.js, it’s an abstraction layer for Web MIDI API. It simplifies the usage of Web MIDI API, such as getting the list of MIDI devices, sending MIDI messages, receiving MIDI messages, etc.
- Tone.js, it’s an abstraction layer for Web Audio API. I use it only for looping the notes and velocity. Tone.js provides a global transport that can be used to synchronize the timing of the notes.
I built the web app to play and stop the sequence as a custom sidebar UI of Google Sheets. In this sidebar, all Web MIDI API and Tone.js functions are available. I also added a custom function to Google Sheets to send MIDI messages from the spreadsheet cells.
If you are interested in the code, you can take a look at my GitHub repository: Google Sheets MIDI Sequencer.
The demo video
Finally, here’s the demo video of the Google Sheets music tracker and sequencer. I use it to compose and play live ambient music with my Arturia MicroFreak synthesizer. I hope you enjoy it.