[x3d-public] audio and timesensor synchronization

Joe D Williams joedwil at earthlink.net
Mon Sep 4 19:20:04 PDT 2023


- save the current camera (position, direction, up)
- save the navigation type
- open the file just like opening it using "File -> Open" would do
- sets the camera to saved position, direction, up
- sets the navigation type to saved type.

Hey, maybe that is the way it is supposed to work, but what happens when you want all that back to the real start at load? if the camera was animated by being child of an animated thing, it is dropped where it was when unbound at Open or Reopen. So, if reopen or open, why not put the camera where the author puts it at open, well first open in his case. 

> Reopening doesn't do anything special with regards to animations or time.

Well, it certainly doesn't start TimeSensor where the author defined them to start, that is scene time 0.
It remembers old TimeSensor fraction and reopens the animation from where it was when Reopen happened. So, nothing special, just won't let me restart from TimeSensor 0. 

So, for scene time, open and reopen both reset indicated World Time since load and remembers and sets TimeSensor fraction to when Open or Reopen stopped TimeSensor by the action. 
So, looks like the tool saves last TimeSensor fraction before Reopen then 
I don't know for certain, but TimeSensor starts where it left off, even after Open.
ReOpen, ok, I can see where you might want to save some state as author convenience, but tool doesn't allow me to actually restart the scene from initial load state.

How can I tell the tool that hey don't remember if this scene,  or similar, has ever been loaded before, Forget all that partial state from last time and start from author-defined initial state as written in the user code.

This pain really shows when authoring a scene with animations that want to be in sync with an audioclip. 
Can't work on the thing because a Open or Reopen only affects the audio startTime and the TimeSensor startTime carries on from where it left off last. 

 > I don't know exactly how you run your animation,

>From a TimeSensor fraction_changed into Interpolator(s).
>From what I showed, when the audio begins,I send audio StartTime to TmeSensor startTime and isActive to enabled. it begins to play audio and animation.
The animation cycle time is slightly less than the audio time time so I want the animation to complete and not repeat, then the audio to end and not repeat. 
All that basically works ok, unless the tool happens to recall where this or a similar file has been Opened by it. If not first Open, or if Reopen, the audio starts fine, but the TimeSensor is off in memorylands, having started from where it was last running. 

Try  and see, even some simple TimeSensor example like attached. After the first Open, I bet you can't get it to start from 0 again. 

> Time origin" of X3D spec. It may make some things weird,

Yes, SFTIme can be absolute or relative or an interval

Anyway,is it a bug, or how it is supposed to work? I say for the Open, it ought to be purely what the author gives as initial state. For Reopen, if the tool wants to retain some state, then ok, but for time,  I have a question if for Open#1 World Time since load is very close if not the same as Scene Time.
But  for open#2 or Reopen, World Time since load gets reset to 0 but Scene Time is most likely very different., in fact, the same as left off by Reopen.

Thanks for thinking about this. Simple example attached. Open it,let it run for a while, then Reopen or Open. It opens with a viewpoint child of the thing that is moving so the viewpoint movement shows as the model moves. 

When it starts to run, the Scene Time at Reopen will be Scene Time when you initiated the Reopen or Open. The camera assignment provided by the author for initial viewpoint is ignored and this viewpoint is left floating, suddenly parentless, apparently. Page Down recaptures the viewpoint so you can see the camera location change.  

Thanks,
Joe


f behin 


Original Message-----
From: Michalis Kamburelis <michalis.kambi at gmail.com>
Sent: Sep 4, 2023 2:56 PM
To: Joe D Williams <joedwil at earthlink.net>
Cc: <x3d-public at web3d.org>
Subject: Re: [x3d-public] audio and timesensor synchronization

I understand that by "Reopen" you refer to view3dscene "File ->
Reopen"? To be clear, all it does is

- save the current camera (position, direction, up)
- save the navigation type
- open the file just like opening it using "File -> Open" would do
- sets the camera to saved position, direction, up
- sets the navigation type to saved type.

Reopening doesn't do anything special with regards to animations or time.

If you believe it does have a bug, please submit a simple testcase to
show the problem -- a complete X3D file that I can load in view3dscene
and see the problem will be appreciated.

Note that VRML and X3D internally use absolute time (seconds since
January 1, 1970) in SFTime. See "8.2.2 Time origin" of X3D spec. It
may make some things weird, but following the spec -- for good or bad.
But I speculate, I don't know exactly how you run your animation, I
need more information than above.

A proper usage is certainly possible, such that each opening of the
file runs the animation correctly from start. If you ROUTE to
TimeSensor.startTime values e.g. from ProximitySensor.enterTime or
TouchSensor.touchTime, it will behave as expected.

Regards,
Michalis

pon., 4 wrz 2023 o 22:01 Joe D Williams napisał(a):
>
> Hi All,
> I have a scene with AudioClip and TimeSensor animations.When Open, if same file then, same as Reopen, the audio restarts, but the animation time sensor (after instantaneous reset to 0) restarts where it left off, rather than actually restarting. This leaves the sound and animations out of synch and so useless. Really appears like my timer is running with WorldTime when it is turned off then gets reset using relative to World Time when reopen or open.
>
> I thought I should have the answer to this by starting the animation timers under control of the audio startTime. Just don't start animation timers until audio starts then all should synch.
>
> So, I can understand some caretaking like this when the author is reloading to fix some stuff and just wants to proceed rather than start an animation over from the beginning, but it seems to me that the author also ought to have the keys to get a complete restart from the beginning.
>
> So, in this case, I really do want to be able to keep this audio in sync with the animation. When I do tell the animation timer to start with the audio, I want to be able to depend on that rather than the tool taking over and deciding what to do with regard to the TimeSensor timing depending upon the last time I did Open or Reopen with the same or similar file. In this case the Audio startTime sent to the animation timer is not being honored.
>
> This is how it is coded:
>
> enabled='false' loop='true'/>
>
>
> loop='true' enabled='true'
> url='"wrv2_103seconds.wav"'/>
>
>
>
>
>
> toField='set_startTime' toNode='GBTimer'/>
> toField='set_enabled' toNode='GrampsBoxTimer'/>
>
> Is the basics. When the audio starts, then the animation timer starts. But I also want to stop the animation at the last frame when it ends, instead of repeating the animation. There must be a better way, but I am using:
>
> key='0 0.9 1' keyValue='true false false'/>
> toField='set_fraction' toNode='GBTimerLoopControl'/>
> toField='loop' toNode='GBTimer'/>
>
> Which turns off the animation timer after one cycle.
>
> Sending the loop false twice seems necessary since if sent only at fraction time 1 it lets animation timer move to start and actually send 0 fraction instead of ending at last frame. I think the loop true/false should be evaluated before start is set, not set start then check loop, Loop false at tic fraction 1 should not allow the timer to proceed to 0. If loop is false at load,then start is not sent.
>
> And I also want the AudioClip to stop after one play with no repeat so I did this:
>
>
>
> Since the animation timer ends its cycle a few seconds before the audioclip, (100 seconds vs 103 seconds) this should also keep the audioclip from looping. Unfortunately,it does not and the audio continues until it is stopped by unknown, Seems like loop false recognized some time later than needed to stop the audio at its end. as the audio plays. By changing the animation timer cycletime I see the loop false is recognized at some time which seems related to when I send the audio loop false and that I might be able to with luck pick a lucky time that matches the stop time I need.
>
> So, please help me figure out how to control this thing the way I need to.
>
> Thanks All,
> Joe
>
>
>
>
>
>
>
>
>
>
>
> .
>
>
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Timer example.zip
Type: application/x-zip-compressed
Size: 1866 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230905/b97bd3a0/attachment.bin>


More information about the x3d-public mailing list