Skip to content

Instantly share code, notes, and snippets.

@mutagene
Last active December 27, 2015 18:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
automate transcription of disquiet junto human readable form
#!/usr/bin/ruby
notes = ["A","A#","B","C","C#","D","D#","E","F","F#","G","G#"]
prev_note = "-"
ARGV.join('').each_byte do |c|
cur_note = nil
if c >= "a"[0] && c <= "z"[0]
cur_note = notes[ (c - "a"[0])%12 ]
elsif c >= "A"[0] && c <= "Z"[0]
cur_note = "*emphasis* " + notes[ (c - "A"[0])%12 ]
elsif c == ","[0] or c == ";"[0]
cur_note = notes[ (notes.index(prev_note)-1)%12]
elsif c == "."[0] or c == "!"[0] or c == "?"[0]
cur_note = notes[ (notes.index(prev_note)+1)%12]
elsif c == " "[0] or c == "\t"[0] || c == "\n"[0] || c == "-"[0]
puts "(silence)"
else
puts "percussion"
end
if cur_note
puts cur_note
prev_note = cur_note
end
end
@mutagene
Copy link
Author

mutagene commented Nov 8, 2013

usage:
./disquiet0097.rb "eyes-only records, a compression rifle... a spring pistol.\t\nYates.\n\t He grimaces"

@disquiet
Copy link

disquiet commented Nov 8, 2013

Thanks so much for having done this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment