Beispiel #1
0
# remove old test input
old_test = glob.glob("%s*.mid" % (composition_dir))
if len(old_test) > 0:
    for i in old_test:
        os.remove(i)

mel_files = glob.glob("%s*.mid" % (mel_dir))
composition_files = []
for i in range(len(mel_files)):
    composition_files.append('%d' % (i + 1))

mel_lowest_note = 60

mel_roll = roll(train)
double_mel_roll = data_utils_train.doubleRoll(mel_roll)
test_data = data_utils_compose.createNetInputs(double_mel_roll, 256)

batch_size = 128
thresh = float(input('Threshold (recommended ~ 0.1):'))

print("Loading Model and Weights...")
#Load model file
model_dir = 'models/models json/'
model_files = listdir(model_dir)
print("Choose a file for the json model file:")
print("---------------------------------------")
for i, file in enumerate(model_files):
    print(str(i) + " : " + file)
print("---------------------------------------")
file_number_model = int(
    input('Type in the number in front of the file you want to choose:'))
Beispiel #2
0
print(
    "Choose a resolution factor. (e.g. Resolution_Factor=24: 1/8 Resolution, 12: 1/16 Resolution, 6: 1/32 Resolution, etc...)"
)
resolution_factor = int(
    input('Resolution Factor (recommended=12):'
          ))  #24: 1/8 Resolution, 12: 1/16 Resolution, 6: 1/32 Resolution

chord_lowest_note, chord_highest_note, chord_ticks = data_utils_compose.getNoteRangeAndTicks(
    chord_files, res_factor=resolution_factor)

chord_roll = data_utils_compose.fromMidiCreatePianoRoll(
    chord_files, chord_ticks, chord_lowest_note, res_factor=resolution_factor)

double_chord_roll = data_utils_compose.doubleRoll(chord_roll)

test_data = data_utils_compose.createNetInputs(double_chord_roll,
                                               seq_length=chord_ticks)

batch_size = 128
class_mode = "binary"

print()
print()
print(
    "Enter the threshold (threshold is used for creating a Piano Roll Matrix out of the Network Output)"
)
thresh = float(input('Threshold (recommended ~ 0.1):'))

print()
print()
print("Loading Model and Weights...")
print()
print("Melodies will be saved to the files:")
print(composition_files)
print()

print("Choose a resolution factor. (e.g. Resolution_Factor=24: 1/8 Resolution, 12: 1/16 Resolution, 6: 1/32 Resolution, etc...)")
resolution_factor = int(input('Resolution Factor (recommended=12):')) #24: 1/8 Resolution, 12: 1/16 Resolution, 6: 1/32 Resolution


chord_lowest_note, chord_highest_note, chord_ticks = data_utils_compose.getNoteRangeAndTicks(chord_files, res_factor=resolution_factor)

chord_roll = data_utils_compose.fromMidiCreatePianoRoll(chord_files, chord_ticks, chord_lowest_note,
                                                        res_factor=resolution_factor)

double_chord_roll = data_utils_compose.doubleRoll(chord_roll)

test_data = data_utils_compose.createNetInputs(double_chord_roll, seq_length=chord_ticks)

batch_size = 128
class_mode = "binary"

print()
print()
print("Enter the threshold (threshold is used for creating a Piano Roll Matrix out of the Network Output)")
thresh = float(input('Threshold (recommended ~ 0.1):'))

print()
print()
print("Loading Model and Weights...")
print()

#Load model file