This MIDI Generator Creates Music Based on the Weather

This MIDI Generator Creates Music Based on the Weather

While creating music is certainly an artistic endeavor, there is science and formal theory that takes into account what is pleasant for humans to listen to. That can encompass everything from which specific notes or chords are enjoyable, to the progressions and scales that resonate with us. Those rules are what make generative music difficult, because notes played at random will likely sound very unpleasant to most people. But there are still generative music projects that are interesting, like OttoNL’s Weather Based Music Generator.

OttoNL has a thorough tutorial for this device, so you can build it yourself if you like. It essentially uses data about the current weather to generate MIDI (Musical Instrument Digital Interface) signals that can then be synthesized. It’s capable of generating those MIDI signals based on the current temperature, rain, and light intensity. To make sure that the music produced isn’t completely discordant, the unit can be set to stick to certain rules. For example, it can be told to adhere to a particular scale.

The Weather Based Music Generator is built on an Adafruit Feather HUZZAH ESP8266 development board. That receives data about the current conditions from a BME280 temperature, humidity, and barometric pressure sensor, an Arduino rain sensor, and a photoresistor. OttoNL’s code takes that data and uses it as the seed for a random riff generator — which, again, does follow some rules. Finally, the Arduino MIDI Library is used to take the notes that are generated and output them through a female MIDI connector. With that output, the generator can be connected to a PC or synthesizer to produce the actual sound.

This MIDI Generator Creates Music Based on the Weather was originally published in Hackster Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.

Original article: This MIDI Generator Creates Music Based on the Weather
Author: Cameron Coward