Nikolay-Lysenko/rl-musician

View on GitHub
docs/config_with_explanations.yml

Summary

Maintainability
Test Coverage
# This is an elucidated copy of `default_config.yml`.
# The file is updated for v0.4.5.

piece:  # Parameters of a piece to be composed automatically.
  tonic: C  # Main pitch class (also known as key). You can use octothorp/hash if needed (like D#).
  scale_type: major  # Valid values are: 'major', 'natural_minor', and 'harmonic_minor'.
  cantus_firmus:  # Pre-defined melodic line (voice) consisting of whole (semibreve) notes only.
    - C4
    - D4
    - E4
    - C4
    - A3
    - B3
    - C4
    - G4
    - E4
    - C4
    - D4
    - C4
  counterpoint_specifications:  # Parameters of a melodic line (voice) that is going to be composed automatically.
    start_note: G4
    end_note: C5
    lowest_note: C4  # This means that notes below it can not be used, but there is no guarantee that this note occurs.
    highest_note: B5  # This means that notes above it can not be used, but there is no guarantee that this note occurs.
    start_pause_in_eighths: 4  # Delay in eighths of measure between cantus firmus start and counterpoint line start.
    max_skip_in_degrees: 7  # Maximum skip (leap) that can occur in counterpoint line (in scale degrees).
  rules:  # Rules of counterpoint composition that can not be violated.
    names:  # See implementations from `rlmusician.environment.rules.py` to find more details.
      - rhythmic_pattern_validity
      - rearticulation_stability
      - absence_of_stalled_pitches
      - absence_of_long_motion
      - absence_of_skip_series
      - turn_after_skip
      - VI_VII_resolution
      - step_motion_to_end
      - consonance_on_strong_beat
      - step_motion_to_dissonance
      - step_motion_from_dissonance
      - resolution_of_suspended_dissonance
      - absence_of_large_intervals
      - absence_of_lines_crossing
      - absence_of_overlapping_motion
    params:  # See implementations from `rlmusician.environment.rules.py` to find more details.
      absence_of_stalled_pitches:
        max_n_repetitions: 2
      absence_of_long_motion:
        max_distance_in_semitones: 9
      absence_of_skip_series:
        max_n_skips: 2
      turn_after_skip:
        min_n_scale_degrees: 3
      step_motion_to_end:
        prohibit_rearticulation: true
      absence_of_large_intervals:
        max_n_semitones: 16
      absence_of_lines_crossing:
        prohibit_unisons: true
  rendering_params:  # Parameters of converting created piece to TSV, MIDI, and WAV files.
    dir: rlmusician_data  # Relative path to directory with results.
    measure_in_seconds: 1.0  # Duration of one measure in seconds.
    midi:
      cantus_firmus_instrument: 0  # ID (according to General MIDI specification) of instrument that plays cantus firmus.
      counterpoint_instrument: 0  # ID (according to General MIDI specification) of instrument that plays counterpoint line.
      velocity: 100  # MIDI velocity (i.e., force of sound extraction, it may affect loudness and timbre), an integer between 0 and 128.
    sinethesizer:  # Settings of a tool that creates WAV files.
      cantus_firmus_instrument: additive_mellow_pipe  # Name of instrument (from `rlmusician.configs.sinethesizer_presets.yml`) for cantus firmus.
      counterpoint_timbre: sawtooth_with_filter_envelope  # Name of instrument (from `rlmusician.configs.sinethesizer_presets.yml`) for counterpoint line.
      velocity: 0.6  # Velocity (i.e., force of sound extraction, it may affect loudness and timbre), a float between 0 and 1.
environment:  # Parameters of environment that provides rewards and observations.
  scoring_coefs:  # See implementations from `rlmusician.environment.evaluation.py` to find more details.
    climax_explicity: 1
    entropy: 1
    looped_fragments: 1
    narrow_ranges: 1
    number_of_skips: 1
  scoring_fn_params:
    climax_explicity:
      shortage_penalty: 0.3
      duplication_penalty: 0.5
    looped_fragments:
      min_size: 8
      max_size:
    narrow_ranges:
      min_size: 9
      penalties:
        2: 1
        3: 0.5
    number_of_skips:
      rewards:
        1: 0.8
        2: 0.9
        3: 1.0
        4: 0.9
        5: 0.5
        6: 0.25
  reward_for_dead_end: -3  # Reward for any unfinished counterpoint line.
agent:  # Parameters of optimization algorithm (currently, it is a modified version of Monte Carlo Beam Search).
  beam_width: 5  # Number of best subsequences of actions to explore further.
  n_records_to_keep: 10  # Number of best previously played episodes to keep.
  n_trials_estimation_depth: 3  # Number of steps ahead to explore in order to estimate number of random trials for the current iteration.
  n_trials_estimation_width: 10  # Number of exploratory random trials that collect statistics for number of random trials estimation.
  n_trials_factor: 3  # Factor such that estimated number of trials is multiplied by it.
  paralleling_params:  # Parameters of `mp.Pool` (like `n_processes` or `max_tasks_per_child`).
    n_processes:  # Blank value is `None` and so all cores are used.