Previous Thread  Next Thread

chat icon How to add a sound strip to a speaker from command line

barcodepandora

Posted: Tue Sep 04, 2012 4:40 am
Joined: 01 Sep 2012
Posts: 6
Hello, I'm new in Blender. I'm creating animations with speakers. I wish to make a speakers plays its sound many times during an animation. I can do it from the Blender window. Now I want to do from a Python script from command line, but I could not.

I can do it with NLA editor; however, from command line I don't have access to a context with an area that let me do area.type = 'NLA_EDITOR'.

I can also from command line with NlaTrack[].strips.new() but I can't add a strip with sound.

¿How can I do more? ¿Can I obtain a context with area from command line? ¿Can I add a strip with sound from any context? Thank U very much Smile
Reply with quote


batFINGER

Posted: Wed Sep 19, 2012 3:50 pm
Joined: 23 Jan 2008
Posts: 33
Hi

here is a sound clip added from the console. using the op and overriding the context, to make the NLA_EDITOR area context.area.

It adds a new track and clip for each active track.

Code:

>>> C.object
bpy.data.objects['Speaker']

>>> C.screen.areas[5].type
'NLA_EDITOR'

>>> context = C.copy()
>>> context["area"] = C.screen.areas[5]
>>> bpy.ops.nla.soundclip_add(context)
{'FINISHED'}


Hopefully strips.new(name="xx", start=2, action=someaction) will have a parameter to set its type, which would make this a whole lot easier.
Reply with quote


batFINGER

Posted: Wed Sep 19, 2012 5:11 pm
Joined: 23 Jan 2008
Posts: 33
PPS on a closer look at your post I see you mention using command line. Don't think context override will work either.

BTW I've made some tools to make animating with speakers and sound a bit easier

http://blenderartists.org/forum/showthread.php?236729-Speaker-Tools-(Audio-Visualiser-Driver-Lipsync-)

My concept has always been to incorporate the NLA into this to have sound and action.

PS can you edit a post in this forum?
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group