Skip to content

Instantly share code, notes, and snippets.

@shobhitic
Created June 8, 2020 17:41
Show Gist options
  • Save shobhitic/c8cce6af9689f2b560cca14bfd24aebc to your computer and use it in GitHub Desktop.
Save shobhitic/c8cce6af9689f2b560cca14bfd24aebc to your computer and use it in GitHub Desktop.
require 'muse'
include Muse
def intro(num)
bar(num + 1, b:0.25).notes { e5; dis5; }
bar(num + 2, b:0.25).notes { e5; dis5; e5; b4; d5; c5; }
bar(num + 3, b:0.25).notes { a4 b:0.5; _; c4; e4; a4; }
bar(num + 3, b:0.25).notes { a2; e3; a3; _ b:0.75 }
bar(num + 4, b:0.25).notes { b4 b:0.5; _; e4; gis4; b4; }
bar(num + 4, b:0.25).notes { e2; e3; gis3; _ b:0.75 }
bar(num + 5, b:0.25).notes { c5 b:0.5; _; e4; e5; dis5; }
bar(num + 5, b:0.25).notes { a2; e3; a3; _ b:0.75 }
bar(num + 6, b:0.25).notes { e5; dis5; e5; b4; d5; c5; }
bar(num + 7, b:0.25).notes { a4 b:0.5; _; c4; e4; a4; }
bar(num + 7, b:0.25).notes { a2; e3; a3; _ b:0.75 }
bar(num + 8, b:0.25).notes { b4 b:0.5; _; e4; c5; b4; }
bar(num + 8, b:0.25).notes { e2; e3; gis3; _ b:0.75 }
bar(num + 9, b:0.25).notes { a4 b:0.5; _ b:1; }
bar(num + 9, b:0.25).notes { a2; e3; a3; _ b:0.75 }
end
Song.record "fur_elise", bpm: 60 do
intro 0
intro 9
bar(18, b:0.25).notes { _ b:0.75; b4; c5; d5; }
bar(18, b:0.25).notes { _ b:1.5; }
bar(19, b:0.25).notes { e5 b:0.75; g4; f5; e5; }
bar(19, b:0.25).notes { c3; g3; c4; _ b:0.75 }
bar(20, b:0.25).notes { d5 b:0.75; f4; e5; d5; }
bar(20, b:0.25).notes { g2; g3; b3; _ b:0.75 }
bar(21, b:0.25).notes { c5 b:0.75; e4; d5; c5; }
bar(21, b:0.25).notes { a2; e3; a3; _ b:0.75 }
bar(22, b:0.25).notes { b4 b:0.5; _; e4; e5; _ }
bar(22, b:0.25).notes { e2; e3; e4; _; _; e4 }
bar(23, b:0.25).notes { _; e5; e6; _; _; dis5; }
bar(23, b:0.25).notes { e5; _; _; dis5; e5; _; }
end
# Muse
# Copyright (C) 2012 Chang Sau Sheong
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
module Muse
module Harmonic
class << self
def base(input)
2 * Math::PI * input
end
def default(input)
Math.sin(base(input))
end
def second(input)
Math.sin(base(input))
Math.sin(base(input) * 3)
end
def third(input)
Math.sin(base(input)) +
Math.sin(base(input) * 3) +
Math.sin(base(input) * 5)
end
def guitar(input)
Math.sin(base(input)) +
Math.sin(base(input) * 2) +
Math.sin(base(input) * 0.5)
end
def piano(input)
ret = Math.sin(base(input)) * Math.exp(-0.004 * base(input))
ret += Math.sin(2 * base(input)) * Math.exp(-0.0004 * base(input)) / 2
ret += Math.sin(3 * base(input)) * Math.exp(-0.0004 * base(input)) / 4
ret += Math.sin(4 * base(input)) * Math.exp(-0.0004 * base(input)) / 8
ret += Math.sin(5 * base(input)) * Math.exp(-0.0004 * base(input)) / 16
ret += Math.sin(6 * base(input)) * Math.exp(-0.0004 * base(input)) / 32
ret += ret * ret * ret
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment