MCPcopy Create free account
hub / github.com/bspaans/python-mingus / substitute_diminished_for_diminished

Function substitute_diminished_for_diminished

mingus/core/progressions.py:363–395  ·  view source on GitHub ↗

Substitute a diminished chord for another diminished chord. 'dim' and 'dim7' suffixes recognized, and 'VI' if there is no suffix. Example: >>> substitute_diminished_for_diminished(['VII'], 0) ['IIdim', 'bIVdim', 'bbVIdim']

(
    progression, substitute_index, ignore_suffix=False
)

Source from the content-addressed store, hash-verified

361
362
363def substitute_diminished_for_diminished(
364 progression, substitute_index, ignore_suffix=False
365):
366 """Substitute a diminished chord for another diminished chord.
367
368 'dim' and 'dim7' suffixes recognized, and 'VI' if there is no suffix.
369
370 Example:
371 >>> substitute_diminished_for_diminished(['VII'], 0)
372 ['IIdim', 'bIVdim', 'bbVIdim']
373 """
374 (roman, acc, suff) = parse_string(progression[substitute_index])
375 res = []
376
377 # Diminished progressions
378 if (
379 suff == "dim7"
380 or suff == "dim"
381 or suff == ""
382 and roman in ["VII"]
383 or ignore_suffix
384 ):
385 if suff == "":
386 suff = "dim"
387
388 # Add diminished chord
389 last = roman
390 for x in range(3):
391 next = skip(last, 2)
392 acc += interval_diff(last, next, 3)
393 res.append(tuple_to_string((next, acc, suff)))
394 last = next
395 return res
396
397
398def substitute_diminished_for_dominant(

Callers

nothing calls this directly

Calls 4

parse_stringFunction · 0.85
skipFunction · 0.85
interval_diffFunction · 0.85
tuple_to_stringFunction · 0.85

Tested by

no test coverage detected