-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
25 lines (20 loc) · 807 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import time
from mingus.core import scales, meter, chords, progressions
from mingus.containers import Note, NoteContainer, Bar, Track
from mingus.midi import fluidsynth
from random import randint, random, choice
from mingus.containers.instrument import Instrument, Piano, Guitar
fluidsynth.init("GeneralUserGSv1.471.sf2", "alsa")
while True:
currentChord = NoteContainer(["C", "E", "G"]) # Random chord from progression
# Lower 1 octave
for i in range(len(currentChord)):
aux = Note(currentChord[i])
aux.octave_down()
currentChord[i] = aux
for i in range(105, 200):
print(i)
fluidsynth.set_instrument(1, i)
fluidsynth.play_NoteContainer(currentChord, 1, 20)
time.sleep(2.0)
fluidsynth.stop_NoteContainer(currentChord, 1)