Advertisement
Guest User

Untitled

a guest
Jan 11th, 2020
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 9.29 KB | None | 0 0
  1. define :parseChord do |notes, n, s, t|
  2.   x = 0
  3.   t.times do
  4.     play notes[x], sustain: n, release: n
  5.     x = x + 1
  6.   end
  7.   sleep s
  8. end
  9. ##########################################################################
  10. ##INTRO METHODS
  11. define :introLeftHand do |flag|
  12.   if (flag == true)
  13.     listOfNotes = [[:a3,:c4,:f2],[:b3,:d3,:g2],[:c4,:e3,:a2],[:b3,:d3,:g2],[:a3,:c4,:f2],[:b3,:d3,:g2],[:c4,:e3,:a2]]
  14.   else
  15.     listOfNotes = [[:a3,:c4,:f2],[:b3,:d3,:g2],[:c4,:e3,:a2],[:b3,:d3,:g2]]
  16.   end
  17.   x = 0
  18.   l = listOfNotes.length
  19.   l.times do
  20.     if (flag == true) and (x ==  6)
  21.       parseChord listOfNotes[x], 16, 6, 3
  22.     else
  23.       parseChord listOfNotes[x], 16, 9, 3
  24.     end
  25.     x = x + 1
  26.   end
  27. end
  28.  
  29. define :introRightHand do
  30.   introNotes = [:a4, :e5, :a4, :g4, :a4]
  31.   x = 0
  32.   #Sleep 5 total
  33.   5.times do
  34.     if (x == 5)
  35.       play introNotes[x], sustain: 8, release: 8
  36.     else
  37.       play introNotes[x], sustain: 4, release: 4
  38.     end
  39.     x = x + 1
  40.     sleep 1
  41.   end
  42.   sleep 4
  43.  
  44.   introNotes = [:g4,:g4,:a4,:e5,:a4,:g4,:a4,:e5,:a4,:g4,:a4]
  45.   x = 0
  46.   11.times do
  47.     if (x == 0)
  48.       play introNotes[x], sustain: 8, release: 8
  49.       sleep 4
  50.     else
  51.       play introNotes[x], sustain: 4, release: 4
  52.       sleep 1
  53.     end
  54.     x = x + 1
  55.   end
  56.   sleep 3
  57.   play :e4, release: 2, sustain: 2
  58.   sleep 1
  59.   play :g4, release: 4, sustain: 4
  60.   sleep 4
  61.   introNotes = [:d4, :e4, :g4, :a4, :b4]
  62.   x = 0
  63.   5.times do
  64.     if (x == 3)
  65.       play introNotes[x], sustain: 0.5, release: 0.5
  66.     else
  67.       play introNotes[x]
  68.     end
  69.     x = x + 1
  70.     sleep 1
  71.   end
  72.  
  73.   introNotes = [:a4, :e5, :a4, :g4, :a4]
  74.   x = 0
  75.   5.times do
  76.     if (x == 5)
  77.       play introNotes[x], sustain: 8, release: 8
  78.     else
  79.       play introNotes[x], sustain: 4, release: 4
  80.     end
  81.     x = x + 1
  82.     sleep 1
  83.   end
  84.   sleep 2
  85.   play :f5
  86.   sleep 1
  87.   play :e5, release: 2, sustain: 2
  88.   sleep 1
  89.   play :d5, release: 4, sustain: 4
  90.   sleep 4
  91.   play :g4, release: 2, sustain: 2
  92.   sleep 1
  93.   play :a4, release: 4, sustain: 4
  94.   sleep 1
  95.   play :e5, release: 4, sustain: 4
  96.   sleep 1
  97.   play :b4
  98.   sleep 1
  99.   play :c5, release: 0.5, sustain: 0.5
  100.   sleep 1
  101.   play :b4, release: 4, sustain: 4
  102.   sleep 1
  103.   play :c5
  104.   sleep 1
  105.   play :d5, release: 2, sustain: 2
  106.   sleep 1
  107.   play :e5, release: 4, sustain: 4
  108.   sleep 1
  109.   play :a4, sustain: 6, release: 6
  110.   sleep 1
  111. end
  112.  
  113. define :intro do
  114.   play :e4, sustain: 8, release: 8
  115.   sleep 2
  116.   play :g4, sustain: 8, release: 8
  117.   sleep 2
  118.   introLeftHand false
  119.   in_thread do
  120.     introRightHand
  121.   end
  122.   introLeftHand true
  123.   sleep 3
  124. end
  125. #################################################
  126. #Main Methods
  127. define :mainLeftHand do |t, noteChange, short|
  128.   t.times do
  129.     notes = [:f2,:c3,:f3,:a3,:c4,:a3,:f3,:a3]
  130.     2.times do
  131.       x = 0
  132.       #Sleep 5 total
  133.       8.times do
  134.         play notes[x]
  135.         x = x + 1
  136.         sleep 0.5
  137.       end
  138.     end
  139.     notes = [:g2,:d3,:g3,:b3,:d4,:b3,:g3,:b3]
  140.     2.times do
  141.       x = 0
  142.       8.times do
  143.         play notes[x]
  144.         x = x + 1
  145.         sleep 0.5
  146.       end
  147.     end
  148.     notes = [:a2,:e3,:a3,:c4,:e4,:c4,:a3,:c4]
  149.     2.times do
  150.       x = 0
  151.       8.times do
  152.         play notes[x]
  153.         x = x + 1
  154.         sleep 0.5
  155.       end
  156.     end
  157.     if(noteChange == true)
  158.       notes = [:g2,:d3,:g3,:d3,:b3,:d3,:g3,:d3]
  159.     else
  160.       notes = [:g2,:d3,:g3,:b3,:d4,:b3,:g3,:b3]
  161.     end
  162.     2.times do
  163.       x = 0
  164.       z = 8
  165.       z.times do
  166.         play notes[x]
  167.         x = x + 1
  168.         sleep 0.5
  169.       end
  170.       if(noteChange == true)
  171.         notes = [:g2,:d3,:g3,:b3,:d4,:b3,:g3,:b3]
  172.       end
  173.       if(short == true)
  174.         notes = [:g2,:d3,:g3,:b3,:d4]
  175.         z = 5
  176.       end
  177.     end
  178.   end
  179. end
  180.  
  181. define :mainRightHand do
  182.   notes = [:a4, :e5, :a4,:g4]
  183.   x = 0
  184.   4.times do
  185.     play notes[x], sustain: 4, release: 4
  186.     x = x + 1
  187.     sleep 1
  188.   end
  189.   play :a4, sustain: 8, release: 8
  190.   sleep 4
  191.   play :g4, sustain: 2, release: 2
  192.   sleep 3
  193.   notes = [:g4,:a4,:e5,:a4,:g4,:a4]
  194.   2.times do
  195.     x = 0
  196.     4.times do
  197.       play notes[x], sustain: 4, release: 4
  198.       x = x + 1
  199.       sleep 1
  200.     end
  201.   end
  202.   a = 1
  203.   2.times do
  204.     play notes[x], sustain: 4, release: 4
  205.     x = x + 1
  206.     sleep a
  207.     a = 3
  208.   end
  209.   play :e5, sustain: 4, release: 4
  210.   sleep 1
  211.   play :g4, sustain: 2, release: 2
  212.   sleep 3
  213.   notes = [:d4, :e4, :g4, :a4, :b4, :a4, :a4, :g4, :a4]
  214.   x = 0
  215.   9.times do
  216.     if (x == 2)
  217.       play notes[x], sustain: 0.5, release: 0.5
  218.       sleep 1
  219.     elsif (x == 5)
  220.       play notes[x], sustain: 4, release: 4
  221.       sleep 3
  222.     else
  223.       play notes[x], sustain: 4, release: 4
  224.       sleep 1
  225.     end
  226.     x = x + 1
  227.   end
  228.   play :f5
  229.   sleep 2
  230.   notes = [:f5,:e5,:d5]
  231.   x = 0
  232.   3.times do
  233.     play notes[x], release: 0.5, sustain: 0.5
  234.     x = x + 1
  235.     sleep 0.25
  236.   end
  237.   sleep 2.25
  238.   notes = [:g4, :a4, :e5, :b4, :c5, :b4, :c5, :d5, :e5, :a4]
  239.   x = 0
  240.   10.times do
  241.     play notes[x], sustain: 2, release: 2
  242.     x = x + 1
  243.     sleep 1
  244.   end
  245.   sleep 2
  246.   play :e4, release: 4, sustain: 4
  247.   sleep 1
  248.   play :g4, release: 2, sustain: 2
  249.   sleep 4
  250.   play :g4, release: 4, sustain: 4
  251.   sleep 1
  252.   play :a4, release: 2, sustain: 2
  253.   sleep 3
  254. end
  255. #######################################
  256. #Riff Methods
  257. define :riffHelper do |y,notes|
  258.   x = 0
  259.   4.times do
  260.     play notes[x], release: 4, sustain: 4
  261.     x = x + 1
  262.     sleep 1
  263.   end
  264. end
  265.  
  266. define :riffRightHand do
  267.   y = 0
  268.   extraNotes = [:a5,:b5,:c6]
  269.   note = extraNotes[y]
  270.   notes = [:d5,:e5,note,:e5]
  271.   2.times do
  272.     2.times do
  273.       2.times do
  274.         riffHelper y,notes
  275.       end
  276.       y = y + 1
  277.       note = extraNotes[y]
  278.       notes = [:d5,:e5,note,:e5]
  279.     end
  280.     y = 2
  281.     2.times do
  282.       2.times do
  283.         riffHelper y,notes
  284.       end
  285.       y = y - 1
  286.       note = extraNotes[y]
  287.       notes = [:d5,:e5,note,:e5]
  288.     end
  289.   end
  290. end
  291.  
  292. define :riffRightHand2 do
  293.   listOfNotes = [[:a5, :c5, :a4, :f3],[:e6,:e5],[:a5,:a4],[:g5,:g4],[:a5,:a4]]
  294.   x = 0
  295.   5.times do
  296.     if (x == 4)
  297.       parseChord  listOfNotes[x], 0.5, 4, listOfNotes[x].length
  298.     else
  299.       parseChord listOfNotes[x], 0.5, 1, listOfNotes[x].length
  300.     end
  301.     x = x + 1
  302.   end
  303.   notes = [:g5, :b4, :g4]
  304.   parseChord notes, 0.5, 3, 3
  305.   2.times do
  306.     x = 0
  307.     listOfNotes = [[:g5,:g4],[:a5,:a4],[:e6,:e5],[:a5,:a4]]
  308.     4.times do
  309.       parseChord listOfNotes[x], 0.5, 1, 2
  310.       x = x + 1
  311.     end
  312.   end
  313.   listOfNotes = [[:g5,:g4],[:a5,:a4],[:e6,:e5],[:g5,:g4],[:d5,:d4],[:e5,:e4],[:g5,:g4],[:a5,:a4],[:b5,:b4]]
  314.   x = 0
  315.   l = listOfNotes.length
  316.   l.times do
  317.     if (x == 1)
  318.       parseChord listOfNotes[x], 0.5, 4, 2
  319.     elsif (x == 3)
  320.       parseChord listOfNotes[x], 0.5, 2, 2
  321.     else
  322.       parseChord listOfNotes[x], 0.5, 1, 2
  323.     end
  324.     x = x + 1
  325.   end
  326.   listOfNotes = [[:a5,:a4],[:e6,:e5],[:a5,:a4],[:g5,:g4],[:a5,:a4],[:f6,:f5],[:e6,:e5],[:d6,:d5],[:g4,:g5]]
  327.   x = 0
  328.   l = listOfNotes.length
  329.   l.times do
  330.     if (x == 7)
  331.       parseChord listOfNotes[x], 0.5, 3, 2
  332.     elsif (x == 4)
  333.       parseChord listOfNotes[x], 0.5, 2, 2
  334.     else
  335.       parseChord listOfNotes[x], 0.5, 1, 2
  336.     end
  337.     x = x + 1
  338.   end
  339.   listOfNotes = [[:a5,:a4],[:e6,:e5],[:b5,:b4],[:c6,:c5],[:b5,:b4],[:c6,:c5],[:d6,:d5],[:e6,:e5],[:a5,:a4],[:e5,:e4],[:g5,:g4]]
  340.   x = 0
  341.   l = listOfNotes.length
  342.   l.times do
  343.     if (x == 8)
  344.       parseChord listOfNotes[x], 0.5, 3, 2
  345.     elsif (x == 10)
  346.       parseChord listOfNotes[x], 0.5, 2, 2
  347.     else
  348.       parseChord listOfNotes[x], 0.5, 1, 2
  349.     end
  350.     x = x + 1
  351.   end
  352.   notes = [:g5,:g4]
  353.   in_thread do
  354.     with_synth :growl do
  355.       play :g5, attack: 0, release: 5, amp: 0.3
  356.     end
  357.   end
  358.   parseChord notes, 0.5, 4, 2
  359. end
  360.  
  361. define :endFlorish do
  362.   notes = [:g5,:g4,:g2]
  363.   in_thread do
  364.     with_synth :growl do
  365.       play :g5, attack: 0, release: 10, amp: 0.3
  366.     end
  367.   end
  368.   parseChord notes, 0.5, 1, 3
  369.   notes = [:d3, :g3, :b3, :d4, :g4, :b4, :d5, :g5, :b5, :d6, :g6, :b6, :d7, :g7]
  370.   x = 0
  371.   14.times do
  372.     if (x == 2) or (x == 7)
  373.       play notes[x], sustain: 3, release: 3
  374.       x = x + 1
  375.       sleep 0.5
  376.     elsif (x == 6)
  377.       play notes[x], sustain: 4, release: 4
  378.       x = x + 1
  379.       sleep 0.5
  380.     else
  381.       play notes[x], sustain: 2, release: 2
  382.       x = x + 1
  383.       sleep 1
  384.     end
  385.   end
  386. end
  387. ################################################
  388. # SONG
  389. with_synth :piano do
  390.   with_fx :lpf, cutoff: 80 do
  391.     with_bpm 130 do
  392.       with_fx :reverb, room: 1 do
  393.         intro
  394.       end
  395.     end
  396.   end
  397.   with_fx :reverb, room: 0.97 do
  398.     with_fx :lpf, cutoff: 85 do
  399.       with_bpm 140 do
  400.         mainLeftHand 1, false, false
  401.         in_thread do
  402.           mainLeftHand 2, true, false
  403.         end
  404.         mainRightHand
  405.       end
  406.     end
  407.   end
  408.   with_fx :reverb, room: 0.95 do
  409.     with_fx :lpf, cutoff: 90 do
  410.       with_bpm 146 do
  411.         in_thread do
  412.           mainLeftHand 2, false, true
  413.         end
  414.         riffRightHand
  415.       end
  416.       with_bpm 152 do
  417.         in_thread do
  418.           mainLeftHand 2, true, false
  419.         end
  420.         riffRightHand
  421.       end
  422.       with_bpm 155 do
  423.         in_thread do
  424.           mainLeftHand 2, false, false
  425.         end
  426.         riffRightHand2
  427.       end
  428.       with_bpm 150 do
  429.         endFlorish
  430.       end
  431.     end
  432.   end
  433. end
  434.  
  435. #That is the end of the File.
  436. #The Code is in the description <3
  437. #Enjoy the outro!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement