Created
September 10, 2015 14:41
-
-
Save whitni/8d13e098a770d1419c0c to your computer and use it in GitHub Desktop.
Revisions
-
whitni revised this gist
Sep 10, 2015 . No changes.There are no files selected for viewing
-
whitni created this gist
Sep 10, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,93 @@ # Welcome to Sonic Pi v2.6 require 'csv' data = CSV.parse(File.read("/Users/wwatkins/Documents/NBA.csv"), {:headers => true, :header_converters => :symbol}) in_thread do data.each do |line| #looking at conference column, east or west conf = line[:conference].to_s puts conf mysample = "" mystretch = 1 if conf == 'West' mysample = :bd_haus else mysample = :loop_amen mystretch = 2 end #looking at minutes a player plays mynote = "" min = line[:minutes].to_f if (min >= 0.40 and min <= 0.54) mynote = :E7 else mynote = :A end # looking at team column and if abcdefg team = line[:team].to_s if /[abcdefghijkl]/i.match(team[1]) # => true sample :ambi_lunar_land sample mysample, rate: mystretch play mynote puts team[1] else sample :sn_zome sample mysample, rate: mystretch play mynote sample :ambi_piano end sleep 1 end end #continuously playing use_debug false load_samples [:drum_heavy_kick, :drum_snare_soft] define :drums do cue :slow_drums 6.times do sample :drum_heavy_kick, rate: 0.8 sleep 0.5 end cue :fast_drums 8.times do sample :drum_heavy_kick, rate: 0.8 sleep 0.125 end end define :snare do cue :snare sample :drum_snare_soft sleep 1 end define :synths do puts "how does it feel?" use_synth :mod_saw use_synth_defaults amp: 0.5, attack: 0, sustain: 1, release: 0.25, cutoff: 90, mod_range: 12, mod_phase: 0.5, mod_invert_wave: 1 notes = (ring :F, :C, :D, :D, :G, :C, :D, :D) notes.each do |n| play note(n, octave: 1) play note(n, octave: 2) sleep 1 end end in_thread(name: :synths) do sleep 6 loop{synths} end in_thread(name: :drums) do loop{drums} end in_thread(name: :snare) do sleep 12.5 loop{snare} end