SketchUcation Plugin Store

 

 

Pre-release SP 3.2 (test of midi support)

Moderator: CPhillips

Pre-release SP 3.2 (test of midi support)

Postby CPhillips » Tue Nov 02, 2010 9:31 am

What little time I have had for SP lately I spent working on a model. It is inspired by this video:
http://www.youtube.com/watch?v=hyCIpKAIFyo

In order to make it work I had to add a few new features to SP (hey its good to be the author).

First I tried using the new sound embedding to make a set of instruments. I soon realized that to make it work it would take a huge amount of .wav samples (one for each note or drum) and that made the file way too big. So I started to look at Midi.

Turns out Win and Mac both support Midi instrument playback and there are huge number of built in instruments samples plus a nice collection of sound effects.

http://www.perfessorbill.com/lyrics/gsinst.htm

And because the midi notes are on/off and velocity based it suites itself well to SP physics ontouch/onuntouch events.

After I got it working (with a lot of help from Kevin) I did the attached drum set.

It works. But depending on your setup it probably sounds like the drummer is on speed or ludes and drunk in the bargain. The beat of the drums is totally dependent on the frame rate.

After some thought I decided to try a piano next. After some work I managed to fix most of the timing problems. Check out the piano example. I its really cool! And I think I know how to make the percussion instruments work now.

It would be easy to fake it and play a note then move a finger. But its done right and the note plays only when a finger touches a key. That involves calculating the delay in the servo and adjusting the score accordingly.

If this version and the demos work for everyone I will clean up the interfaces and a proper 3.2 release.

Chris

http://sketchyphysics.googlecode.com/fi ... 2-Nov1.exe


Here are the changes since the last version:

Changes in version 3.2
- Added midi note support.
- New user events system. Script commands "on" and "signal"
- Wacovs hud code. script commands draw,draw2d,draw3d and view accessor.
- joint.controllerValue now works with motors and gyros
- New script command setFrameRate overrides physics settings framerate.
- Added script command setSoundPosition(sound,position,volume=5.0) Allows 3d audio when called once per tick.

Bugs fixed:
- Fixed a Mac SDL sound crash (thanks Kevin!)
- Fixed sounds not stopping at end of simulation
- Fixed bug where solids would drop into floor first time you run.
- Bug fix. Scripted flag wasnt being observed at runtime.

Other:
Removed a lot of debug spam. Added a little.
Please, register (free) to access all the attachments on the forums.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: Pre-release SP 3.2 (test of midi support)

Postby hpnisse » Tue Nov 02, 2010 8:04 pm

Hello!
I installed the SP3.2, it works really good.
And the "Piano-JukeBox7" is awesome, its not slow in frame-rate.
I had seen the Animusic Movies before and think thats great done.

The piano works great, and I add a little stuff to it, when it press the key you the key "lights up" red.
Cause when I see at the cool simulation its a little bit hard to see which key thats playing.
It's done with a simple on/un-touch that you use, and works great. :D

Fun that you fixed the bug
Fixed bug where solids would drop into floor first time you run. .
It was a bit boring, but now it works great that to.
/hpnisse
/hpnisse
Windows 7 U - Sketchup 8 - SketchyPhysics 3.2-Dec2 - from Sweden
hpnisse
 
Posts: 101
Joined: Tue Feb 10, 2009 1:02 pm
Name: Tim

Re: Pre-release SP 3.2 (test of midi support)

Postby CPhillips » Tue Nov 02, 2010 11:46 pm

Good idea. I though of doing that but then forgot.
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: Pre-release SP 3.2 (test of midi support)

Postby jaysax » Fri Nov 26, 2010 10:11 pm

Chris (or anybody else that might have a clue!), what do you think of some sort of way to snapshot the current state of the simulation - objects, camera, etc - much like you can do with scenes, except aware of where SP thinks everything is at the moment?

I don't mind poking around in the code, but if you've got a suggestion that might move me along in the right direction while reducing code poking, I'd be grateful.

The goal is to be able to make smoother transitions between animation sections. Usually my objects need to undergo pretty complex movements that I have a hard time setting up in a single scene and one set of hinges/rules. So I break the movements into more reasonably code-able sections and then stitch them together later.

The awkward part, then, is remembering where we were at the very end of the previous segment.

Jay
jaysax
 
Posts: 94
Joined: Sat May 01, 2010 3:26 am
Name: Yishmeray

Re: Pre-release SP 3.2 (test of midi support)

Postby mptak » Sat Nov 27, 2010 8:00 pm

I'm not sure if this is the right place to ask but here goes. Is it possible to open text files from within a simulation. All those midi hashes in the piano would seem to be screaming for such an input and the animations I am trying (with limited) success in regular ol' ruby script are using a list of coordinates read from a data file. Any insights as to if/when this might be possible would be great.
mptak
 
Posts: 116
Joined: Tue Dec 25, 2007 10:57 pm
Location: Wisconsin in the US

Re: Pre-release SP 3.2 (test of midi support)

Postby CPhillips » Sun Nov 28, 2010 5:56 am

I am not exactly what you are asking for. Did you know that at any point in the simulation you can pause it then save the model. That will capture that frame in time. Is that what you need?

jaysax wrote:Chris (or anybody else that might have a clue!), what do you think of some sort of way to snapshot the current state of the simulation - objects, camera, etc - much like you can do with scenes, except aware of where SP thinks everything is at the moment?

I don't mind poking around in the code, but if you've got a suggestion that might move me along in the right direction while reducing code poking, I'd be grateful.

The goal is to be able to make smoother transitions between animation sections. Usually my objects need to undergo pretty complex movements that I have a hard time setting up in a single scene and one set of hinges/rules. So I break the movements into more reasonably code-able sections and then stitch them together later.

The awkward part, then, is remembering where we were at the very end of the previous segment.

Jay
CPhillips
 
Posts: 1085
Joined: Fri Nov 23, 2007 11:12 pm

Re: Pre-release SP 3.2 (test of midi support)

Postby jaysax » Wed Dec 01, 2010 3:36 am

CPhillips wrote:I am not exactly what you are asking for. Did you know that at any point in the simulation you can pause it then save the model. That will capture that frame in time. Is that what you need?



I am sorry, Chris, I did not see this answer. Not sure why!

Anyhow, yes, that is precisely what I need. I did not know I could do that. Perfect. Thanks so much.

Jay
jaysax
 
Posts: 94
Joined: Sat May 01, 2010 3:26 am
Name: Yishmeray

Re: Pre-release SP 3.2 (test of midi support)

Postby jaysax » Wed Dec 01, 2010 3:51 am

I've seen mention of a recent addition - that of being able to follow a path. Could someone point me to where to look for some examples, documentation, etc, for this?

Jay
jaysax
 
Posts: 94
Joined: Sat May 01, 2010 3:26 am
Name: Yishmeray

Re: Pre-release SP 3.2 (test of midi support)

Postby Mr.K. » Wed Dec 01, 2010 11:22 am

jaysax wrote:I've seen mention of a recent addition - that of being able to follow a path. Could someone point me to where to look for some examples, documentation, etc, for this?

Jay

I downloaded all the important models for SP 3.1 and added them to the 3D warehouse some time ago.
http://sketchup.google.com/3dwarehouse/cldetails?mid=74935b1dd67b7cd7192c214610ae5bb8

Curves Test and Curves Controllers are very good examples of path following.
Mr.K.
 
Posts: 143
Joined: Sat Sep 25, 2010 5:16 pm

Re: Pre-release SP 3.2 (test of midi support)

Postby jaysax » Wed Dec 01, 2010 3:42 pm

Mr.K. wrote:I downloaded all the important models for SP 3.1 and added them to the 3D warehouse some time ago.
http://sketchup.google.com/3dwarehouse/cldetails?mid=74935b1dd67b7cd7192c214610ae5bb8

Curves Test and Curves Controllers are very good examples of path following.


Fantastic! Thanks so much. I have downloaded several and started to play.

Question on CurvesTest3.skp - how did the curves come about initially, and how did they get names?

Meaning: I can see the scripted setting on, say, the block. It's doing a teleport to the beginning of a curve ( teleport(evalCurveAbs("blockpath",frame))) with name "blockpath" and then using that same curve name to move along it. So far so good. If I click on the curve in SU (I am using 8.0.3117 free) I see in the Entity Info that this is a curve on Layer0 with 35 segments and a length of 1282.3907, not hidden, and it does cast shadows. But I do not see anything identifying its name.

I know you can give groups and components names. But this is neither of those. So how did it get a name or, more significantly for me, I guess, how can I give any curve a name?

As for them coming about, I suppose that you could either use the freehand tool, or draw an arc or circle or polygon, but what else? What if I wanted to draw a very complex shape with, say, a combination of several arcs, line segments, etc? Is that something that could end up being combined into a single curve that I could then give a name, and that would then be followable by SP?

Jay
jaysax
 
Posts: 94
Joined: Sat May 01, 2010 3:26 am
Name: Yishmeray

Re: Pre-release SP 3.2 (test of midi support)

Postby Mr.K. » Wed Dec 01, 2010 9:46 pm

Ya SU is a little rusty on curves so the setup is a little different.

SU itself only creates curves with the circle and arc tools, and the add_curve function in Ruby, which is all very limiting.
So the best thing to do is getting the Weld plugin for SU, or any of the various spline plugins that let you make curves with alot more precision and ease.
When you have a curve, right-click it and go to SketchyPhysics -> Make physics curve, this will give you a prompt for a new name, write it and hit OK, and you got your curve set up.

Now a couple of extra tips:
- closed curves don't have a predefined start point (so every time you open your model the starting point will be different, sometimes it even switches between simulations)
- curve orientation sometimes changes (it may move in one direction once created, and then switch after opening the model again, I'm sure there is a reason for this, but I haven't yet found it)
Mr.K.
 
Posts: 143
Joined: Sat Sep 25, 2010 5:16 pm

Re: Pre-release SP 3.2 (test of midi support)

Postby jaysax » Wed Dec 01, 2010 9:52 pm

Mr. K, you are a prince! Thank you! That should be enough to get me going.

Jay
jaysax
 
Posts: 94
Joined: Sat May 01, 2010 3:26 am
Name: Yishmeray

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Artisan Organic Toolset - a set of powerful organic modeling tools.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012



 

Return to SketchyPhysics

Who is online

Users browsing this forum: No registered users and 2 guests