コード例 #1
0
def setClef(clef):
    c = clef
    if (clef == "treble"):

        string = ''' 
         
         
    /\\   
----|-|--
    |/   
----|----
   /|    
--/-|----
 |  | _  
-|-(@)-)-
  \ | /  
----|----
    |    
  (_|    
         
 '''

    elif (clef == "bass"):
        string = ''' 
       
       
       
-------
 ,-.   
-o  |:-
   /   
--/----
 /     
-------
       
-------
       
       
       
 '''
    master = sm.concat(staff_begin.splitlines(), string.splitlines())
    return master
コード例 #2
0
def DbarLine(master):
    string = ''' 
   
   
   
-┬┐
 ||
-||
 ||
-||
 ||
-||
 ||
-┴┘
   
   
   
 '''

    return sm.concat(master.splitlines(), string.splitlines())
コード例 #3
0
def barLine(master):
    string = ''' 
   
   
   
-┬-
 | 
-|-
 | 
-|-
 | 
-|-
 | 
-┴-
   
   
   
 '''

    return sm.concat(master.splitlines(), string.splitlines())
コード例 #4
0
def createNote(pitch, duration, clef, master):
    #trying to automate the note building process
    #duration, eighth = 1, quarter = 2, half = 4, dotted half = 6, whole = 8
    note = [
        " ", "     ", "     ", "     ", "-----", "     ", "-----", "     ",
        "-----", "     ", "-----", "     ", "-----", "     ", "     ", "     ",
        " "
    ]

    index = 0
    s = ""
    if (clef == "treble"):
        index = TrebleNotes.index(pitch) + 1
    elif (clef == "bass"):
        index = BassNotes.index(pitch) + 1
    # automated note building
    if (index < 8):  #notes above middle line
        if (index == 1):
            if (duration == 1):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index + 1] = "-|---"
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
                note[index +
                     2] = note[index + 2][:2] + "/" + note[index + 2][3:]
            elif (duration == 2):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index + 1] = "-|---"
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
            elif (duration == 4):
                note[index] = note[index][:1] + "( )" + note[index][4:]
                note[index + 1] = "-|---"
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
            elif (duration == 8):
                note[index] = note[index][:1] + "( )" + note[index][4:]
                note[index + 1] = "-----"
        elif (index == 2):
            if (duration == 1):
                note[index] = "-(x)-"
                note[index +
                     1] = note[index + 1][:1] + "|" + note[index + 1][2:]
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
                note[index +
                     2] = note[index + 2][:2] + "/" + note[index + 2][3:]
            elif (duration == 2):
                note[index] = "-(x)-"
                note[index +
                     1] = note[index + 1][:1] + "|" + note[index + 1][2:]
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
            elif (duration == 4):
                note[index] = "-( )-"
                note[index +
                     1] = note[index + 1][:1] + "|" + note[index + 1][2:]
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
            elif (duration == 8):
                note[index] = "-( )-"
        else:
            if (duration == 1):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index +
                     1] = note[index + 1][:1] + "|" + note[index + 1][2:]
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
                note[index +
                     2] = note[index + 2][:2] + "/" + note[index + 2][3:]
            elif (duration == 2):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index +
                     1] = note[index + 1][:1] + "|" + note[index + 1][2:]
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
            elif (duration == 4):
                note[index] = note[index][:1] + "( )" + note[index][4:]
                note[index +
                     1] = note[index + 1][:1] + "|" + note[index + 1][2:]
                note[index +
                     2] = note[index + 2][:1] + "|" + note[index + 2][2:]
            elif (duration == 8):
                note[index] = note[index][:1] + "( )" + note[index][4:]
    elif (index >= 8):  # NOTES BELOW MIDDLE LINE
        if (index == 14):
            if (duration == 1):
                note[index] = "-(x)-"
                note[index -
                     1] = note[index - 1][:3] + '|' + note[index - 1][4:]
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
                note[index -
                     2] = note[index - 2][:4] + '\\' + note[index - 2][5:]
            elif (duration == 2):
                note[index] = "-(x)-"
                note[index -
                     1] = note[index - 1][:3] + '|' + note[index - 1][4:]
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
            elif (duration == 4):
                note[index] = "-( )-"
                note[index -
                     1] = note[index - 1][:3] + '|' + note[index - 1][4:]
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
            elif (duration == 8):
                note[index] = "-( )-"
        elif (index == 15):
            if (duration == 1):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index - 1] = '---|-'
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
                note[index -
                     2] = note[index - 2][:4] + '\\' + note[index - 2][5:]
            elif (duration == 2):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index - 1] = '---|-'
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
            elif (duration == 4):
                note[index] = note[index][:1] + "( )" + note[index][4:]
                note[index - 1] = '---|-'
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
            elif (duration == 8):
                note[index] = note[index][:1] + "( )" + note[index][4:]
                note[index - 1] = "-----"
        else:
            if (duration == 1):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index -
                     1] = note[index - 1][:3] + '|' + note[index - 1][4:]
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
                note[index -
                     2] = note[index - 2][:4] + '\\' + note[index - 2][5:]
            elif (duration == 2):
                note[index] = note[index][:1] + "(x)" + note[index][4:]
                note[index -
                     1] = note[index - 1][:3] + '|' + note[index - 1][4:]
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
            elif (duration == 4):
                note[index] = note[index][:1] + "( )" + note[index][4:]
                note[index -
                     1] = note[index - 1][:3] + '|' + note[index - 1][4:]
                note[index -
                     2] = note[index - 2][:3] + '|' + note[index - 2][4:]
            elif (duration == 8):
                note[index] = note[index][:1] + "( )" + note[index][4:]

    return (sm.concat(master.splitlines(), '\n'.join(note).splitlines()))
コード例 #5
0
def setTime(time, master):
    if(time == "4/4"):
        beats = 4
        note = 4
        string = ''' 
      
      
      
--/|--
 / |  
/__|--
   |  
--/|--
 / |  
/__|--
   |  
------
      
      
      
 '''

    if(time == "3/4"):
        beats = 3
        note = 4
        string = ''' 
      
      
      
-__---
   )  
--<---
 __)  
--/|--
 / |  
/__|--
   |  
------
      
      
      
 '''

    if(time == "2/4"):
        beats = 2
        note = 4
        string = ''' 
      
      
      
-__---
   )  
--/---
 /__  
--/|--
 / |  
/__|--
   |  
------
      
      
      
 '''
    return sm.concat(master.splitlines(),string.splitlines())
コード例 #6
0
def setKey(key,clef,master):

    string = ""
    # WILL AUTOMATE THIS PROCESS LATER
    if (key == 'C'):
        string = ''' 
     
     
     
-----
     
-----
     
-----
     
-----
     
-----
     
     
     
 '''
    if(clef == 'treble'): # TREBLE CLEF
        if (key == 'G'):
            string = ''' 
     
     
     
#----
     
-----
     
-----
     
-----
     
-----
     
     
     
 '''
        elif (key == 'D'):
            string = ''' 
     
     
     
#----
     
-----
  #  
-----
     
-----
     
-----
     
     
     
 '''
        elif (key == 'A'):
            string = ''' 
       
       
    #  
#------
       
-------
  #    
-------
       
-------
       
-------
       
       
       
 '''
        elif (key == 'E'):
            string = '''     
         
         
    #    
#--------
         
------#--
  #      
---------
         
---------
         
---------
         
         
         
 '''
        elif (key == 'B'):
            string = '''      
           
           
    #      
#----------
           
------#----
  #        
-----------
        #  
-----------
           
-----------
           
           
           
 '''
        elif (key == 'F#'):
            string = '''         
             
             
    #        
#------------
          #  
------#------
  #          
-------------
        #    
-------------
             
-------------
             
             
             
 '''
        elif (key == 'C#'):
            string = ''' 
               
               
    #          
#--------------
          #    
------#--------
  #            
------------#--
        #      
---------------
               
---------------
               
               
               
 '''
        elif (key == 'F'):
            string = ''' 
     
     
     
-----
     
-----
|    
|)---
     
-----
     
-----
     
     
     
 '''
        elif (key == 'Bb'):
            string = ''' 
     
     
     
--|--
  |) 
-----
|    
|)---
     
-----
     
-----
     
     
     
 '''
        elif (key == 'Eb'):
            string = ''' 
       
       
       
--|----
  |)   
-------
|      
|)---|-
     |)
-------
       
-------
       
       
       
 '''
        elif (key == 'Ab'):
            string = ''' 
         
         
         
--|------
  |)   | 
-------|)
|        
|)---|---
     |)  
---------
         
---------
         
         
         
 '''
        elif (key == 'Db'):
            string = ''' 
           
           
           
           
--|--------
  |)   |   
-------|)--
|          
|)---|-----
     |)  | 
---------|)
           
-----------
           
           
           
 '''
        elif (key == 'Gb'):
            string = ''' 
             
             
             
--|----------
  |)   |     
-------|)--|-
|          |)
|)---|-------
     |)  |   
---------|)--
             
-------------
             
             
             
 '''
        elif (key == 'Cb'):
            string = '''                
               
               
               
--|------------
  |)   |       
-------|)--|---
|          |)  
|)---|---------
     |)  |     
---------|)--|-
             |)
---------------
               
               
               
 '''

    elif(clef == 'bass'): #BASS CLEF

        if (key == 'G'): #BASS SHARPS
            string = ''' 
     
     
     
-----
     
#----
     
-----
     
-----
     
-----
     
     
     
 '''
        elif (key == 'D'):
            string = ''' 
     
     
     
-----
     
#----
     
-----
  #  
-----
     
-----
     
     
     
 '''
        elif (key == 'A'):
            string = ''' 
       
       
       
-------
    #  
#------
       
-------
  #    
-------
       
-------
       
       
       
 '''
        elif (key == 'E'):
            string = ''' 
         
         
         
---------
    #    
#--------
         
------#--
  #      
---------
         
---------
         
         
         
 '''
        elif (key == 'B'):
            string = ''' 
           
           
           
-----------
    #      
#----------
           
------#----
  #        
-----------
        #  
-----------
           
           
           
 '''
        elif (key == 'F#'):
            string = ''' 
             
             
             
-------------
    #        
#------------
          #  
------#------
  #          
-------------
        #    
-------------
             
             
             
 '''
        elif (key == 'C#'):
            string = ''' 
               
               
               
---------------
    #          
#--------------
          #    
------#--------
  #            
------------#--
        #      
---------------
               
               
               
 '''
        elif (key == 'F'): # BASS FLATS
            string = ''' 
     
     
     
-----
     
-----
     
-----
|    
|)---
     
-----
     
     
     
 '''
        elif (key == 'Bb'):
            string = ''' 
     
     
     
-----
     
--|--
  |) 
-----
|    
|)---
     
-----
     
     
     
 '''
        elif (key == 'Eb'):
            string = ''' 
       
       
       
-------
       
--|----
  |)   
-------
|      
|)---|-
     |)
-------
       
       
       
 '''
        elif (key == 'Ab'):
            string = ''' 
         
         
         
---------
         
--|------
  |)   | 
-------|)
|        
|)---|---
     |)  
---------
         
         
         
 '''
        elif (key == 'Db'):
            string = ''' 
           
           
           
-----------
           
--|--------
  |)   |   
-------|)--
|          
|)---|-----
     |)  | 
---------|)
           
           
           
 '''
        elif (key == 'Gb'):
            string = ''' 
             
             
             
-------------
             
--|----------
  |)   |     
-------|)--|-
|          |)
|)---|-------
     |)  |   
---------|)--
             
             
             
 '''
        elif (key == 'Cb'):
            string = ''' 
               
               
               
---------------
               
--|------------
  |)   |       
-------|)--|---
|          |)  
|)---|---------
     |)  |     
---------|)--|-
             |)
               
               
 '''
    return(sm.concat(master.splitlines(), string.splitlines()))