Giter Site home page Giter Site logo

Comments (1)

maptz avatar maptz commented on September 22, 2024

Ignore this! Finger trouble:

Correct function below:

def create_retime(f : aaf2.file.AAFFile, audio_clip):

    # See here: https://github.com/markreidvfx/pyavb/blob/main/examples/avb2aaf.py#L21
    op_def = f.create.OperationDef('01030202-0200-0000-060e-2b3404010101', 'Audio Warp', '')
    f.dictionary.register_def(op_def)

    op_def.media_kind = 'sound'
    op_def['NumberInputs'].value = 1
    op_def['IsTimeWarp'].value = False
    op_def['Bypass'].value = 0
    op_def['OperationCategory'].value = "OperationCategory_Effect"
    
    param = f.create.ParameterDef("f7ffed29-fc8e-43ed-943a-4b57b5c157ee", "AvidMotionPulldown", "", 'aafInt32')
    f.dictionary.register_def(param)
    op_def.parameters.append(param)

    param = f.create.ParameterDef("8dde1839-6862-4874-a1e9-4fbd1164f22a", "AvidMotionOutputFormat", "", 'aafInt32')
    f.dictionary.register_def(param)
    op_def.parameters.append(param)

    param = f.create.ParameterDef("5b22ff71-c51b-11d3-a069-006094eb75cb", "AvidPhase", "", 'aafInt32')
    f.dictionary.register_def(param)
    op_def.parameters.append(param)

    param = f.create.ParameterDef("72559a80-24d7-11d3-8a50-0050040ef7d2", "SpeedRatio", "", 'Rational')
    f.dictionary.register_def(param)
    op_def.parameters.append(param)

    param = f.create.ParameterDef("1c5a02d5-e503-4ca6-8617-d7914bb8ac03", "AvidMotionInputFormat", "", 'aafInt32')
    f.dictionary.register_def(param)
    op_def.parameters.append(param)

    op_group = f.create.OperationGroup("Audio Warp", media_kind="sound")

    sequence = f.create.Sequence(media_kind="sound")
    sequence.components.append(audio_clip)
    # op_group.segments.append(sequence)

    op_group['InputSegments'].append(sequence)

    param = f.create.ConstantValue('AvidMotionPulldown', 0)
    op_group.parameters.append(param)
    param = f.create.ConstantValue('AvidMotionOutputFormat', 2)
    op_group.parameters.append(param)
    param = f.create.ConstantValue('AvidPhase', 0)
    op_group.parameters.append(param)
    param = f.create.ConstantValue('SpeedRatio', aaf2.misc.AAFRational(1001/960))
    op_group.parameters.append(param)
    param = f.create.ConstantValue('AvidMotionInputFormat', 2)
    op_group.parameters.append(param)

    
    
    op_group.length = audio_clip.length
    return op_group

from pyaaf2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.