Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Dan's Audio Beat Counter

Community Expert ,
Mar 26, 2011 Mar 26, 2011

I've been trying to figure out how to modify Dan Ebbert's AudioBeat Counter so that it starts counting beats based on the layer's in point rather than on the start time of the comp. IOW, I'm trying to create a series of text layers that count 1, 2, 3, 4 based on the audio but each of these layers start at a different time (every 8 bars or so). You get a few bars, then text that goes 1,2,3,4, then a few more bars, then 1,2,3,4 from another layer and so on.

I can't seem to figure out how to start counting beats at the inPoint of the layer. When I offset the layer time based on the inPoint it just shifts the the starting point of the count so that it's out of sync with the audio by time to the inPoint. I want to ignore the beats before the inPoint and only count the beats after the inPoint without having to split the Audio Amplitude layer for each text layer.

Thanks.

TOPICS
Expressions
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 26, 2011 Mar 26, 2011

Try this:

threshold = 10.0;
audioLev = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
above = false;
frame = timeToFrames();
n = 0;
while (frame >= timeToFrames(inPoint)){
  t = frame * thisComp.frameDuration;
  if (above){
    if (audioLev.valueAtTime(t) < threshold){
      above = false;
    }

  }else if (audioLev.valueAtTime(t) >= threshold){
    above = true;
    n++;
  }
  frame--
}

n

Dan

Translate
Community Expert ,
Mar 26, 2011 Mar 26, 2011

Rick,

I think this should do it:

threshold = 10.0;
audioLayer = thisComp.layer("Audio Amplitude")

audioLev = audioLayer.effect("Both Channels")("Slider");

above = false;
frame = Math.round(time / thisComp.frameDuration);
n = 0;
while (frame >= timeToFrames(audioLayer.inPoint)){
  t = frame * thisComp.frameDuration;
  if (above){
    if (audioLev.valueAtTime(t) < threshold){
      above = false;
    }

  }else if (audioLev.valueAtTime(t) >= threshold){
    above = true;
    n++;
  }
  frame--
}

n

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2011 Mar 26, 2011

Thanks Dan.

That solution doesn't reset the counter unless I change the inPoint of the audioLayer. I'm using the expression to drive the Source Text of a Text layer. That's the layer I want to duplicate, adjust the inPoint and slide down the timeline. The project needs this countdown to happen about 100 times. I'd love to drive all 100 instances with a single copy of the audioLayer. I just can't figure out how to use the inPoint of the Text layer to set the starting count of the threshold crossings.

Hope this makes sense. Would you like to see the project?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2011 Mar 26, 2011

Yeah, sure -- I'd like to see the project.

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2011 Mar 26, 2011

Try this:

threshold = 10.0;
audioLev = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider");
above = false;
frame = timeToFrames();
n = 0;
while (frame >= timeToFrames(inPoint)){
  t = frame * thisComp.frameDuration;
  if (above){
    if (audioLev.valueAtTime(t) < threshold){
      above = false;
    }

  }else if (audioLev.valueAtTime(t) >= threshold){
    above = true;
    n++;
  }
  frame--
}

n

Dan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2011 Mar 26, 2011
LATEST

That was it. I couldn't see the forrest for the trees.

Thanks Dan. Here's a small bit of the project concept WO audio. When I get it done I'll post the video.

You're the man.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines