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

Function substitute_harmonic

mingus/core/progressions.py:258–290  ·  view source on GitHub ↗

Do simple harmonic substitutions. Return a list of possible substitions for progression[substitute_index]. If ignore_suffix is set to True the suffix of the chord being substituted will be ignored. Otherwise only progressions without a suffix, or with suffix '7' will be substituted.

(progression, substitute_index, ignore_suffix=False)

Source from the content-addressed store, hash-verified

256
257
258def substitute_harmonic(progression, substitute_index, ignore_suffix=False):
259 """Do simple harmonic substitutions. Return a list of possible substitions
260 for progression[substitute_index].
261
262 If ignore_suffix is set to True the suffix of the chord being
263 substituted will be ignored. Otherwise only progressions without a
264 suffix, or with suffix '7' will be substituted.
265
266 The following table is used to convert progressions:
267 || I || III ||
268 || I || VI ||
269 || IV || II ||
270 || IV || VI ||
271 || V || VII ||
272 """
273 simple_substitutions = [
274 ("I", "III"),
275 ("I", "VI"),
276 ("IV", "II"),
277 ("IV", "VI"),
278 ("V", "VII"),
279 ]
280 res = []
281 (roman, acc, suff) = parse_string(progression[substitute_index])
282 if suff == "" or suff == "7" or ignore_suffix:
283 for subs in simple_substitutions:
284 r = subs[1] if roman == subs[0] else None
285 if r == None:
286 r = subs[0] if roman == subs[1] else None
287 if r != None:
288 suff = suff if suff == "7" else ""
289 res.append(tuple_to_string((r, acc, suff)))
290 return res
291
292
293def substitute_minor_for_major(progression, substitute_index, ignore_suffix=False):

Callers

nothing calls this directly

Calls 2

parse_stringFunction · 0.85
tuple_to_stringFunction · 0.85

Tested by

no test coverage detected