## Simulate a pendulum

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Simon
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

### Re: Simulate a pendulum

Phew!

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

rumplestiltskin
Posts: 219
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

### Re: Simulate a pendulum

Simon wrote:OK, so I'm very late to this but with good cause... really... (I'm slow):
...{snip}...
Barry, there is no "big" math in this and I did it mostly to get you away from using a repeat loop which should not be used when a send can do the trick.
...{snip}...:
Simon,

Yep; I understand finally about the "don't use the repeat loop":

Code: Select all

``  if tSwing = true then send pendulus to me in 10 milliseconds``
Does the same as the repeat loop and the mouseUp handler sets tSwing to true/false as the button is clicked.
Would I be inaccurate to call this recursion?

I'm trying to approach my project from a user interface issue first. The questions I'm asking myself are: What would provide the appropriate feedback for a musician? Just sound? Sound and lights? Sound and motion? If motion, what sort of motion. How does one provide visual feedback for 3/4 time? 4/4 time? 5/4 time? (9/8 time if you're playing Blue Rondo a la Turk. Any Brubeck fans out there?)

Thanks, Simon, and to everyone. I just asked a question and you all responded with a chapter in a LiveCode Tutorial manual. Pretty cool.

Simon
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

### Re: Simulate a pendulum

Would I be inaccurate to call this recursion?
Yes.

As for what would be appropriate:
I don't think the swing of a pendulum on a metronome adds anything for the user. The pendulum was cool when I was a kid learning piano (or when the cat decided it was to be attacked) but only the sound was useful.

I would go for sound and/or light option. You can add more by adding emphasis on the first beat. Gosh, and since it's a program you can even add different sounds for fractional beats. What Fun!

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

sturgis
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

### Re: Simulate a pendulum

Yep, this. Sound and light, a way to live adjust the interval. Simple and effective.
Simon wrote:
Would I be inaccurate to call this recursion?
As for what would be appropriate:
I don't think the swing of a pendulum on a metronome adds anything for the user. The pendulum was cool when I was a kid learning piano (or when the cat decided it was to be attacked) but only the sound was useful.

I would go for sound and/or light option. You can add more by adding emphasis on the first beat. Gosh, and since it's a program you can even add different sounds for fractional beats. What Fun!

Simon

rumplestiltskin
Posts: 219
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

### First shot - version .01

Okay! I hope I've put everyone's names in the "thank you". If I have not, forgive me; I'll fix it in version .02

Here's "Brubeck's Metronome". Completely open and unprotected as required by the Community Edition license. I'm not doing a standalone yet as there is undoubtedly more "stuff" that needs to be done. But this is, IMHO, a good start. I can see a bunch of redundant code as I have each time signature calling a different handler. However, it is quite simple to debug in its present state and that's more important for anyone grabbing this stack who has not been part of this thread.

Thanks,
Barry
Attachments
Brubeck's Metronome(v.01).livecode.zip

Simon
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

### Re: Simulate a pendulum

Well for me the image sphere.png ended up on top of the buttons, that didn't work for me
I liked the use of setting the loc rather than using a move. I think out of the corner of the eye the abruptness of the motion gives better information.

Great!

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

rumplestiltskin
Posts: 219
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

### Re: Simulate a pendulum

D-oh! I imported a large graphic, re-sized it, but didn't realize that it would then be re-sized -back- to the original size when the stack was re-opened. Okay; I re-sized it in Preview, then imported that png into the stack. Here's version .02.

Barry

EDIT: Probably could have just locked the size and position, right?
Attachments
Brubeck's Metronome(v.02).livecode.zip

RogGuay
VIP Livecode Opensource Backer
Posts: 61
Joined: Fri Apr 28, 2006 12:10 am

### Re: Simulate a pendulum

Very nice! Thanks for sharing it.

Roger

RogGuay
VIP Livecode Opensource Backer
Posts: 61
Joined: Fri Apr 28, 2006 12:10 am

### Re: Simulate a pendulum

Here is an updated link to my SimplePendulum:

https://www.dropbox.com/s/x6s5qs88t1ocn ... S.rev?dl=0

Hopefully, you can find something useful in it.

Cheers,

Roger

Lagi Pittas
VIP Livecode Opensource Backer
Posts: 327
Joined: Mon Jun 10, 2013 1:32 pm

Hi