Exemple #1
0
 def test_set_note(self):
     n = Note()
     self.assert_(n.set_note('C', 5, {}))
     n.empty()
     self.assert_(n.set_note('C-5'))
     self.assert_(n.set_note('C', 5))
     self.assert_(n.set_note('C#-12', 5))
     self.assertRaises(NoteFormatError, n.set_note, 'H')
     self.assertRaises(NoteFormatError, n.set_note, 'C 23')
     self.assertRaises(NoteFormatError, n.set_note, 'C# 123')
Exemple #2
0
 def test_set_note(self):
     n = Note()
     self.assert_(n.set_note('C', 5, {}))
     n.empty()
     self.assert_(n.set_note('C-5'))
     self.assert_(n.set_note('C', 5))
     self.assert_(n.set_note('C#-12', 5))
     self.assertRaises(NoteFormatError, n.set_note, 'H')
     self.assertRaises(NoteFormatError, n.set_note, 'C 23')
     self.assertRaises(NoteFormatError, n.set_note, 'C# 123')
 def test_set_note(self):
     n = Note()
     self.assertTrue(n.set_note("C", 5, {}))
     n.empty()
     self.assertTrue(n.set_note("C-5"))
     self.assertTrue(n.set_note("C", 5))
     self.assertTrue(n.set_note("C#-12", 5))
     self.assertRaises(NoteFormatError, n.set_note, "H")
     self.assertRaises(NoteFormatError, n.set_note, "C 23")
     self.assertRaises(NoteFormatError, n.set_note, "C# 123")
Exemple #4
0
				if event.unicode == '9':
                                        note = "A#"
                                        note_type = 23
				if args.note:
                       			 note_type = int(args.note[0],10)
				if note != "" and  notes.is_valid_note(note) == False:
					print ERROR + "invalid note"
				else:
					if note == "":
						break;
					n = Note()
					if note == "k":
						n.set_Note('B')
					else:
						if note_type == 0:
							n.set_note(note)
						else:
							n.set_note(note,note_type)
					print ACTION + "playing Note : " + note
					fluidsynth.play_Note(n)
					#saving the play
					if args.save:
						nc.add_note(n)
			
				if event.unicode == 's':
					print ACTION + "saving file .."	
		else:
			if keyPressed(K_SPACE) == True or keyPressed(K_w) or keyPressed(K_a) or keyPressed(K_b) or keyPressed(K_c) or keyPressed(K_d) or keyPressed(K_e):
				play()
				print "playing"
			else:
Exemple #5
0
                if event.unicode == '9':
                    note = "A#"
                    note_type = 23
                if args.note:
                    note_type = int(args.note[0], 10)
                if note != "" and notes.is_valid_note(note) == False:
                    print ERROR + "invalid note"
                else:
                    if note == "":
                        break
                    n = Note()
                    if note == "k":
                        n.set_Note('B')
                    else:
                        if note_type == 0:
                            n.set_note(note)
                        else:
                            n.set_note(note, note_type)
                    print ACTION + "playing Note : " + note
                    fluidsynth.play_Note(n)
                    #saving the play
                    if args.save:
                        nc.add_note(n)

                if event.unicode == 's':
                    print ACTION + "saving file .."
        else:
            if keyPressed(K_SPACE) == True or keyPressed(K_w) or keyPressed(
                    K_a) or keyPressed(K_b) or keyPressed(K_c) or keyPressed(
                        K_d) or keyPressed(K_e):
                play()