A recent starter with sonic pi. I have little programming experience and I am not musical at all, but I love a challenge and that’s got to count for something.
I have daily data over 20 years for a location. It gives me maximum and minimum temperatures, solar radiation, and rainfall. In other words, four datapoints per day. I use excel to convert each set of datapoints to a selected spread of MIDI notes, and I play each of them within each beat, with a bit of delay built in to make them a bit distinguishable. It has done the job but not sounding very musical, as to be expected.
Things I am pondering at the moment.
- I would like to make one of the temperature datasets play chords. I can see how that can be done with individual notes, but I haven’t yet worked out if it can be done with an array such as is already in the code. I know there are quite a few ways that don’t work.
- It might be more interesting if the four notes were used to seed a couple of bars of something a bit more musical rather than just playing four notes each beat.
- It would be good to be able to access the data directly through OSC, rather than trying to manipulate it and then inserting it into the code. That should give a great deal more flexibility.
Oh well. That is where I am up to. I thought it was going to take much longer to explain, but any comments or suggestions most gratefully received.
I’m going to have a go have another look at OSC now.
Welcome to Sonic Pi v3.1
use_bpm 30
in_thread do
in_thread do
in_thread do
#temperature max
use_synth_defaults release: 0.5, amp: 1, amp_slide: 0.5, stereo_width: 1
use_synth :piano#this line allows control the lag of the note within each beat. TODO try to achieve this through envelope play_pattern_timed [58],[0.25] play_pattern_timed [58,59,55,57,55,53,52,53,61,57,52,54,58,57],[0.5] play_pattern_timed [55,54,54,57,51,52,58,52,54,53,54,60,59,66],[0.5] play_pattern_timed [59,59,53,56,65,56,50,51,55,58,65,55,53,51],[0.5] play_pattern_timed [55,55,59,56,57,56,50,52,49,52,51,53,55,56],[0.5] play_pattern_timed [55,55,55,54,62,61,54,51,52,54,57,58,55,55],[0.5] play_pattern_timed [54,58,57,57,62,61,58,58,54,57,63,55,54,61],[0.5] play_pattern_timed [61,55,59,57,58,55,57,60,56,57,57,59,59,54],[0.5] end #temperature min use_synth_defaults release: 0.5, amp: 0.6, amp_slide: 0.5, stereo_width: 1 use_synth :piano play_pattern_timed [37],[0.0] play_pattern_timed [37,41,36,34,36,36,35,35,35,37,34,32,34,38],[0.5] play_pattern_timed [35,35,35,40,34,34,32,36,33,35,31,32,39,35],[0.5] play_pattern_timed [36,36,37,36,37,37,32,31,35,36,40,36,32,30],[0.5] play_pattern_timed [32,36,36,38,36,39,36,35,34,33,33,32,34,35],[0.5] play_pattern_timed [34,35,36,37,40,41,38,38,37,36,39,40,40,40],[0.5] play_pattern_timed [39,38,40,39,39,47,37,38,39,41,43,33,36,36],[0.5] play_pattern_timed [43,34,37,36,38,38,36,43,39,37,35,36,40,39],[0.5]
end
#solar radiation
use_synth_defaults release: 0.7, amp: 0.15, amp_slide: 0.2, stereo_width: 1
use_synth :zawa
play_pattern_timed [58],[0.25]
play_pattern_timed [50,45,53,52,43,50,51,57,53,56,52,61,60,51],[0.5]
play_pattern_timed [56,53,59,43,44,52,61,43,54,50,57,55,62,49],[0.5]
play_pattern_timed [53,55,48,63,61,49,43,46,63,63,60,49,55,58],[0.5]
play_pattern_timed [61,58,60,53,62,52,45,50,47,54,52,59,62,61],[0.5]
play_pattern_timed [57,53,59,46,55,52,45,45,48,52,56,54,49,53],[0.5]
play_pattern_timed [53,59,58,57,63,55,59,58,49,46,53,64,55,63],[0.5]
play_pattern_timed [53,58,63,62,58,48,61,57,44,58,58,61,55,45],[0.5]
end
#rainfall
use_synth_defaults release: 2, amp: 1, amp_slide: 0.5, stereo_width: 1
use_synth :subpulse
play_pattern_timed [nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil],[0.5]
play_pattern_timed [nil,nil,nil,30,35,nil,nil,nil,nil,35,40,38,nil,nil],[0.5]
play_pattern_timed [30,32,34,32,32,nil,nil,nil,29,30,nil,30,32,30],[0.5]
play_pattern_timed [nil,nil,nil,nil,nil,nil,nil,32,nil,32,31,30,30,nil],[0.5]
play_pattern_timed [nil,32,34,36,34,nil,34,nil,nil,nil,nil,nil,32,32],[0.5]
play_pattern_timed [30,28,nil,nil,28,30,nil,nil,30,35,nil,nil,30,nil],[0.5]