예제 #1
0
    def test_inversions(self):

        # non-standard notation but I wanted a somewhat clean-ish way to describe inversions
        r = roman("C4 major")
        assert r.do("I'") == chord(["E4", "G4", "C5"])
        assert r.do("I''") == chord(["G4", "C5", "E5"])
        assert r.do("I':power") == chord(["G4", "C5"])
예제 #2
0
파일: notation.py 프로젝트: mpdehaan/camp
    def test_inversions(self):

        # non-standard notation but I wanted a somewhat clean-ish way to describe inversions
        r = roman("C4 major")
        assert r.do("I'")  == chord(["E4","G4","C5"])
        assert r.do("I''") == chord(["G4","C5","E5"])
        assert r.do("I':power") == chord(["G4","C5"])
예제 #3
0
파일: scale.py 프로젝트: mpdehaan/camp
 def _scale_test(self, expression=None, expected=None, length=None):
     if isinstance(expected, str):
         expected = expected.split()
     assert length is not None
     scale1 = scale(expression)
     results = [note for note in scale1.generate(length=length)]
     print("generating: %s for %s" % (expression, length))
     assert chord(results) == chord(expected)
예제 #4
0
파일: scale.py 프로젝트: music-apps/camp
 def _scale_test(self, expression=None, expected=None, length=None):
     if isinstance(expected, str):
         expected = expected.split()
     assert length is not None
     scale1 = scale(expression)
     results = [note for note in scale1.generate(length=length)]
     print("generating: %s for %s" % (expression, length))
     assert chord(results) == chord(expected)
예제 #5
0
   def test_chord_types_and_shortcuts(self):

       assert Chord(root=note('C4'), typ='major') == chord(['C4', 'E4', 'G4'])
       assert Chord(root=note('C4'), typ='minor') == chord(['C4', 'Eb4', 'G4'])

       assert chord('C4 major') == chord(['C4', 'E4', 'G4'])
       assert chord('C major') == chord(['C4', 'E4', 'G4'])
       assert chord('C aug') == chord(['C4', 'E', 'Ab4'])
       assert chord('C dim') == chord(['C4', 'Eb4', 'Gb4'])
예제 #6
0
파일: scale.py 프로젝트: mpdehaan/camp
    def test_c_major(self):

        scale1 = scale("C4 major")
        results = []
        for n in scale1.generate(length=10):
            results.append(n)

        # using chords here is kind of silly but it's a useful test function
        # naturally you wouldn't play it this way
        assert chord(results) == chord(["C4", "D4", "E4", "F4", "G4", "A4", "B4", "C5", "D5", "E5"])
예제 #7
0
파일: scale.py 프로젝트: YixuanFranco/camp
   def test_c_major(self):

       scale1 = scale('C4 major')
       results = []
       for note in scale1.generate(length=10):
           results.append(note)
   
       # using chords here is kind of silly but it's a useful test function
       # naturally you wouldn't play it this way
       assert chord(results) == chord(['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5', 'D5', 'E5'])
예제 #8
0
파일: scale.py 프로젝트: music-apps/camp
    def test_c_major(self):

        scale1 = scale('C4 major')
        results = []
        for n in scale1.generate(length=10):
            results.append(n)

        # using chords here is kind of silly but it's a useful test function
        # naturally you wouldn't play it this way
        assert chord(results) == chord(
            ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4', 'C5', 'D5', 'E5'])
예제 #9
0
파일: notation.py 프로젝트: mpdehaan/camp
    def test_basics(self):

        r = Roman(scale=scale("C4 major"))

        assert r.do("1") == note("C4")
        assert r.do("3") == note("E4")
        assert r.do("4") == note("F4")

        assert r.do("IV") == chord("F4 major")
        assert r.do("iv") == chord("F4 minor")

        # somewhat non-standard notation but allows describing other chord types (see chord.py)
        assert r.do("I:power") == chord(["C4", "G4"])
예제 #10
0
    def test_basics(self):

        r = Roman(scale=scale("C4 major"))

        assert r.do("1") == note("C4")
        assert r.do("3") == note("E4")
        assert r.do("4") == note("F4")

        assert r.do("IV") == chord("F4 major")
        assert r.do("iv") == chord("F4 minor")

        # somewhat non-standard notation but allows describing other chord types (see chord.py)
        assert r.do("I:power") == chord(["C4", "G4"])
예제 #11
0
    def do(self, sym):
        """
        Accepts symbols like C4-major or C4,E4,G4
        or note symbols like 'C4'
        """
        # The dash is a bit of a notation hack, it's there because "C4 major"
        # would look like two symbols, so we need to have no whitespace
        # between them

        if '-' in sym:
            return chord(sym.replace("-"," "))
        elif "," in sym:
            return chord(sym.split(","))
        else:
            return note(sym)
예제 #12
0
   def test_basics(self):

       notes = [ note('C4'), note('E4'), note('G4')]

       chord1 = Chord(notes=notes)
       assert chord1.notes[0] == note('C4')
       assert chord1.notes[1] == note('E4')
       assert chord1.notes[2] == note('G4')
       assert str(chord1) == 'Chord<C4,E4,G4>'

       chord2 = chord(['G4','C4','E4'])
       assert str(chord2) == 'Chord<C4,E4,G4>'
       assert chord1 == chord2

       assert chord(['C4','E4','G4']) != chord(['C4'])
       assert chord(['C4','E4','G4']) != chord(['C4', 'E4', 'G4', 'C5'])
예제 #13
0
    def do(self, sym):
        """
        Accepts symbols like C4-major or C4,E4,G4
        or note symbols like 'C4'
        """
        # The dash is a bit of a notation hack, it's there because "C4 major"
        # would look like two symbols, so we need to have no whitespace
        # between them

        if sym is None or sym == '-':
            # REST:
            return chord([])
        if '-' in sym:
            return chord(sym.replace("-", " "))
        elif "," in sym:
            return chord(sym.split(","))
        else:
            return note(sym)
예제 #14
0
    def test_basics(self):

        l = Literal()
        assert l.do("C4") == note("C4")
        assert l.do("C4-major") == chord("C4 major")
        assert l.do("C4,E4,G4") == chord("C4 major")
예제 #15
0
   def test_transpose(self):

       chord1 = chord(['G4','C4','E4'])
       assert chord1.transpose(steps=0.5) == chord(['Db4', 'F4', 'Ab4'])
       assert chord1.transpose(octaves=2) == chord(['C6', 'E6', 'G6'])
예제 #16
0
    def test_shortcuts(self):

        r = roman("C4 major")
        assert r.do("IV") == chord("F4 major")
예제 #17
0
 def test_inversions(self):
     assert chord("C4 major").invert() == chord(["E4","G4","C5"])
     assert chord("C4 major").invert(amount=2) == chord(["G4","C5","E5"])
예제 #18
0
파일: notation.py 프로젝트: mpdehaan/camp
    def test_basics(self):

        l = Literal()
        assert l.do("C4") == note("C4")
        assert l.do("C4-major") == chord("C4 major")
        assert l.do("C4,E4,G4") == chord("C4 major")
예제 #19
0
파일: notation.py 프로젝트: mpdehaan/camp
    def test_shortcuts(self):

        r = roman("C4 major")
        assert r.do("IV") == chord("F4 major")