Ejemplo n.º 1
0
def check_song_same_data_in_different_order():
    song = np.array([[7, 8, 9], [4, 5, 6], [1, 2, 3]])
    mass_check = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    n = 2
    song_res = np.array([7, 8, 9])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "Same data in a different order error"
Ejemplo n.º 2
0
def check_song_mass_check_less_song():
    song = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    mass_check = np.array([[1, 2, 3, 4, 5, 6]])
    n = 2
    song_res = np.array([[1, 2, 3], [4, 5, 6]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "mass_check less than song error"
Ejemplo n.º 3
0
def check_song_zero_step():
    song = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    mass_check = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    n = 0
    song_res = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "Zero step error"
Ejemplo n.º 4
0
def check_song_error_in_middle():
    song = np.array([[1, 2, 3], [4, 5, 5], [7, 8, 9]])
    mass_check = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    n = 1
    song_res = np.array([[1, 2, 3], [7, 8, 9]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "Error in middle"
Ejemplo n.º 5
0
def check_song_typical_test():
    song = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    mass_check = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    n = 1
    song_res = np.array([[1, 2, 3], [4, 5, 6]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "Typical test error"
Ejemplo n.º 6
0
def check_song_some_track_in_middle():
    song = np.array([[1, 2, 3], [4, 5, 5], [7, 8, 8], [8, 8, 8]])
    mass_check = np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 1, 2, 3],
                           [4, 5, 6, 7, 8, 8]])
    n = 2
    song_res = np.array([1, 2, 3])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "Some track in middle error"
Ejemplo n.º 7
0
def check_song_mass_check_more_song_bad():
    song = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    mass_check = np.array([[1, 2, 3, 4, 5, 6], [7, 8, 9, 1, 2, 3],
                           [4, 5, 6, 7, 8, 7]])
    n = 2
    song_res = np.array([[1, 2, 3], [4, 5, 6]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "mass_check more than song bad error"
Ejemplo n.º 8
0
def check_song_mass_check_more_song_good():
    song = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    mass_check = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 2, 3],
                           [4, 5, 6], [7, 8, 8]])
    n = 1
    song_res = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 8]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "mass_check more than song good error"
Ejemplo n.º 9
0
def check_song_real_data_error_in_middle():
    song = np.array([[0, 1, 1, 0, 1], [0, 1, 1, 1, 0], [1, 0, 1, 0, 1]])
    mass_check = np.array([[0, 1, 1, 0, 1], [1, 1, 1, 1, 1, 1, 0, 1, 0, 1],
                           [0, 1, 0, 1, 0, 1, 0, 0, 0, 1],
                           [0, 1, 1, 1, 0, 1, 0, 1, 0, 1]])
    n = 2
    song_res = np.array([[0, 1, 1, 0, 1], [1, 0, 1, 0, 1]])
    midi = midi_manipulation.midi_manipulation()
    song = midi.check_song(song, mass_check, n)
    assert np.all(song_res == song), "Real data error in middle"
Ejemplo n.º 10
0
    args = parser.parse_args()

    if (args.directory):
        path = args.directory
        print(path)

    if (args.output):
        output = args.output
        print(output)
    if (args.test):
        start_test = args.test
        if (start_test == 'start'):
            #print("test")
            test.start()

    midi = midi_manipulation.midi_manipulation()

    ma = main()

    songs = ma.get_files(path, midi)
    # midi.mass_check = set(midi.mass_check)
    if len(songs) == 0:
        print('error: the directory is empty')
    else:
        # print(songs)
        if (not os.path.isdir("generated")):
            os.mkdir("generated")

        # print("11111111111111111111111111111111111111111111111111111112")
        neur = neuralnet.neuralnet()
        neur.train(songs, midi, start_test)