Exemple #1
0
 def __init__(self, files):
     self.tunes = []
     for filename in glob.glob(files):
         try:
             self.tunes.append(Tune.Tune(filename))
         except:
             print("could not load:", filename)
from network import NeuralNetwork
from music21 import environment
from common import Tune, Note
from utils import compareNewMelody, updateNoteInput, updatePoDInput
from MusicConverter import MusicConverter, MUSIC_STREAM

############################################################################

ND_modelFilepath = "../weights/30_note-duration_sequence20_epoch20_LLDD_WD"
ND_sequenceLength = 20

NN_modelFilepath = "../weights/old_weights/3L_2LSTM1D_WD_SL15_model_epoch65_batch15"
NN_sequenceLength = 15

newMelodyLength = 50
starter = Tune.Tune("../ABC/ABCChina06")

inputIndex = 5
inputIndex2 = 15
############################################################################

environment.set('musicxmlPath', '/bin/musescore3')

ND_model = NeuralNetwork.NeuralNetwork()
ND_model.load_model(ND_modelFilepath)
starterInput, temp = starter.getTrainData(ND_sequenceLength)
ND_input = starterInput[inputIndex]
ND_inputShape = (1, ND_sequenceLength, 450)

NN_model = NeuralNetwork.NeuralNetwork()
NN_model.load_model(NN_modelFilepath)
from network import NeuralNetwork
from common import TuneLoader, Tune, Note
from music21 import environment
from MusicConverter import MusicConverter, MUSIC_STREAM
import numpy as np
from utils import compareNewMelody

filepath = "weights/70_note-note_sequence10_epoch250_LLLLD_WD"

GenNN = NeuralNetwork.NeuralNetwork()
GenNN.load_model(filepath)

environment.set('musicxmlPath', '/bin/musescore3' )
tune = Tune.Tune("ABC/ABCChina06")

tune.show("text")