예제 #1
0
파일: avsgen.py 프로젝트: dmzkrsk/harmony
                avs.Var('wave'), "add", avs.Var('waveOpacity'), avs.Var('W/2-wW'), avs.Var('H-wH'),
            )
        else:
            print settings.MAIN_VIDEO_CLIP + ' = ' + avs.Function('Animate', mvc, 0, avs.Var('frameCount') + ' - 1', "Layer",
                avs.Var('wave'), "add", avs.Var('waveOpacity'), 0, avs.Var('H-wH'),
                avs.Var('wave'), "add", avs.Var('waveOpacity'), avs.Var('W-wW'), avs.Var('H-wH'),
            )
    # Анимируем указатель
    if waveMoving and options.middle:
        print settings.MAIN_VIDEO_CLIP + ' = ' + avs.Function('Overlay', mvc, avs.Var('bar'), x=avs.Var('W/2'), y=avs.Var('H-wH'))
    else:
        print settings.MAIN_VIDEO_CLIP + ' = ' + avs.Function('Animate', mvc, 0, avs.Var('frameCount') + ' - 1', "Overlay",
            avs.Var('bar'), 0, avs.Var('H-wH'),
            avs.Var('bar'), avs.Var('W'), avs.Var('H-wH'),
        )

    # Загружаем звук
    print 'a = ' + avs.Function('WAVSource', avs.Var("wavSource"))
    # Сводим
    print avs.Function('AudioDub', mvc, avs.Var('a'))
    # Глобальные надписи
    print avs.Function('Subtitle', harmony.buildTitle(MetaTitle).getTitle(),
        y=4,
        first_frame=0,
        last_frame=avs.Var('frameCount'),
        font=avs.Var('fontName'),
        size=avs.Var('commonSize'),
        text_color=avs.Var('commonColor'),
        align=8,
        lsp=1)
예제 #2
0
파일: ssagen.py 프로젝트: dmzkrsk/harmony
    labelslist = [
        (labels.chords, W/2, (H-wH) / 2 - H / 80, 'Chords'),
        (labels.sections, W/2, (H-wH) * 9 /16, 'Sections'),
        (labels.progressions, W/2, (H-wH) * 11 / 16, 'Progressions'),
    ]

    # Аккорды и структура
    for l, x, y, styleName in labelslist:
        for start, end, label in l.iterTimed():
            print ssa.Dialogue(options.offset + start, options.offset + end, styleName, x, y, label.title, ssa.hexColor(label.color, withAlpha=False))
        print

    # Звездочки маркеры бита
    for start, end, beat, in sorted(beats.beats.iterTimed(), key=itemgetter(0)):
        x = W * (2 * beat.position + beat.positions + 3) // (beat.positions + 1) // 4
        print ssa.Dialogue(options.offset + start, options.offset + end, 'Beat', x, (H - wH) * 13 / 16, beat.title, ssa.hexColor(beat.color, withAlpha=False))
    print

    # Анимируем указатель
    xCoorTimeStamps = [x * wav.length / W for x in xrange(W + 1)]
    for xCoor, time in enumerate(izip(xCoorTimeStamps[:-1], xCoorTimeStamps[1:])):
        start, end = time
        line = "{\p1}m %(x)d %(height)d l %(x)d %(wHY)d %(xp)d %(wHY)d %(xp)d %(height)d{\p0} %(x)d %(height)d" % dict(x=xCoor, height=H, wHY=H - wH, xp=xCoor+1)
        print ssa.Dialogue(options.offset + start, options.offset + end, "Line", 0, 0, line, layer=20)

    # Глобальные надписи
    print ssa.Dialogue(0, wav.length, 'Common', W/2, H/80, '{\\q1}' + harmony.buildTitle(MetaTitle, upperCase=True).getTitle(), ssa.color(255, 255, 255))
    #noinspection PyTypeChecker
    print ssa.Dialogue(options.offset, options.offset + harmony.declaredLength, 'Info', W/2, (H-wH) * 15 /16, '%d bpm | %s' % (int(round(harmony.bpm)), harmony.transposition or harmony.key), ssa.color(255, 255, 255))