[Bf-python] can't get audio volume changes via script
flavio soares
qazav3.0 at gmail.com
Mon Oct 21 12:45:02 CEST 2013
Hi, Bastien,
Thanks for the response. I had tried that before sending the e-mail - I
tried SoundSequence to see if it changed things, but it didn't. The code
below...
for i in bpy.context.sequences:
bpy.context.scene.frame_current = i.frame_start
start = i.frame_start
while start < i.frame_final_end:
print(i.volume)
bpy.context.scene.frame_current += 1
start +=1
...will print also the same values 0.0 or 1.0 (only), depending on where
the cursor (frame_current) is when the script starts to run.
Notice that the same behaviour happens to panning and blend_alpha (for
video strips) - it seems Blender sort of "caches" the volume or pan value
and always returns the first one, not updating it inside the loop.
I tried the same code using:
while start < i.frame_final_end:
bpy.ops.marker.add()
And the markers were inserted accordingly, one on each frame. This way I
know that the change bpy.context.scene.frame_current += 1 is being
processed correctly.
Any guesses?
2013/10/20 Bastien Montagne <montagne29 at wanadoo.fr>
> You do not want to use bpy.types.SoundSequence here! It’s a type (and
> used this way, a constructor), not a data access!
>
> You are probably looking for something like that:
>
> for seq in bpy.context.sequence_editor.sequences:
> if seq.type is 'SOUND':
> print(seq.volume)
>
> (Loop over that for all your frames of course).
>
> Bastien
>
>
> On 20/10/2013 03:08, flavio soares wrote:
>
> Hi,
>
> The audio exporter to Ardour is pretty much done<https://github.com/szaszak/blender_velvet/blob/blue_velvet/blue_velvet.py>and fully functional.
>
> I'm trying to expand it to get the audio fade keyframes, but it seems it
> is not possible.
>
> This code for example:
>
> for i in bpy.context.sequences:
> bpy.context.scene.frame_current = i.frame_start
> start = i.frame_start
> while start < i.frame_final_end:
> print(bpy.types.SoundSequence(i).volume)
> bpy.context.scene.frame_current += 1
> start +=1
>
> Prints only:
>
> 0.0
> 0.0
> 0.0
> etc
>
> ...when it should recognize the changes in volume (keyframes) and print
> something like:
>
> 0.0
> 0.3
> 0.6
> 1.0
> 1.0
> etc
>
>
> Any guesses why this is so?
>
> Thanks for the help. =)
>
>
> _______________________________________________
> Bf-python mailing listBf-python at blender.orghttp://lists.blender.org/mailman/listinfo/bf-python
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20131021/70980784/attachment.html>
More information about the Bf-python
mailing list