Created
          September 1, 2012 11:05 
        
      - 
      
- 
        Save jraregris/3569872 to your computer and use it in GitHub Desktop. 
    Bass buttons on my brother's accordion
  
        
  
    
      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
    
  
  
    
  | module Accordion | |
| TONES = ['C ', 'C#', 'D ', 'D#', 'E ', 'F ', 'F#', 'G ', 'G#', 'A ', 'A#', 'B '] | |
| def get_tone t | |
| TONES[t%12] | |
| end | |
| def rel tone, dist | |
| get_tone((TONES.find_index(tone) + dist) % 12) | |
| end | |
| def line tone | |
| [8,4,0].collect {|i| rel tone, i} | |
| end | |
| end | |
| include Accordion | |
| def pline a | |
| a.each { |i| print "#{i} "} | |
| print "\n" | |
| end | |
| # %W(C F G).each { |t| pline line t} | |
| i = 10 | |
| 20.times do | |
| pline line TONES[i%12] | |
| i += 5 | |
| end | 
      
      
  Author
  
  
        
      
            jraregris
  
      
      
      commented 
        Sep 1, 2012 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment