diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..e17fd82 Binary files /dev/null and b/.DS_Store differ diff --git a/ruby_rock_and_roll/README.md b/ruby_rock_and_roll/README.md new file mode 100644 index 0000000..0d9133d --- /dev/null +++ b/ruby_rock_and_roll/README.md @@ -0,0 +1,39 @@ +# Ruby, Rock and Roll + +[Muse](http://github.com/sausheong/muse) is a Ruby domain-specific language for creating digital music. In this presentation, I will talk on how Ruby can be used to create digital music through a simple analog software synthesizer, either transcribed from existing music scores, or algorithmically created out of data from various sources. + +The assets in this folder are examples of the output of Muse, as well as a transcription of Muse for Alla Turca (Mozart) and Hotel California (the Eagles). The produced files are in WAV format but to keep the file size down, the music files have been compressed to MP3. + +- Preferred presentation day: no preference +- Presentation language: English + +## My name (required) +Chang Sau Sheong + +## My affiliation (required) +HP Labs, Singapore + +## My bio (required) + +I am currently the Director of Applied Research in HP Labs Singapore, the advanced research arm of Hewlett-Packard. My lab's charter is to build cloud computing solutions using technologies researched on and developed within the labs. + +I have written 2 books on Ruby + +- [Ruby on Rails Web Mashup Projects](https://www.packtpub.com/ruby-on-rails-web-mashup-projects/book) Packt Publishing 2008 +- [Cloning Internet Applications with Ruby](https://www.packtpub.com/cloning-internet-applications-with-ruby/book) Packt Publishing 2010 + +A 3rd book is expected in June/July 2012 titled [Exploring Everyday Things with R and Ruby]() published by O'Reilly. + +I am an active technology speaker (mostly Ruby), having spoken in RedDotRubyConf 2011, RubyConf India 2012 and the upcoming RedDotRubyConf 2012. I am also active in the local and regional technology community, having spoken at various Barcamps and Geekcamps and other local meetups including the Singapore Ruby Brigade and the BigData Singapore. + +I was previously the CTO for a gaming platform and publishing company, Garena. My team developed Garena's software products and also deployed and maintained games published by Garena. + +Prior to Garena I managed Yahoo! Southeast Asia's engineering team as the Director of Engineering. My team developed and maintained Yahoo web sites and services for Southeast Asia. I was also the Head of Yahoo Developer Network for Southeast Asia and drove developer related activities in the region. + +Before Yahoo! I managed a global software development centre for Welcome Real-time, a global card marketing software provider, developing solutions for top international consumer banks. My team provided project delivery and product engineering functions, based out of Singapore and France. Prior to Welcome Real-time, I co-founded elipva, an e-business solutions specialist. In my role as Chief Architect and VP of Product Engineering, I developed a groundbreaking portal application framework that eventually became elipva's core product. + +- [My website](http://blog.saush.com) +- [My twitter](https://twitter.com/#!/sausheong) +- [Past talk slides](http://www.slideshare.net/sausheong/presentations) +- [Past talk video](http://vimeo.com/37789188) + - a recent presentation from the [BigData SG](http://www.bigdata.sg/videos/feb2012/) meetup in February diff --git a/ruby_rock_and_roll/hotel_california.mp3 b/ruby_rock_and_roll/hotel_california.mp3 new file mode 100644 index 0000000..3368751 Binary files /dev/null and b/ruby_rock_and_roll/hotel_california.mp3 differ diff --git a/ruby_rock_and_roll/hotel_california.rb b/ruby_rock_and_roll/hotel_california.rb new file mode 100644 index 0000000..5858390 --- /dev/null +++ b/ruby_rock_and_roll/hotel_california.rb @@ -0,0 +1,213 @@ +require "muse" +include Muse + +Song.record 'hotel_california', harmonic: 'guitar', bpm: 100 do + + # define the chords + def _Bm7(num); bar(num,b:0.5).notes {b2; fis3 b:0.25; b3 b:0.25; d4; b3; fis4;fis3 b:1; _;}; end + def _Fism(num); bar(num,b:0.5).notes {fis2; cis3 b:0.25; ais3 b:0.25; cis4; ais3; fis4; cis3 b:1;_;}; end + def _AM(num); bar(num,b:0.5).notes {a2; e3 b:0.25; a3 b:0.25; cis4; a3; e4;e3 b:1; _;}; end + def _EM9(num); bar(num,b:0.5).notes {e2; b2 b:0.25; gis3 b:0.25; b3; gis3; e4; b2 b:1; _;}; end + def _GM(num); bar(num,b:0.5).notes {g2; d3 b:0.25; g3 b:0.25; b3; g3; d4; d3 b:1; _;}; end + def _DM(num); bar(num,b:0.5).notes {d3; fis3 b:0.25; a3 b:0.25; d4; a3; fis4; fis3 b:1; _;}; end + def _Em7(num); bar(num,b:0.5).notes {e2; b2 b:0.25; g3 b:0.25; b3; g3; e4; b2 b:1; _;}; end + def _FisM7(num);bar(num,b:0.5).notes {fis2; cis3 b:0.25; ais3 b:0.25; cis4; ais3; fis4; cis3 b:1; _;}; end + + # intro riff + + _Bm7('0a') + _Fism('0b') + _AM('0c') + _EM9('0d') + _GM('0e') + _DM('0f') + _Em7('0g') + _FisM7('0h') + + _Bm7(1) + bar(1,b:1,h:'third').notes { d4 b:2; e4; fis4;} + + _Fism(2) + bar(2,b:1,h:'third').notes { e4 b:1.5; d4 b:0.5; cis4 b:2;} + + _AM(3) + bar(3,b:1,h:'third').notes { cis4 b:2; d4; e4;} + + _EM9(4) + bar(4,b:4,h:'third').notes { b3;} + + _GM(5) + bar(5,b:1,h:'third').notes { b3 b:2; cis4; d4;} + + _DM(6) + bar(6,b:1,h:'third').notes { a3 b:1.5; d4 b:2.5;} + + _Em7(7) + bar(7,b:1,h:'third').notes { e4 b:2; fis4; g4;} + + _FisM7(8) + bar(8,b:1,h:'third').notes { fis4 b:0.08; e4 b:0.08; fis4 b:3.84;} + + # start of song + + bar(9,b:0.25).notes {_ b:0.5; fis5; fis5; fis5 b:0.5; fis5; fis5; e5 b:0.5; fis5 b:0.5; _ b:1; } + bar(9,b:0.25).notes {_ b:0.5; a3_d4_fis4; fis4; fis4 b:0.5; fis4; fis4; a3_d4_e4 b:0.5; fis4 b:1.5;} + _Bm7(9) + + bar(10,b:0.25).notes {_ b:0.5; fis5 b:0.5; fis5; fis5; fis5; e5 b:0.5; e5 b:2.25; } + bar(10,b:0.25).notes {_ b:0.5; ais3_cis4_fis4 b:0.5; fis4 b:0.33; e4 b:0.33; e4 b:0.33; e4 b:2;} + _Fism(10) + + bar(11,b:0.25).notes {_ b:0.5; fis5 b:0.5; fis5; e5; e5; e5; e5 b:0.5; fis5 b:0.5; _ b:1;} + bar(11,b:0.25).notes {_ b:0.5; a3_c4_fis4 b:0.5; fis4; e4; e4; e4; e4 b:0.5; fis4 b:1.5;} + _AM(11) + + bar(12,b:0.25).notes {_ b:0.5; fis5; fis5; fis5 b:0.33; e5 b:0.33; e5 b:0.33; e5 b:0.5; d5 b:0.5; _ b:1} + bar(12,b:0.25).notes {_ b:0.5; gis3_b3_fis4; fis4; fis4 b:0.33; e4 b:0.33; e4 b:0.33; e4 b:0.5; d4 b:1.5;} + _EM9(12) + + bar(13,b:0.25).notes {_ b:0.5; g5; g5; g5; fis5; e5; d5; d5 b:0.5; fis5 b:0.5; _ b:1;} + bar(13,b:0.25).notes {_ b:0.5; b3_d4_g4; g4; g4; fis4; e4; d4; b3_d4 b:0.5; fis4 b:1.5;} + _GM(13) + + bar(14,b:0.25).notes {_; d5; fis5; fis5; fis5 b:0.33; e5 b:0.33; d5 b:0.33; d5 b:1; _ b:1;} + bar(14,b:0.25).notes {_; a3_d4; fis4; fis4; fis4 b:0.33; e4 b:0.33; d4 b:0.33; d4 b:2;} + _DM(14) + + bar(15,b:0.25).notes {_; g4; e5; e5; e5; e5; d5; e5 b:0.5; d5; e5 b:1.25;} + bar(15,b:0.25).notes {_; e3; e4; e4; g3_b3_e4; e4; e4; d4; e4 b:0.5; d4; fis4 b:1.25;} + _Em7(15) + + bar(16,b:0.25).notes {_; fis4; fis5; fis5; fis5 b:0.5; a5 b:0.5; fis5 b:1; _ b:1;} + bar(16,b:0.25).notes {_; fis3; ais3_cis4_fis4; fis4; fis4 b:0.5; e4; e4; ais3_cis4_fis4 b:2;} + _FisM7(16) + + # chorus + + bar(17,b:0.25).notes { _ b:0.5; g5; g5 b:0.5; g5; g5; g5 b:0.5; g5; b;0.75; a5 b:0.5; g5; g5} + bar(17,b:0.25).notes { _ b:0.5; b3_d4_b4; b4 b:0.5; b4; b4; b4 b:0.5; b4 b:0.75; a4 b:0.5; g4; a3_d4_g4; } + _GM(17) + + bar(18,b:0.25).notes { g5; fia5 b:0.75; _ b:2.5; fis5; fis5; } + bar(18,b:0.25).notes { a3_d4_g4; fis4 b:3.25; fis4; fis4;} + _DM(18) + + bar(19,b:0.25).notes { fis5; e5; e5; e5 b:1.25; _ b:1.5; e5; e5;} + bar(19,b:0.25).notes { ais3_cis4_fis4; e4; e4; e4 b:2.75; e4; e4;} + _FisM7(19) + + bar(20,b:0.25).notes { e5; d5; d5; d5 b:1.25; _ b:2;} + bar(20,b:0.25).notes { fis3_ais3_e4; d4; d4; d4 b:3.25} + _Bm7(20) + + bar(21,b:0.25).notes { g5; g5; g5; g5 b:0.5; g5 b:0.5; g5; g5 b:0.5; g5 b:0.5; a5 b:0.5; g5; g5; } + bar(21,b:0.25).notes { b3_d4_b4; b4; b4; b4; b4 b:0.5; b4 b:0.5; b4 b:0.25; b4 b:0.5; b4 b:0.5; a4 b:0.5; g4; a3_d4_g4; } + _GM(21) + + bar(22,b:0.25).notes { g5; fis5 b:0.75; _ b:2.5; e5; fis5;} + bar(22,b:0.25).notes { a3_d4_g4; fis4 b:3.25; e4; fis4;} + _DM(22) + + bar(23,b:0.25).notes { fis5; e5; e5; e5 b:1.25; _ b:1.5; e5; g5;} + bar(23,b:0.25).notes { g3_b3-fis4; e4; e4; e4 b:2.75; e4; g4;} + _Em7(23) + + bar(24,b:0.25).notes { g5; fis5; fis5; fis5 b:1.25; _ b:2;} + bar(24,b:0.25).notes { ais3_e4_g4; fis4; fis4; fis4 b:3.25;} + _FisM7(24) + + # repeat chorus + + bar(17,b:0.25).notes { _ b:0.5; g5; g5 b:0.5; g5; g5; g5 b:0.5; g5; b;0.75; a5 b:0.5; g5; g5} + bar(17,b:0.25).notes { _ b:0.5; b3_d4_b4; b4 b:0.5; b4; b4; b4 b:0.5; b4 b:0.75; a4 b:0.5; g4; a3_d4_g4; } + _GM(17) + + bar(18,b:0.25).notes { g5; fia5 b:0.75; _ b:2.5; fis5; fis5; } + bar(18,b:0.25).notes { a3_d4_g4; fis4 b:3.25; fis4; fis4;} + _DM(18) + + bar(19,b:0.25).notes { fis5; e5; e5; e5 b:1.25; _ b:1.5; e5; e5;} + bar(19,b:0.25).notes { ais3_cis4_fis4; e4; e4; e4 b:2.75; e4; e4;} + _FisM7(19) + + bar(20,b:0.25).notes { e5; d5; d5; d5 b:1.25; _ b:2;} + bar(20,b:0.25).notes { fis3_ais3_e4; d4; d4; d4 b:3.25} + _Bm7(20) + + bar(21,b:0.25).notes { g5; g5; g5; g5 b:0.5; g5 b:0.5; g5; g5 b:0.5; g5 b:0.5; a5 b:0.5; g5; g5; } + bar(21,b:0.25).notes { b3_d4_b4; b4; b4; b4; b4 b:0.5; b4 b:0.5; b4 b:0.25; b4 b:0.5; b4 b:0.5; a4 b:0.5; g4; a3_d4_g4; } + _GM(21) + + bar(22,b:0.25).notes { g5; fis5 b:0.75; _ b:2.5; e5; fis5;} + bar(22,b:0.25).notes { a3_d4_g4; fis4 b:3.25; e4; fis4;} + _DM(22) + + bar(23,b:0.25).notes { fis5; e5; e5; e5 b:1.25; _ b:1.5; e5; g5;} + bar(23,b:0.25).notes { g3_b3-fis4; e4; e4; e4 b:2.75; e4; g4;} + _Em7(23) + + bar(24,b:0.25).notes { g5; fis5; fis5; fis5 b:1.25; _ b:2;} + bar(24,b:0.25).notes { ais3_e4_g4; fis4; fis4; fis4 b:3.25;} + _FisM7(24) + + # repeat + + bar(33,b:0.25).notes {_ b:0.5; fis5; fis5; fis5 b:0.5; fis5; fis5; e5 b:0.5; fis5 b:0.5; _ b:1; } + bar(33,b:0.25).notes {_ b:0.5; a3_d4_fis4; fis4; fis4 b:0.5; fis4; fis4; a3_d4_e4 b:0.5; fis4 b:1.5;} + _Bm7(33) + + bar(34,b:0.25).notes {_ b:0.5; fis5 b:0.5; fis5; fis5; fis5; e5 b:0.5; e5 b:2.25; } + bar(34,b:0.25).notes {_ b:0.5; ais3_cis4_fis4 b:0.5; fis4 b:0.33; e4 b:0.33; e4 b:0.33; e4 b:2;} + _Fism(34) + + bar(35,b:0.25).notes {_ b:0.5; fis5 b:0.5; fis5; e5; e5; e5; e5 b:0.5; fis5 b:0.5; _ b:1;} + bar(35,b:0.25).notes {_ b:0.5; a3_c4_fis4 b:0.5; fis4; e4; e4; e4; e4 b:0.5; fis4 b:1.5;} + _AM(35) + + bar(36,b:0.25).notes {_ b:0.5; fis5; fis5; fis5 b:0.33; e5 b:0.33; e5 b:0.33; e5 b:0.5; d5 b:0.5; _ b:1} + bar(36,b:0.25).notes {_ b:0.5; gis3_b3_fis4; fis4; fis4 b:0.33; e4 b:0.33; e4 b:0.33; e4 b:0.5; d4 b:1.5;} + _EM9(36) + + bar(37,b:0.25).notes {_ b:0.5; g5; g5; g5; fis5; e5; d5; d5 b:0.5; fis5 b:0.5; _ b:1;} + bar(37,b:0.25).notes {_ b:0.5; b3_d4_g4; g4; g4; fis4; e4; d4; b3_d4 b:0.5; fis4 b:1.5;} + _GM(37) + + bar(38,b:0.25).notes {_; d5; fis5; fis5; fis5 b:0.33; e5 b:0.33; d5 b:0.33; d5 b:1; _ b:1;} + bar(38,b:0.25).notes {_; a3_d4; fis4; fis4; fis4 b:0.33; e4 b:0.33; d4 b:0.33; d4 b:2;} + _DM(38) + + bar(39,b:0.25).notes {_; g4; e5; e5; e5; e5; d5; e5 b:0.5; d5; e5 b:1.25;} + bar(39,b:0.25).notes {_; e3; e4; e4; g3_b3_e4; e4; e4; d4; e4 b:0.5; d4; fis4 b:1.25;} + _Em7(39) + + bar(40,b:0.25).notes {_; fis4; fis5; fis5; fis5 b:0.5; a5 b:0.5; fis5 b:1; _ b:1;} + bar(40,b:0.25).notes {_; fis3; ais3_cis4_fis4; fis4; fis4 b:0.5; e4; e4; ais3_cis4_fis4 b:2;} + _FisM7(40) + + + bar(41,b:0.33).notes {fis5; d5; b4; fis5; d5; b4; fis5; d5; b4; fis5 b:1; } + _Bm7(41) + + bar(42,b:0.33).notes {fis5; cis5; ais4; fis5; cis5; ais4; fis5 b:2} + _Fism(42) + + bar(43,b:0.33).notes {e5; cis5; a4; e5; cis5; a4; e5; cis5; a4; e5 b:1;} + _AM(43) + + bar(44,b:0.33).notes {e5; b4; gis4; e5; b4; gis4; e5 b:2;} + _EM9(44) + + bar(45,b:0.33).notes {d5; b4; g4; d5; b4; g4; d5; b4; g4; d5 b:1;} + _GM(45) + + bar(46,b:0.33).notes {fis5; d5; a4; fis5; d5; a4; fis5 b:2;} + _DM(46) + + bar(47,b:0.33).notes {e5; b4; g4; e5; b4; g4; e5; b4; g4; e5 b:1;} + _Em7(47) + + bar(48,b:0.33).notes {fis5; cis5; ais4; fis5; cis5; ais4; fis5 b:2;} + _FisM7(48) + + +end \ No newline at end of file diff --git a/ruby_rock_and_roll/turkish_march.mp3 b/ruby_rock_and_roll/turkish_march.mp3 new file mode 100644 index 0000000..69fa21d Binary files /dev/null and b/ruby_rock_and_roll/turkish_march.mp3 differ diff --git a/ruby_rock_and_roll/turkish_march.rb b/ruby_rock_and_roll/turkish_march.rb new file mode 100644 index 0000000..9f1756e --- /dev/null +++ b/ruby_rock_and_roll/turkish_march.rb @@ -0,0 +1,87 @@ +$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) +require "muse" +include Muse + +# Mozart's Piano Sonata No. 11 3rd Movement (All Turca) +# more popularly known as the 'Turkish March' or 'Turkish Rondo' +# first 9 bars only + +Song.record 'turkish_march', envelope: 'default', harmonic: 'organ' do + bar(1,b:0.25).notes {b4; a4; gis4; a4;} + + bar(2,b:0.25).notes {c5 b:0.5; _ b:0.5; d5; c5; b4; c5;} + bar(2,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;} + + bar(3,b:0.25).notes {e5 b:0.5; _ b:0.5; f5; e5; dis5; e5;} + bar(3,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;} + + bar(4,b:0.25).notes {b5; a5; gis5; a5; b5; a5; gis5; a5;} + bar(4,b:0.5).notes {a3; c4_e4; a3; c4_e4;} + + bar(5,b:0.5).notes {c6 b:1; a5; c6;} + bar(5,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;} + + bar(6,b:0.5).notes {b5; fis5_a5; e5_g5; fis5_a5; } + bar(6,b:0.5).notes {e3 v:13; b3_e4; b3_e4; b3_e4;} + + bar(7,b:0.5).notes {b5; fis5_a5; e5_g5; fis5_a5; } + bar(7,b:0.5).notes {e3 v:13; b3_e4; b3_e4; b3_e4;} + + bar(8,b:0.5).notes {b5; fis5_a5; e5_g5; dis5_eis5; } + bar(8,b:0.5).notes {e3 v:13; b3_e4; b2; b3;} + + bar(9).notes {e5} + bar(9).notes {e4} + + bar(10,b:0.5).notes {c5_e5; d5_f5;} + + bar(11,b:0.5).notes {e5_g5; e5_g5; a5 b:0.25; g5 b:0.25; f5 b:0.25; e5 b:0.25;} + bar(11,b:0.5).notes {c3; c4; e3; e4;} + + bar(12,b:0.5).notes {b4_d5; g4; c5_e5; d5_e5;} + bar(12,b:0.5).notes {g3; _ b:2;} + + bar(13,b:0.5).notes {e5_g5; e5_g5; a5 b:0.25; g5 b:0.25; f5 b:0.25; e5 b:0.25;} + bar(13,b:0.5).notes {c3; c4; e3; e4;} + + bar(14,b:0.5).notes {b4_d5 b:1; a4_c5; b4_d5;} + bar(14,b:0.5).notes {g3; _ b:2;} + + bar(15,b:0.5).notes {c5_e5; c5_e5; f5 b:0.25; e5 b:0.25; d5 b:0.25; c5 b:0.25;} + bar(15,b:0.5).notes {a2; a3; c3; c4;} + + bar(16,b:0.5).notes {gis4_b4; e4; a4_c5; b4_d5;} + bar(16,b:0.5).notes {e3; _ b:2;} + + bar(17,b:0.5).notes {c5_e5; c5_e5; f5 b:0.25; e5 b:0.25; d5 b:0.25; c5 b:0.25;} + bar(17,b:0.5).notes {a2; a3; c3; c4;} + + bar(18,b:0.5).notes {gis4_b4 b:1; b4 b:0.25; a4 b:0.25; gis4 b:0.25; a4 b:0.25;} + bar(18,b:0.5).notes {e3; _ b:2;} + + bar(19,b:0.25).notes {c5 b:0.5; _ b:0.5; d5; c5; b4; c5;} + bar(19,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;} + + bar(20,b:0.25).notes {e5 b:0.5; _ b:0.5; f5; e5; dis5; e5;} + bar(20,b:0.5).notes {a3; c4_e4; c4_e4; c4_e4;} + + bar(21,b:0.25).notes {b5; a5; gis5; a5; b5; a5; gis5; a5;} + bar(21,b:0.5).notes {a3; c4_e4; a3; c4_e4;} + + bar(22,b:0.5).notes {c6 b:1; a5; b5;} + bar(22,b:0.5).notes {f3; a3_dis4; a3_dis4; a3_dis4;} + + bar(23,b:0.5).notes {c6; b5; a5; gis5;} + bar(23,b:0.5).notes {e3; a3_e4; d3; f3_b3;} + + bar(24,b:0.5).notes {a5; e5; f5; d5;} + bar(24,b:0.5).notes {c3; e3_a3; d3; f3_b3;} + + bar(25,b:0.0833).notes {c5 b:1; b4;c5;b4;c5;b4;c5;b4;c5;b4; a4 b:0.125; b4 b:0.125;} + bar(25,b:0.5).notes {e3_a3; e3_a3; e3_gis3; e3_gis3;} + + bar(26,b:1).notes {a4} + bar(26,b:1).notes {a2_a3} + + +end