示例#1
0
from synth.utils import (init_midi, add_voicing, persist)

from chords.store import (get as get_chord, get_voicing)
from chords.ops import invert

major_triad = get_chord('major')
cmaj = get_voicing(major_triad, root='C')

inversions = [
    invert(cmaj, inversion=i)
    for i in range(1, 4)  # invert to 4, to make it sound nicer
]

print(cmaj)
for inversion in inversions:
    print(inversion)

synthesized_voicing = [
    synthesize_voicing(cmaj), *[synthesize_voicing(v) for v in inversions]
]

title = 'cmaj_inversions'
m = init_midi(title=title)

duration = 2
t = 0
for synth_voicing in synthesized_voicing:
    t = add_voicing(m, synth_voicing, t, duration)

persist(m, title)
示例#2
0
from modes.store import (
	get as get_mode,
	get_scale_from_mode
)

from synth.store import (
	synthesize_scale 
)
from synth.utils import (
	init_midi,
	add_scale,
	persist
)


ionian = get_mode('ionian')
c_maj_scale = get_scale_from_mode(ionian, root='C')
print(c_maj_scale.describe())

title = 'cmaj_scale'
m = init_midi()

_ = add_scale(
	m, synthesize_scale(c_maj_scale), spacing=1
)

persist(m, title)