Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › Using the Numbers effect to translate Heart Rate data into a readout??

  • Using the Numbers effect to translate Heart Rate data into a readout??

    Posted by Saxon Rix on January 27, 2015 at 12:01 am

    Hi guys I was recommended to come over to the expressions side of the AE forums as the problem I have may be able to be fixed by an expression.

    I am doing a project where I’m making use of a heart rate monitor. I am able to extract the heart rate data (which is recorded once every second such as: 99, 101, 100, 100, 100, 101, 102, 102, 107, 113 etc). The data was recorded for around 31 minutes, which gave me 1910 of those numbers.

    I am wanting to use this data to make a number readout in After Effects, but I’m not sure how to add or use the data I have in order to make it accurately follow the data.

    So it has to read from the list of 1910 numbers, and display each number for 1 second each.

    Any ideas if this is possible guys?

    Thanks!

    Saxon Rix replied 11 years, 8 months ago 2 Members · 11 Replies
  • 11 Replies
  • Dan Ebberts

    January 27, 2015 at 12:29 am

    What does the data look like?

  • Saxon Rix

    January 27, 2015 at 12:34 am

    It is literally just a list of numbers with commas separating them like such:

    171,171,171,171,170,170,170,170,170,170,170,170,170,170,170,170,170,171,171,171,171,171,171,171,171,170,170,170,170,159,159,159,159,159,159,159,159,148,148,148,148,148,148,148,0,0,175,174,173,173,173,173,173,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,175,175,175,175,175,176,176,176,176,176,176,177,177,177,177,177,177,177,177,177,178,178,177,177,177,177,176,176,175,174,172,171,170,170,170,170,170,171,171,171,172,172,172,172,172,172,172,172,173,173,173,173,173, etc.

  • Dan Ebberts

    January 27, 2015 at 12:50 am

    If you can edit your text file so that the line starts like this:

    myArray = [171,171,171,171,170,170,

    and ends like this:

    172,173,173,173,173,173];

    Then an expression like this should work:

    myPath = “c:/test/test.txt”;
    $.evalFile(myPath);
    idx = Math.min(Math.max(Math.floor(time – inPoint),0),myArray.length-1);
    myArray[idx]

    You’ll need to edit myPath to point to your text file.

    Dan

  • Saxon Rix

    January 27, 2015 at 12:59 am

    Thanks Dan I am just about to try this out. Do I apply this expression to the numbers effect ‘value’ setting?

  • Dan Ebberts

    January 27, 2015 at 1:05 am

    That should work. I tested it by applying it to the Source Text property of a text layer.

    Dan

  • Saxon Rix

    January 27, 2015 at 1:13 am

    It worked! Thank you so much :). Sooo glad I don’t have to do it all manually lol.

    Thanks again Dan, you’re awesome!

  • Saxon Rix

    January 27, 2015 at 1:20 am

    Sorry to bother you with another question Dan, but is there a way to make the numbers change color once they get to a certain number threshold?

    Like this
    90 – 120 = green
    121 – 150 = orange
    151 – 180 = red

  • Dan Ebberts

    January 27, 2015 at 1:29 am

    With the numbers effect? Something like this for Fill Color should work:

    val = effect(“Numbers”)(“Value/Offset/Random Max”);
    if (val < 121)
    [0,1,0,1]
    else if (val < 151)
    [1,.5,0,1]
    else
    [1,0,0,1]

    Dan

  • Saxon Rix

    January 27, 2015 at 1:36 am

    That does work great! Is there a way to link it to ‘hue/saturation’ effect so that the color gradually changes from green to yellow to orange to red as the number gets higher, and then more towards green as it gets lower?

    (PS: sorry for my stupidity, these expressions baffle me!)

  • Dan Ebberts

    January 27, 2015 at 2:18 am

    The hue effect doesn’t take expressions, but you should be able to simulate it if you set the Fill color to red and replace the previous expression with this one:

    val = effect(“Numbers”)(“Value/Offset/Random Max”);
    hsl1 = rgbToHsl([0,1,0,1]);
    hsl2 = rgbToHsl([1,.5,0,1]);
    hsl3 = rgbToHsl([1,0,0,1]);
    if (val < 121)
    h = linear (val,90,121,hsl1[0],hsl2[0])
    else if (val < 151)
    h = linear(val,121,151,hsl2[0],hsl3[0])
    else
    h = hsl3[0];
    hslToRgb([h,hsl1[1],hsl1[2],1])

    Dan

Page 1 of 2

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