From e80e6baf43633292d6184e83ae793a730ff8124a Mon Sep 17 00:00:00 2001 From: j Date: Wed, 1 Mar 2017 10:20:49 +0100 Subject: [PATCH] fix long vocals --- render.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/render.py b/render.py index b13d280..8b4aad0 100755 --- a/render.py +++ b/render.py @@ -45,7 +45,7 @@ if not os.path.exists('MUSIC.json'): 'duration': ox.avinfo(path)['duration'] }) with open('MUSIC.json', 'w') as fd: - json.dump(MUSIC, fd, indent=2) + json.dump(MUSIC, fd, indent=2, sort_keys=True) else: MUSIC = json.load(open('MUSIC.json')) @@ -59,7 +59,7 @@ if not os.path.exists('VOCALS.json'): 'duration': ox.avinfo(path)['duration'] }) with open('VOCALS.json', 'w') as fd: - json.dump(VOCALS, fd, indent=2) + json.dump(VOCALS, fd, indent=2, sort_keys=True) else: VOCALS = json.load(open('VOCALS.json')) @@ -263,7 +263,7 @@ def sequence(seq, letter): n = seq() clip = MUSIC[letter][n] position += clip['duration'] - if position > duration \ + if result[track] and position > duration \ and result[track][-1].get('blank') \ and result[track][-1]['duration'] > clip['duration']: result[track][-1]['duration'] -= (position-duration) @@ -289,7 +289,7 @@ def sequence(seq, letter): n = seq() clip = VOCALS[letter][n] position += clip['duration'] - if position > duration \ + if result[track] and position > duration \ and result[track][-1].get('blank') \ and result[track][-1]['duration'] > clip['duration']: result[track][-1]['duration'] -= (position-duration) @@ -300,7 +300,6 @@ def sequence(seq, letter): position -= clip['duration'] break if position < duration: - print('padding', track, duration, position) position += add_blank(result[track], duration - position) ''' if letter in VOCALS: