diff --git a/render.py b/render.py index 361f8ea..4cd50e3 100644 --- a/render.py +++ b/render.py @@ -69,7 +69,9 @@ def write_if_new(path, data, mode=''): def format_duration(duration, fps): return float('%0.5f' % (round(duration * fps) / fps)) -def compose(clips, target=150, base=1024, voice_over=None): +def compose(clips, target=150, base=1024, voice_over=None, options=None): + if options is None: + options = {} fps = 24 length = 0 scene = { @@ -149,6 +151,18 @@ def compose(clips, target=150, base=1024, voice_over=None): a, b = '-9.5', '-1.50' elif 'Melody' in voc['src']: a, b = '-5.25', '-0.25' + if options.get('stereo_downmix'): + a, b = '-9', '-1' + if 'Whispered' in voc['src']: + a, b = '-6', '2' + elif 'Read' in voc['src']: + a, b = '-5.75', '2.25' + elif 'Free' in voc['src']: + a, b = '-6.8', '3.2' + elif 'Ashley' in voc['src']: + a, b = '-7.5', '0.50' + elif 'Melody' in voc['src']: + a, b = '-3.25', '1.75' voc['filter'] = {'volume': a} scene['audio-center']['A1'].append(voc) vo_low = vo.copy() @@ -285,10 +299,13 @@ def compose(clips, target=150, base=1024, voice_over=None): blur = seq() * 3 if blur: scene['back']['V1'][-1]['filter']['blur'] = blur + volume_back = '-8.2' + if options.get('stereo_downmix'): + volume_back = '-6.2' scene['audio-back']['A1'].append({ 'duration': clip['duration'], 'src': clip['original'], - 'filter': {'volume': '-8.2'}, + 'filter': {'volume': volume_back}, }) # TBD: Foley cf_volume = '-2.5' @@ -498,7 +515,13 @@ def render_all(options): fragment_clips = fragment['clips'] unused_fragment_clips = [c for c in fragment_clips if c not in clips_used] print('fragment clips', len(fragment_clips), 'unused', len(unused_fragment_clips)) - scene, used = compose(unused_fragment_clips, target=target, base=fragment_base, voice_over=fragment['voice_over']) + scene, used = compose( + unused_fragment_clips, + target=target, + base=fragment_base, + voice_over=fragment['voice_over'], + options=options + ) clips_used += used scene_duration = get_scene_duration(scene) print("%s %6.3f -> %6.3f (%6.3f)" % (name, target, scene_duration, fragment_target))