Пример #1
0
def main():
   parser = argparse.ArgumentParser()
   parser.add_argument("inputList", #nargs="?" , 
                       help=("Training sample list."),
                       #default=config.defaultTrainSampleList
                      )
   parser.add_argument("outputDir", nargs="?" , 
                       help="Music output directory",
                       default = config.defaultOutputDir
                      )
   #parser.add_argument("modelName", nargs="?" , 
   #                    help="model filename",
   #                    default=config.defaultModelFilename
   #                    )
   args = parser.parse_args()


   trainSampList = sampleLoader.parseFileList(args.inputList)

   trainFeatsList = []
   for trainSampFilename in trainSampList:
      trainSamp = sampleLoader.loadTrainSample(trainSampFilename)
      trainFeat = featureManager.extractTrainFeat(trainSamp)
      trainFeatsList.append(trainFeat)

   trainFeatFilename = config.getTrainInFeatFilename(args)
   featureManager.saveJson(trainFeatsList, trainFeatFilename);

   m = model.getModelObj();
   #modelName = config.getModelFilename(args)
   m.train(args); #load features from config.getTrainInFeatFilename(args)
Пример #2
0
def main():
   parser = argparse.ArgumentParser()
   parser.add_argument("input", #nargs="1" , 
                       help="Score to be played, without extension.",
                       #default=config.defaultGenScore
                      )
   parser.add_argument("modelFilename", #nargs="1" , 
                       help="Model filename",
                       #default=config.defaultModelFilename
                      )
   parser.add_argument("outputDir", nargs="?" , 
                       help="Music output directory",
                       default = config.defaultOutputDir
                      )
   args = parser.parse_args()


   genScore = sampleLoader.loadGenScore(args.input)
   genFeat = featureManager.extractGenFeat(genScore)
   #wrap genFeat by {} because trainFeats is {score1, score2}
   featureManager.saveJson([genFeat], config.getGenInFeatFilename(args))
   #perfFeats = model.genPerfFeats(config.defaultGenFeatFilename, args.modelFilename)
   m = model.getModelObj()
   perfFeats = m.gen(args)
   #wrap perfFeat by {} because trainFeats is {score1, score2}
   featureManager.saveJson([perfFeats], config.getGenOutFeatFilename(args))

   musicGenerator.genMusic(genScore, args)
Пример #3
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "inputList",  #nargs="?" , 
        help=("Training sample list."),
        #default=config.defaultTrainSampleList
    )
    parser.add_argument("outputDir",
                        nargs="?",
                        help="Music output directory",
                        default=config.defaultOutputDir)
    #parser.add_argument("modelName", nargs="?" ,
    #                    help="model filename",
    #                    default=config.defaultModelFilename
    #                    )
    args = parser.parse_args()

    trainSampList = sampleLoader.parseFileList(args.inputList)

    trainFeatsList = []
    for trainSampFilename in trainSampList:
        trainSamp = sampleLoader.loadTrainSample(trainSampFilename)
        trainFeat = featureManager.extractTrainFeat(trainSamp)
        trainFeatsList.append(trainFeat)

    trainFeatFilename = config.getTrainInFeatFilename(args)
    featureManager.saveJson(trainFeatsList, trainFeatFilename)

    m = model.getModelObj()
    #modelName = config.getModelFilename(args)
    m.train(args)