Created
October 1, 2019 18:34
-
-
Save Bhacaz/c173a5d66ddbd2147958ad45463a967c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Fur Elise | |
# Note by note | |
use_bpm 40 | |
use_synth :piano | |
# Partie 1 >> | |
play :E5, amp: 4 | |
sleep 1/8.0 | |
play :Ds5 | |
sleep 1/8.0 | |
play :E5 | |
sleep 1/8.0 | |
play :Ds5 | |
sleep 1/8.0 | |
play :E5 | |
sleep 1/8.0 | |
play :A4 | |
sleep 1/8.0 | |
play :D5 | |
sleep 1/8.0 | |
play :C5 | |
sleep 1/8.0 | |
play :A4 | |
sleep 3/8.0 | |
# << Partie 1 | |
# Montee 1 >> | |
play :D4 | |
sleep 1/8.0 | |
play :E | |
sleep 1/8.0 | |
play :A | |
sleep 1/8.0 | |
play :B | |
sleep 3/8.0 | |
# << Montee 1 | |
# Montee 2 >> | |
play :E4 | |
sleep 1/8.0 | |
play :Gs | |
sleep 1/8.0 | |
play :B | |
sleep 1/8.0 | |
play :C5 | |
sleep 3/8.0 | |
# << Montee 2 | |
# Partie 1 >> | |
play :E5, amp: 4 | |
sleep 1/8.0 | |
play :Ds5 | |
sleep 1/8.0 | |
play :E5 | |
sleep 1/8.0 | |
play :Ds5 | |
sleep 1/8.0 | |
play :E5 | |
sleep 1/8.0 | |
play :A4 | |
sleep 1/8.0 | |
play :D5 | |
sleep 1/8.0 | |
play :C5 | |
sleep 1/8.0 | |
play :A4 | |
sleep 3/8.0 | |
# << Partie 1 | |
# Montee 1 >> | |
play :D4 | |
sleep 1/8.0 | |
play :E | |
sleep 1/8.0 | |
play :A | |
sleep 1/8.0 | |
play :B | |
sleep 3/8.0 | |
# << Montee 1 | |
# Montee 3 >> | |
play :E | |
sleep 1/8.0 | |
play :C5 | |
sleep 1/8.0 | |
play :B | |
sleep 1/8.0 | |
play :A | |
sleep 3/8.0 | |
# << Montee 3 |
This file contains hidden or 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
# Fur Elise | |
# With some methods | |
# And 2 ways to call them | |
use_bpm 40 | |
use_synth :piano | |
def croche(note) | |
play note | |
sleep 1/8.0 | |
end | |
def noire_pointe(note) | |
play note | |
sleep 3/8.0 | |
end | |
def part_one | |
# Partie 1 >> | |
2.times do | |
croche :E5 | |
croche :Ds5 | |
end | |
croche :E5 | |
croche :A4 | |
croche :D5 | |
croche :C5 | |
noire_pointe :A4 | |
# << Partie 1 | |
end | |
def monte_one | |
# Montee 1 >> | |
croche :D4 | |
croche :E | |
croche :A | |
noire_pointe :B | |
# << Montee 1 | |
end | |
def monte_two | |
# Montee 2 >> | |
croche :E4 | |
croche :Gs | |
croche :B | |
noire_pointe :C5 | |
# << Montee 2 | |
end | |
def monte_three | |
# Montee 3 >> | |
croche :E | |
croche :C5 | |
croche :B | |
noire_pointe :A | |
# << Montee 3 | |
end | |
# Iteration 1 | |
puts 'First refactoring' | |
part_one | |
monte_one | |
monte_two | |
part_one | |
monte_one | |
monte_three | |
sleep 2 | |
# Iteration 2 | |
puts 'Second refactoring' | |
(1..2).each do |time| | |
part_one | |
monte_one | |
if time == 1 | |
monte_two | |
else | |
monte_three | |
end | |
end |
This file contains hidden or 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
# Sonic Pi | |
# Simple example to show how play | |
# note one after the other | |
play :C | |
sleep 1 | |
play :D | |
sleep 1 | |
play :E | |
# Sounds better with piano | |
use_synth :piano | |
sleep 1 | |
play :C | |
sleep 1 | |
play :D | |
sleep 1 | |
play :E |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment