Skip to content

Instantly share code, notes, and snippets.

@blinry
Created August 15, 2016 12:28
Show Gist options
  • Save blinry/de1ef16c905a06684207b43b9ed8f8c3 to your computer and use it in GitHub Desktop.
Save blinry/de1ef16c905a06684207b43b9ed8f8c3 to your computer and use it in GitHub Desktop.
Skull Song script for LilyPond
pitches = {44 => "gis,,", 45 => "a,,", 46 => "ais,,", 47 => "b,,", 48 => "c,", 49 => "cis,", 50 => "d,", 51 => "dis,", 52 => "e,", 53 => "f,", 54 => "fis,", 55 => "g,", 56 => "gis,", 57 => "a,", 58 => "ais,", 59 => "b,", 60 => "c", 61 => "cis", 62 => "d", 63 => "dis", 64 => "e", 65 => "f", 66 => "fis", 67 => "g", 68 => "gis", 69 => "a", 70 => "ais", 71 => "b", 72 => "c'", 73 => "cis'", 74 => "d'", 75 => "dis'", 76 => "e'", 77 => "f'", 78 => "fis'", 79 => "g'", 80 => "gis'", 81 => "a'", 82 => "ais'", 83 => "b'", 84 => "c''", 85 => "cis''", 86 => "d''", 87 => "dis''", 88 => "e''", 89 => "f''", 90 => "fis''", 91 => "g''", 92 => "gis''", 93 => "a''", 94 => "ais''", 95 => "b''", 96 => "c'''", 97 => "cis'''", 98 => "d'''", 99 => "dis'''", 100 => "e'''", 101 => "f'''", 102 => "fis'''", 103 => "g'''", 104 => "gis'''", 105 => "a'''", 106 => "ais'''", 107 => "b'''", 108 => "c''''", 109 => "cis''''", 110 => "d''''", 111 => "dis''''", 112 => "e''''", 113 => "f''''", 114 => "fis''''", 115 => "g''''", 116 => "gis''''", 117 => "a''''", 118 => "ais''''"}
puts <<HERE
\\version "2.18.2"
\\header {
tagline=""
title="Skull Song"
composer="Sombra, interpreted by blinry"
}
\\score {
\\absolute {
HERE
notes = []
last = nil
IO.read("skull").gsub(/\n/, "").split("").each do |c|
if last == c and notes[-1][1] < 4
notes[-1][1] += 1
else
notes << [c, 1]
end
last = c
end
durations = ["16", "8", "8.", "4"]
puts notes.map{ |c,d| (c == " " ? "r" : pitches[c.ord]) + durations[d-1]}.join(" ")
puts <<HERE
}
\\midi { }
\\layout { }
}
HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment