Skip to content

Commit

Permalink
You can add two spaces in a progression definition to insert a rest
Browse files Browse the repository at this point in the history
  • Loading branch information
ldrolez committed Oct 12, 2024
1 parent 25a0984 commit 40526f5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
import mingus.core.scales as scales
import sys
import re

from src.chords2midi import c2m
from chords import *
Expand Down Expand Up @@ -64,7 +65,7 @@
# Test mode
if len(sys.argv) > 1 and sys.argv[1] == '--test':
keys = [ ('C', 'A') ]
styles = [ '' ]
#styles = [ '' ]

#
# Generate a single chord
Expand All @@ -82,11 +83,17 @@ def gen(dir, key, chords, prefix):
#
def genprog(dir, key, chords, prefix, style = ''):
c2m_obj = c2m.Chords2Midi()
args = chords.split(" ")
# two spaces to insert a rest
newchords = re.sub(r' ', ' X ', chords)
args = newchords.split(" ")
if style != '':
args.extend(["-p", style])
dir = dir + "/" + style + " style"
else:
elif re.search(r' X ', newchords):
# if there are rests
args.extend(["-d", "2", "-p", "basic"])
else:
# no rests
args.extend(["-d", "4", "-p", "long"])
args.extend(["-t", "5", "-B",
"--key", f"{key}", "-N", f"{prefix} - {chords}", "--output",
Expand Down

0 comments on commit 40526f5

Please sign in to comment.