Niko
Niko

Reputation: 361

How to collect time values from an AudioContext element?

I am working on a small js/midi app and I need to define the timeline of my app.

Using AudioContext.CurrentTime , I'm able to calculate the deltas between noteOn and noteOff signals.

The number I get is the seconds value with 17 numbers after the point like 0.11029478458050335.

I have a ticks variable that I want to increment every time 31.25 milliseconds pass.

Can I extract the number of times 31.25 milliseconds is % 0 in a value such as this?

Upvotes: 0

Views: 74

Answers (1)

cwilso
cwilso

Reputation: 13918

If I understand your question, yes - if you want to know how many ticks between two variables, just divide the difference by 0.03125 (31.25 ms in seconds).

Upvotes: 2

Related Questions