[Lumiera] Audio editing

Juan Pablo Bouza jpbouza at hotmail.com
Fri Jul 3 15:31:08 CEST 2009


Hey!!

Well, about the Script that connects Blender with Ardour through Jack, I found out that it didn´t support frame rates with fractions, such as 23.976.............But, I wrote to the author of the script and he was kind enough to make a patch to enable this kind of frame rate!!

Here is the link to the new script

http://akhilman.googlepages.com/animation_bpyjack.py


I didn´t mention that this script also needs a patched PyJack, which can be downloaded here:

http://blenderartists.org/forum/showthread.php?t=114454

Well, I hope this helps!!








#!BPY
"""
Name: 'BPyJack'
Blender: 249
Group: 'Animation'
Tooltip: 'makes jack and blender synced'
"""

# Depends from PyJack-0.1:
# ( http://sourceforge.net/projects/py-jack/ )
# patched with my patch:
# http://sourceforge.net/tracker/index.php?func=detail&aid=1871688&group_id=207557&atid=1002156

##
#   Author: IL'dar AKHmetgaleev aka AkhIL
#   e-mail: akhilman at gmail dot com
#   web:    http://akhilman.blogspot.com
#
#   This code is licensed under 
#   Creative Commons Attribution 3.0 Unported License
#   http://creativecommons.org/licenses/by/3.0/
##

# latest update at 2009-07-02 05:00

import time
from Blender import *
import jack

play_button = Draw.Create(False)
BEV_PLAY = 1
BEV_EXIT = 2
nontick = 0

jackframe = 0
blenframe = 0

def tick():
    global nontick 
    global jackframe
    global blenframe

    # getting current values
    cblenframe = Get("curframe")
    cjackframe = jack.get_current_transport_frame()
    fps = Scene.GetCurrent().getRenderingContext().fps
    fpsBase = Scene.GetCurrent().getRenderingContext().fpsBase
    rate = jack.get_sample_rate()
    factor = int(rate/(fps/fpsBase))
    

    # checking is blender curent time chenged
    # if yes  setting jack's time to same
    if cblenframe != blenframe: 
        jackframe = cblenframe*factor
        jack.transport_locate(jackframe)
        while jack.get_current_transport_frame() != jackframe:
            time.sleep(0.01) # waiting till jack applyed transport
        blenframe = cblenframe
    # checking jack's time and setting blender's if chenged
    elif cjackframe != jackframe:
        blenframe = cjackframe/factor
        Set("curframe",blenframe)
        Window.RedrawAll()
        jackframe = cjackframe

    # putting event for next tick
    id = Window.GetAreaID()
    Window.QAdd(id, Draw.TIMER3, 0, 1)
    nontick = 0

    # redraw gui if transport state is chenged
    if (jack.get_transport_state == jack.TransportStopped \
            and play_button.val) \
        or (jack.get_transport_state != jack.TransportStopped \
            and not play_button.val):
        Draw.Redraw()

def event (evt,val):
    global nontick
    nontick = 0
    if evt == Draw.TIMER3 or nontick > 1:
        tick() # doing tick
    nontick += 1

def button_event (evt):
    global play_button
    #print "button event: %s" % evt
    if evt == BEV_PLAY:
        if play_button.val == 1:
            jack.transport_start()
        else:
            jack.transport_stop()

    elif evt == BEV_EXIT:
        jack.detach()
        Draw.Exit()


def gui ():
    global play_button
    BGL.glClearColor(*map(lambda x: x/255.0, Window.Theme.Get()[0].get('buts').back))
    BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
    area_size = Window.GetAreaSize()
    Draw.BeginAlign()
    if jack.get_transport_state() == jack.TransportStopped:
        play_button.val = 0
    else:
        play_button.val = 1
    play_button = Draw.Toggle(">", BEV_PLAY, 1, 1, area_size[0]-20,area_size[1]-2, \
                                    play_button.val,"toggle play")
    Draw.PushButton("X", BEV_EXIT, area_size[0]-20, 1, 18, area_size[1]-2, \
                    "Exit from BPyJack")
    Draw.EndAlign()

Draw.Register(gui, event, button_event) 

try:
    jack.attach("/var/run/jack")
except jack.UsageError:
    pass # continue using exist jack if scirpt crashed but jack still online 

blenframe = Get("curframe")
jackframe = jack.get_current_transport_frame()
jack.transport_stop()
tick()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lumiera.org/pipermail/lumiera/attachments/20090703/f706e764/attachment.html>


More information about the Lumiera mailing list