This file contains 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 characters
#piano phase by Steve Reich | |
#implemented by dan tramte | |
use_synth :piano | |
for i in 120..121 do | |
use_bpm i | |
in_thread do | |
loop do | |
play (ring 64, 66, 71, 73, 74, 66, 64, 73, 71, 66, 74, 73).tick, pan: 120.5-i | |
sleep 0.25 |
This file contains 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 characters
use_bpm 140 | |
define :bassThread do | |
in_thread do | |
16.times do | |
tick | |
sample :bd_boom, amp: 3, rate: (ring, 1, 1, 1, 0.9, 1.19, 1.19, 1.06, 1.03).look | |
sleep 1 | |
end | |
end |
This file contains 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 characters
define :live_hiss do | |
in_thread do | |
loop do | |
adjusted_stretch_2_bpm = current_bpm/7.5 | |
sample :vinyl_hiss, beat_stretch: adjusted_stretch_2_bpm | |
sleep adjusted_stretch_2_bpm | |
end | |
end | |
end |
This file contains 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 characters
define :genBinaryList do |n| | |
if n < 10 then | |
bl = [] | |
(0..(2**n -1)).each do |i| | |
bn = "%0#{n}b" % i | |
bl.push(bn) | |
end | |
return bl | |
else | |
return ["0"] |
This file contains 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 characters
hi = 8.upto(15).map do |n| n.to_s(2) end | |
lo = hi.map do |e| e.dup end | |
lo.map do |o| o[0] = "0" end | |
lohi = lo + hi | |
puts lohi | |
#found a better way to do this | |
#proud of this silly thing tho, lol |
This file contains 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 characters
# is n within range x..y? | |
x = :C1 | |
y = :C5 | |
n = :Bb3 | |
puts (x.to_i..y.to_i).cover?(n.to_i) |
This file contains 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 characters
# from music tech class APRIL 11 2019 at Virginia Tech | |
# https://www.nasa.gov/centers/goddard/universe/black_hole_sound.html | |
##| formula for midi note 57 octaves below middle C (assuming the starting point is the B-flat below middle C) | |
bh_midi_note = 60-2-12*57.0 | |
puts bh_midi_note #=> -626.0 | |
##| formula to convert midi to frequency | |
bh_frequency = 2**((bh_midi_note-69)/12)*440 | |
puts bh_frequency #=> 1.6173304415101714e-15 |
This file contains 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 characters
notes =(ring 78, 85, | |
[80, 65], 73, 77, 81, [81, 66], :r, 78, 85, | |
[80, 65], 73, 77, 81, [83, 66], 81, | |
[78, 62], 69, 74, 69, 71, 80, 76, 74, | |
[76, 61], 68, 73, 68, 70, 78, 74, 73, | |
[74, 59], 76, 78, 71, 60, [80, 63], [81, 66], 83, | |
[81, 61], 66, 73, 66, [80, 61], :r, 78, 85, | |
[80, 65], 73, 77, 81, [81, 66], :r, 78, 85, | |
[80, 65], 73, 77, 81, [83, 66], 81, | |
[78, 62], 69, 74, 69, 71, 80, 76, 74, |
This file contains 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 characters
#for when you don't want single-seed :P | |
define :now_time do | |
t = Time.new | |
return (t.year.to_s+t.month.to_s+t.day.to_s+t.hour.to_s+t.min.to_s+t.sec.to_s+t.usec.to_s).to_i | |
end | |
define :use_updating_random_seed do | |
use_random_seed now_time | |
end |
This file contains 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 characters
def nr_t (this_current_chord, this_transform_type) | |
case this_transform_type | |
when "t_t" #thru transformation (no transformation occurs) | |
return this_current_chord | |
when "p_t" #parallel transformation | |
return (this_current_chord+12)%24 | |
when "r_t" #relative transformation | |
return this_current_chord < 12? (this_current_chord = (this_current_chord+3)%12+12)%24 : (((this_current_chord-12)+9)%12)%24 | |
when "l_t" #leading tone transformation | |
return this_current_chord < 12? (this_current_chord = (this_current_chord+8)%12+12)%24 : (((this_current_chord-12)+4)%12)%24 |
OlderNewer