0
$\begingroup$

Note: this question references the same blend file here: Sound-Driven Animation, Using Animation (and Sverchok) Nodes, is Not Working

I have the following setup in animation nodes:

enter image description here

I am trying to get the min/max values from this sound file. I'm guessing this could be done by outputting all the values from the sound file to a list, but frankly I have no idea how to "store" these values to a list.

I am obviously using animation nodes, but transferring this data to sverchok. Would it be possible to do this in animation nodes or sverchok? Possible in both?

Blend file:

https://drive.google.com/file/d/1gMvKhExbVH5hSzoPK9GdetTph4r_YySM/view

$\endgroup$
1
  • $\begingroup$ I would recommend using something like audacity instead $\endgroup$
    – TheLabCat
    Commented Sep 18, 2021 at 19:56

2 Answers 2

1
$\begingroup$

Method 1: Using loop without storing values.

This setup gives min and max of values between frame 1 and 250: enter image description here

Method 2: Storing values as text.

This script creates a text block containing values in frame range.

import bpy

# settings
frame_start = 1
frame_end = 250
node_tree_name = "NodeTree"
data_interface_name = "Data Interface"
text_block_name = "my_data"
separator = "\n"

# create/get text block
text_block = bpy.data.texts.get(text_block_name)
if text_block is None:
    text_block = bpy.data.texts.new(name = text_block_name)
    
# clear existing
text_block.clear()  

for i in range(frame_start, frame_end + 1):
    # set frame
    bpy.context.scene.frame_set(i)
    
    # get value from animation nodes
    value = bpy.data.node_groups[node_tree_name].nodes[data_interface_name].getValue()
    
    # convert value to string
    string = str(value)
    if i != frame_end: string += separator
        
    # write value to text block
    text_block.write(string)

Before running this script use Data interface node to export value. enter image description here

The script will generate a text block something like this: enter image description here

We can convert text data into float by this expression enter image description here

Final node tree enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks Hari, both of these methods worked! I went with the 2nd method, as the list of values is most helpful for my use. I appreciate the response! $\endgroup$
    – MarcusR
    Commented Sep 19, 2021 at 22:34
1
$\begingroup$

i hope i did understand your right, and here is how you can store values in a list which you can "load/get" at any frame.

In my example i generate a random float list for every frame, get the max value and store this in a list.

enter image description here

result:

frame 1:

enter image description here

frame 2: (and so on)

enter image description here enter image description here enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks Chris, this worked! I should've explained myself better, but didn't even realize when asking the question, that a list of all the values is actually the most helpful for my case. $\endgroup$
    – MarcusR
    Commented Sep 19, 2021 at 22:33
  • $\begingroup$ Glad I could help! $\endgroup$
    – Chris
    Commented Sep 20, 2021 at 4:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .