def testMelodyRNNPipeline(self):
        FLAGS.eval_ratio = 0.0
        note_sequence = testing_lib.parse_test_proto(
            music_pb2.NoteSequence, """
        time_signatures: {
          numerator: 4
          denominator: 4}
        tempos: {
          qpm: 120}""")
        testing_lib.add_track(note_sequence, 0, [(12, 100, 0.00, 2.0),
                                                 (11, 55, 2.1, 5.0),
                                                 (40, 45, 5.1, 8.0),
                                                 (55, 120, 8.1, 11.0),
                                                 (53, 99, 11.1, 14.1)])

        quantizer = pipelines_common.Quantizer(steps_per_quarter=4)
        melody_extractor = pipelines_common.MonophonicMelodyExtractor(
            min_bars=7,
            min_unique_pitches=5,
            gap_bars=1.0,
            ignore_polyphonic_notes=False)
        one_hot_encoder = melodies_lib.OneHotEncoderDecoder(0, 127, 0)
        quantized = quantizer.transform(note_sequence)[0]
        print quantized.tracks
        melody = melody_extractor.transform(quantized)[0]
        one_hot = one_hot_encoder.encode(melody)
        print one_hot
        expected_result = {'training_melodies': [one_hot], 'eval_melodies': []}

        pipeline_inst = melody_rnn_create_dataset.get_pipeline(one_hot_encoder)
        result = pipeline_inst.transform(note_sequence)
        self.assertEqual(expected_result, result)
def get_pipeline():
  return melody_rnn_create_dataset.get_pipeline(
      attention_rnn_encoder_decoder.MelodyEncoderDecoder())
Beispiel #3
0
def get_pipeline():
    return melody_rnn_create_dataset.get_pipeline(
        lookback_rnn_encoder_decoder.MelodyEncoderDecoder())
def get_pipeline():
    return melody_rnn_create_dataset.get_pipeline(
        attention_rnn_encoder_decoder.MelodyEncoderDecoder())
def get_pipeline():
  return melody_rnn_create_dataset.get_pipeline(
      lookback_rnn_encoder_decoder.MelodyEncoderDecoder())