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
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Simulate a pendulum

Post by Simon » Wed May 01, 2013 10:54 pm

Phew!
My head was about to explode!

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

Post by rumplestiltskin » Thu May 02, 2013 12:50 am

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
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: Simulate a pendulum

Post by Simon » Thu May 02, 2013 1:14 am

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. :D 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
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: Simulate a pendulum

Post by sturgis » Thu May 02, 2013 1:27 am

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. :D What Fun!


Simon

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

First shot - version .01

Post by rumplestiltskin » Fri May 03, 2013 10:42 pm

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 :D

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.

Comments and suggestions gratefully accepted.

Thanks,
Barry
Attachments
Brubeck's Metronome(v.01).livecode.zip
(93.94 KiB) Downloaded 96 times

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

Re: Simulate a pendulum

Post by Simon » Fri May 03, 2013 11:00 pm

Well for me the image sphere.png ended up on top of the buttons, that didn't work for me :D
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

Post by rumplestiltskin » Fri May 03, 2013 11:30 pm

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
(51.99 KiB) Downloaded 107 times

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

Re: Simulate a pendulum

Post by RogGuay » Sat May 04, 2013 6:22 am

Very nice! Thanks for sharing it.

Roger

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

Re: Simulate a pendulum

Post by RogGuay » Sat Jan 23, 2016 5:33 am

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
VIP Livecode Opensource Backer
Posts: 323
Joined: Mon Jun 10, 2013 1:32 pm

Re: Simulate a pendulum

Post by Lagi Pittas » Sat Jan 23, 2016 5:46 pm

Hi

I just get a 404 not found error

Regards Lagi

... And now it works -- I tried 5 times

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”