Pergunta

I already asked this question on stackoverflow -- I am posting it here as well, because I think many of you will have encountered an analogous problem. I would appreciate even a link as a reference, or the name of a relevant topic (even if you don't explain the solution).

So, my reason for this question: I want a metronome that sporadically changes tempo -- I use the metronome during my boxing drills (if you are curious, mostly for jump rope or any footwork). I can script a metronome rather easily by requesting an audio file over a loop -- Also, I can think of ways (perhaps not all elegant) to to change tempo after certain increments of my defined time unit have passed. But if I wanted that, I certainly wouldn't have come to this forum.

A metronome that randomly changes tempos would be invaluable for my purposes (I won't elaborate on them, as they aren't relevant to the forum). I can't think of a way to accomplish this on my own -- Regrettably, I never took an pure algorithms course, since I thought I wouldn't need it for physics. I'm sure there is an obvious one I could recall if I had, and can't figure out a general form on my own.

It doesn't matter what language the script is in -- in fact, a basic form would be better for me to work with.

I hope someone can point me in the right direction, and I would be extremely grateful, thanks

Foi útil?

Solução

All you really have to do is to figure out

  • how to generate random numbers within a given range
  • how to write a bounded loop of the form "Do action X, Y times"

How this works totally depends on your programming language/environment. But once you can do these two things, the algorithm is simply

  1. generate suitable values of X and Y
  2. play X clicks at frequency Y
  3. repeat
Licenciado em: CC-BY-SA com atribuição
scroll top