Skip to content

IndexError to examine #1

@malcolmsailor

Description

@malcolmsailor

Following (random) settings give an IndexError:

{
    "seed": 3983367668,
    "num_voices": 2,
    "pattern_len": (4, 7),
    "rhythm_len": (4, 7),
    "pitch_loop": False,
    "harmony_len": (4, 7),
    "truncate_patterns": False,
    "voice_order_str": "reverse",
    "interval_cycle": (11),
    "chords": (
        (1.0, 1.25, 1.5),
        (1.66667, 2.0, 2.5),
        (1.125, 1.35, 1.6875),
        (1.125, 1.35, 1.6875),
    ),
    "parallel_voice_leading": False,
    "voice_lead_chord_tones": True,
    "preserve_foot_in_bass": "none",
    "chord_tone_and_foot_disable": False,
    "chord_tone_selection": False,
    "force_chord_tone": "none",
    "chord_tones_sync_onset_in_all_voices": False,
    "force_foot_in_bass": "first_note",
    "prefer_small_melodic_intervals": True,
    "force_repeated_notes": False,
    "force_parallel_motion": False,
    "consonance_treatment": "all_onsets",
    "cont_rhythms": "none",
    "vary_rhythm_consistently": False,
    "rhythmic_unison": True,
    "rhythmic_quasi_unison": True,
    "hocketing": True,
    "onset_density": (0.3, 0.95),
    "dur_density": (0.1, 0.2),
    "onset_subdivision": 0.16666666666666666,
    "randomly_distribute_between_choirs": True,
    "length_choir_segments": 0.25,
    "tempo": 159,
}

Traceback:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/__main__.py", line 165, in <module>
    main()
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/__main__.py", line 150, in main
    settings, changers, pattern, changed_pattern = build(args)
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/__main__.py", line 100, in build
    pattern = make_pattern(args, settings)
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/__main__.py", line 85, in make_pattern
    pattern = er_make_handler.make_super_pattern(settings)
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_make_handler.py", line 82, in make_super_pattern
    raise main_thread.exc
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_make_handler.py", line 59, in function
    self.result = target(*args, **kwargs)
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_make.py", line 999, in make_super_pattern
    if voice_lead_pattern(er, super_pattern, voice_lead_error):
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_make.py", line 972, in voice_lead_pattern
    and er_vl_strict_and_flex.voice_lead_pattern_strictly(
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_vl_strict_and_flex.py", line 267, in voice_lead_pattern_strictly
    if voice_lead_pattern_strictly(
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_vl_strict_and_flex.py", line 261, in voice_lead_pattern_strictly
    new_notes = strict_voice_leading_loop(
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_vl_strict_and_flex.py", line 168, in strict_voice_leading_loop
    prev_note = voice.get_notes_by_i(prev_note_j)[0]
  File "/Users/malcolm/google_drive/python/efficient_rhythms/efficient_rhythms/er_classes/voice.py", line 202, in get_notes_by_i
    return self._data.peekitem(i)[1]
  File "/Users/malcolm/venvs/efficient_rhythms/lib/python3.9/site-packages/sortedcontainers/sorteddict.py", line 510, in peekitem
    key = self._list[index]
  File "/Users/malcolm/venvs/efficient_rhythms/lib/python3.9/site-packages/sortedcontainers/sortedlist.py", line 901, in __getitem__
    pos, idx = self._pos(index)
  File "/Users/malcolm/venvs/efficient_rhythms/lib/python3.9/site-packages/sortedcontainers/sortedlist.py", line 667, in _pos
    raise IndexError('list index out of range')
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions