Environmental Music Generator: Solar Solutions Final

For solar solutions, we set out to create an environmental music generator that would take in data from the real world and map different sensors to different aspects of music. In order to get this accomplished we ran with the Raspberry Pi using the Grove Pi add on for hardware and Sonic Pi for software music generation. The general flow started with the sun powering the Pi and the speakers and the Grove Pi sensors picking up data from the environment around it. From there the RPi would use Keypresses to signal to SonicPi to change the music whenever the sensor data fell out of a particular range.

Unfortunately, this project went uncompleted. There were a lot of missteps and miscalculations along the way; however, I think the biggest factor at fault here was scale. A huge takeaway from this project seems to simply be that sometimes it is possible to be too ambitious. While generally, the rule of thumb for these types of projects is that anything is possible with enough time if you plan it properly and do your prototyping, unfortunately we simply just did not have enough time to get what we want figured out, let alone accomplished.

Procedurally generated music isn’t an easy task, and one of the first missteps we took was deciding on Sonic Pi as a means for generating that music. By the time the software was decided, we were already only a few weeks from our deadline which meant pretty much all of our time leading up to the “launch date” was going to have to be devoted to figuring out just how Sonic Pi worked, leaving very little time to pivot once we’d realized that it wasn’t the correct route for our particular project. That isn’t to say that the program is severely lacking or unsuitable for all projects, in fact, I plan on using it myself to explore generating music with computers, however the lack of interfacing options available made it an extremely difficult product to work with for our particular needs.

While I focused mostly on the music generation side, I also know that my partner ran into quite a few problems with working with the Pi itself as well. From having to learn basic python to even start up the project to errors on updating to bad audio output, at every step the Pi side of the project also seemed like an uphill battle. While for me, I had to learn a new “language” to code music with Sonic Pi, it can’t even compete with the learning curve that Susan had to be up against simply because we assumed that the more-powerful-than-arduino pi was the best thing for what we wanted to do. After the fact/as we were wrapping up the project, it was suggested to us that the Teensy board which can even be coded with the Arduino IDE would have been a possible substitute. After looking into it, I couldn’t agree more. If we were to do this project again I would a) ask for more time and b) make sure to try out a Teensy because it cuts out a lot of unnecessary “hacking” around traditional interfacing.

Overall, I am disappointed that we didn’t walk away with what we wanted, and sure maybe even a little worried to see what the grade will come out to be. However, I know that watching as my classmates succeeded and seeing our presentation with practically nothing the lessons I learned from the final about project management are going to hit home 1 million times better than if I had simply turned in a more simple project and gotten an A. Originally, we were thinking about calling the project Apollo after the god of sun and music, but for me personally, I’m going to mark this down as Icarus because it is officially the first time I flew too close to the sun working on an IMA type project.

If you want to hear the project for yourself, just run this code first and then in a separate buffer run “slow_speed,” “med_speed,” “fast_speed,” “xfast_speed,” or “reverse.” Or just listen to this file.

define :slow_speed do
 xl = 4
 l = 2
 m = 1.5
 s = 1
 xs = 0.5
 
 light_notes = (ring 70, 67, 75, 63)
 light_under = (ring 62, 74, 63, 74)
 
 live_loop :light do
 with_fx :reverb do
 with_fx :echo, phase: xs, decay: l do
 4.times do
 use_synth :fm
 play light_notes.tick
 sleep xl
 end
 4.times do
 play light_under.tick
 sleep xl
 end
 end
 end
 end
 
 
 live_loop :under_light do
 with_fx :panslicer, phase: s do
 sync :light
 loop do
 sleep l
 play light_under.tick
 end
 end
 end
 
 live_loop :light_drums do
 sync :light
 loop do
 with_fx :reverb, room:1, damp: 0.7 do
 sample :drum_tom_lo_hard, rate: s, pitch_dis: 0.001
 sleep m
 sample :drum_tom_lo_hard, rate: l, pitch_dis: 0.001
 sleep xs
 end
 end
 sleep m
 end
end

define :med_speed do
 xl = 4
 l = 2
 m = 1.5
 s = 1
 xs = 0.5
 
 light_notes = (ring 70, 67, 75, 63)
 light_under = (ring 62, 74, 63, 74)
 
 live_loop :light do
 with_fx :reverb do
 with_fx :echo, phase: xs, decay: l do
 4.times do
 use_synth :fm
 play light_notes.tick
 sleep xl
 end
 4.times do
 play light_under.tick
 sleep xl
 end
 end
 end
 end
 
 
 live_loop :under_light do
 with_fx :panslicer, phase: s do
 sync :light
 loop do
 sleep l
 play light_under.tick
 end
 end
 end
 
 live_loop :light_drums do
 sync :light
 loop do
 with_fx :reverb, room:1, damp: 0.7 do
 sample :drum_tom_lo_hard, rate: s, pitch_dis: 0.001
 sleep m
 sample :drum_tom_lo_hard, rate: l, pitch_dis: 0.001
 sleep xs
 end
 end
 sleep m
 end
end

define :fast_speed do
 xl = 2
 l = 1
 m = 0.75
 s = 0.5
 xs = 0.25
 
 light_notes = (ring 70, 67, 75, 63)
 light_under = (ring 62, 74, 63, 74)
 
 live_loop :light do
 with_fx :reverb do
 with_fx :echo, phase: xs, decay: l do
 4.times do
 use_synth :fm
 play light_notes.tick
 sleep xl
 end
 4.times do
 play light_under.tick
 sleep xl
 end
 end
 end
 end
 
 
 live_loop :under_light do
 with_fx :panslicer, phase: s do
 sync :light
 loop do
 sleep l
 play light_under.tick
 end
 end
 end
 
 live_loop :light_drums do
 sync :light
 loop do
 with_fx :reverb, room:1, damp: 0.7 do
 sample :drum_tom_lo_hard, rate: s, pitch_dis: 0.001
 sleep m
 sample :drum_tom_lo_hard, rate: l, pitch_dis: 0.001
 sleep xs
 end
 end
 sleep m
 end
end

Leave a Reply