Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sound keys linked to scale.

  • sound keys linked to scale.

    Posted by Richie Tovell on January 13, 2010 at 2:57 am

    Hi, I have a problem with linking trapcode soundkeys to scale.

    I have a layer that is keyframed to scale from 100 to 500 on just the x & z parameters, now adding trapcode sound keys to the layers scale, I would edit the expression adding (value + ) to it’s begening, as in the following example.

    value + temp = thisComp.layer(“Dark Gray Solid 1”).effect(“Sound Keys”)(“Output 3”);
    [temp, 100, temp]

    with the minimum output range in sound keys set to 100 and max to 500. adding this amount to the layers keyfamed scale (500) the two values should combine but they don’t 🙁 the x & z scale of the layer should scale between 100 (min) and 1000 (max) which is the combined value of the keyframed scale increase and the output value from trapcode. what happens instead is the keyframed value is disabled and my layer’s scale is only effected by the output from sound keys.

    What’s wrong with this expression? adding the same (value +) to the beginning of similar sound key’s expressions normally works fine for example when controlling rotation, but not it seems for scale.

    Can anyone tell me what I’m dong wrong?

    Coda – [i]musical selections; in film, the ending or last section of a film (often wordless).[/i]

    Richie Tovell replied 16 years, 4 months ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    January 13, 2010 at 3:42 am

    This might be what you’re trying to do:

    temp = thisComp.layer(“Dark Gray Solid 1”).effect(“Sound Keys”)(“Output 3”);
    [value[0]+temp, 100,value[2]+temp]

    Dan

  • Richie Tovell

    January 13, 2010 at 4:04 am

    Ahh, yes that’s the chap, so you don’t need to add value + at the begening then? that’s replaced by [value[0],[1] or [2] + temp]?

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

  • Dan Ebberts

    January 13, 2010 at 4:17 am

    In the case of scale for a 3D layer, value is a 3-element array consisiting of the x,y, and z values. temp is a scalar value (single value). If you try to add the two togeher, you just end up adding temp to the x value. Another way to do it would be like this:

    temp = thisComp.layer(“Dark Gray Solid 1”).effect(“Sound Keys”)(“Output 3”);
    value + [temp,0,temp]

    You end up adding temp to the x and z values. You just need to get used to array math.

    Dan

  • Richie Tovell

    January 13, 2010 at 4:36 am

    Ah, that’s cool, I understand a little more now, one problem I’m having is this scaling is effecting the paranted layers also, that’s helpful for some layers but not for others which I need to apply different amounts of scaling to using soundkeys, I tried using the previous expression which normally works fine, but now seems not to

    this was the expression

    L = thisLayer;
    s = transform.scale.value;
    while (L.hasParent){
    L = L.parent;
    for (i = 0; i < s.length; i++) s[i] *= 100/L.transform.scale.value[i] } s For some reason it seems to be allowing scaling to still occur, when placed next to the above, don't know why. EDD: Ah, it has something to do with the fact that the layer has scale keyframes already aplied, I think I need to add the Value + in to this expression somehow to allow the keyframed scaling to still effect the layer. Coda - musical selections; in film, the ending or last section of a film (often wordless).

  • Richie Tovell

    January 13, 2010 at 4:43 am

    value +
    L = thisLayer;
    s = transform.scale.value;
    while (L.hasParent){
    L = L.parent;
    for (i = 0; i < s.length; i++) s[i] *= 100/L.transform.scale.value[i] } s doesn't work, nor does this: L = thisLayer; s = transform.scale.value; while (L.hasParent){ L = L.parent; for (i = 0; i < s.length; i++) s[i] *= 100/L.transform.scale.value + [i] } s Any ideas? Coda - musical selections; in film, the ending or last section of a film (often wordless).

  • Dan Ebberts

    January 13, 2010 at 8:28 pm

    I’m still not sure what you’re trying to do, but the first expression doesn’t work because you’re trying to add an array (value) to a Layer. The second one doesn’t work becuase you’re trying to divide a number (100) by an array (value) and then add another array ([i]) to the result.

    In general, for multi-dimensional properties like position and scale, you can’t just stick “value” or “value +” in an expression somewhere unless the array math makes sense.

    Dan

  • Richie Tovell

    January 13, 2010 at 9:05 pm

    Ah, sorry, yes your expression does work fine, I was having problems but it seems this was caused by something else on the layer.

    Sorry about that, thanks for the pointer though.

    Coda – musical selections; in film, the ending or last section of a film (often wordless).

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy