Last active
          July 17, 2024 15:25 
        
      - 
      
- 
        Save JEFworks/d7a9e9ef24d44ab7c9fbdaa2f4a4022d to your computer and use it in GitHub Desktop. 
    Using R to play Stairway to Heaven with different instruments
  
        
  
    
      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
    
  
  
    
  | # playing stairway to heaven using R | |
| # hand transcribed notes | |
| notes <- list( | |
| 'A3', 'C4', 'E4', 'A4', | |
| c('B4', 'G#3'), 'E4', 'C4', 'B4', | |
| c('C4', 'G3'), 'E4', 'C4', 'C5', | |
| c('F#4', 'F#3'), 'D4', 'A3', 'F#4', | |
| c('E4', 'F3'), 'C4', 'A3', 'C4', | |
| NA, 'E4', 'C4', 'A3', | |
| c('B2', 'G3'), c('A2', 'A3'), c('A2', 'A3')) | |
| # play using https://cran.r-project.org/web/packages/gm/vignettes/gm.html | |
| library(gm) | |
| music <- | |
| Music() + | |
| Meter(4, 4) + | |
| Line(notes) + | |
| Instrument(47, 1) + | |
| Slur(1, 4) + Slur(5, 8) + Slur(9, 12) + | |
| Slur(13, 16) + Slur(17, 23) + Slur(24, length(notes)) | |
| show(music) | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Screenshot.2024-07-17.at.9.55.14.AM.mp4