Beispiel #1
0
def initialisation_polyphony(model_name):
    print("initializing generator...")
    bundle = sequence_generator_bundle.read_bundle_file('./content/' +
                                                        model_name +
                                                        '_rnn.mag')
    generator_map = polyphony_sequence_generator.get_generator_map()
    polyphony_rnn = generator_map[model_name](checkpoint=None, bundle=bundle)
    polyphony_rnn.initialize()
    print('🎉initializing done!')
    return polyphony_rnn
Beispiel #2
0
    'state_control_number', None,
    'The control number to use for sending the state. A value of 0 represents '
    '`IDLE`, 1 is `LISTENING`, and 2 is `RESPONDING`.')
tf.app.flags.DEFINE_float('playback_offset', 0.0,
                          'Time in seconds to adjust playback time by.')
tf.app.flags.DEFINE_integer('playback_channel', 0,
                            'MIDI channel to send play events.')
tf.app.flags.DEFINE_string(
    'log', 'WARN',
    'The threshold for what messages will be logged. DEBUG, INFO, WARN, ERROR, '
    'or FATAL.')

# A map from a string generator name to its class.
_GENERATOR_MAP = melody_rnn_sequence_generator.get_generator_map()
_GENERATOR_MAP.update(drums_rnn_sequence_generator.get_generator_map())
_GENERATOR_MAP.update(polyphony_sequence_generator.get_generator_map())


def _validate_flags():
    """Returns True if flag values are valid or prints error and returns False."""
    if FLAGS.list_ports:
        print "Input ports: '%s'" % ("', '".join(
            midi_hub.get_available_input_ports()))
        print "Ouput ports: '%s'" % ("', '".join(
            midi_hub.get_available_output_ports()))
        return False

    if FLAGS.bundle_files is None:
        print '--bundle_files must be specified.'
        return False
Beispiel #3
0
    'playback_offset',
    0.0,
    'Time in seconds to adjust playback time by.')
tf.app.flags.DEFINE_integer(
    'playback_channel',
    0,
    'MIDI channel to send play events.')
tf.app.flags.DEFINE_string(
    'log', 'WARN',
    'The threshold for what messages will be logged. DEBUG, INFO, WARN, ERROR, '
    'or FATAL.')

# A map from a string generator name to its class.
_GENERATOR_MAP = melody_rnn_sequence_generator.get_generator_map()
_GENERATOR_MAP.update(drums_rnn_sequence_generator.get_generator_map())
_GENERATOR_MAP.update(polyphony_sequence_generator.get_generator_map())


def _validate_flags():
  """Returns True if flag values are valid or prints error and returns False."""
  if FLAGS.list_ports:
    print "Input ports: '%s'" % (
        "', '".join(midi_hub.get_available_input_ports()))
    print "Ouput ports: '%s'" % (
        "', '".join(midi_hub.get_available_output_ports()))
    return False

  if FLAGS.bundle_files is None:
    print '--bundle_files must be specified.'
    return False