BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Animated Objects: Following The Track- Now with SOUND!

+5
Quork
Phonteus Nevolius
Dexter
phontanka
leezer3
9 posters

Page 2 of 2 Previous  1, 2

Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Animated Objects: Following The Track- Now with SOUND!

Post by jckhinks Fri Dec 01, 2017 4:19 pm

hi. the trackfollowfunction is not recognised on my computer. windows 7 and openbve version 1.5.2.3 any ideas please.jack
jckhinks
jckhinks

Posts : 172
Join date : 2012-08-22
Age : 74
Location : maltby

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Sat Dec 02, 2017 12:57 pm

OK, this should now be operational in today's build Smile

Needed to do some deeper work to get things working properly, but there we go.

The previously posted syntax is not valid, as I've implemented a [Sound] section for animated files. (Should have done this previously....)
This should be as follows:
Code:
[Sound]
filename = steamer.wav
volume = 1.0
pitch = 1.0
position = 0,1,0

Supported attributes for this section:

  • FileName: Sets the filename for the sound file.
  • Volume: Sets the initial volume. (Note that this is at the sound source, not the listener position)
  • Pitch: Sets the initial pitch.
  • Position: A 3D vector describing the initial position of the sound relative to the animated object's track position.
  • TrackFollowerFunction: Function moving the sound along Rail0's path.
  • VolumeFunction: Function altering the volume (Overrides Volume)
  • PitchFunction: Function altering the pitch (Overrides pitch)


jckhinks wrote:hi. the trackfollowfunction is not recognised on my computer. windows 7 and openbve version 1.5.2.3 any ideas please.jack

Are you sure you're using trackfolllowerfunction , not trackfollowfunction?
This is also only implemented in the main sim, not Object Viewer or Route Viewer.

Phonteus Nevolius wrote:It's not that important, at the moment I'm happy with a simple looped sound.

Quork: yeah, now that you mention it! Smile But actually it's a mouse from the Hungarian animated film, Cat City, its name is Grabowski.

Adblock is a wonderful thing, never even seen it Razz

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by Greater Anglia Metro Sun Dec 03, 2017 10:09 pm

Sorry if this has already been answered, I've not been about...
Is it yet possible or planned to have a sound linked to an animation such as an air operated signal changing?
Greater Anglia Metro
Greater Anglia Metro

Posts : 135
Join date : 2012-03-24
Age : 31
Location : London

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Sun Dec 03, 2017 10:18 pm

Ah, I knew there was something I forgot with these Razz

(TLDR: I was asked for this a while back, and promptly forgot about it after thinking up the list of flaws.....)

Need to think a little about the best way to implement that one, but I'll try and sort something basic out next week sometime.
On the most basic level, it's easy enough to hook that in, but getting something that has no kinks is another kettle of fish entirely.

Edit:
I now have a working prototype.

Queries please:

  • Is editing the radius / volume essential, desirable or unimportant?
  • Should the sound play including when the object is hidden/ unhidden, or should this be configurable?
  • Would a list of sounds for each state be an absolute must or just desirable? (Might be a PITA, but do-able....)

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by Greater Anglia Metro Sun Dec 03, 2017 11:46 pm

- Radius would be needed I think, volume not so important to me as I'd rather edit the sound file directly.
- I think it's best to configure this.
- personally I only need the sound to play as the state changes (when the shunt signal rotates) - I suppose this is as the object is changing state? What others need could be different
Greater Anglia Metro
Greater Anglia Metro

Posts : 135
Join date : 2012-03-24
Age : 31
Location : London

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Wed Dec 06, 2017 4:19 pm

OK, I think we've got somewhere Smile

I've implemented this draft animated format, which attaches to the preceeding [Object] section in an animated file:
Code:
[StateChangeSound]
Filename = crossing.flac
Pitch = 1.0
Volume = 1.0
PlayOnShow = true
PlayOnHide = true
Radius = 30.0

Available options:

  • FileName : The relative path to the sound or FileNames : A comma separated list of sound files for each state (Starts with -1 ==> hidden)
  • Pitch : Set the pitch
  • Volume : Set the volume
  • PlayOnShow : Controls whether a sound is played when this object is shown.
  • PlayOnHide : Controls whether a sound is played when this object is hidden.
  • Radius : Controls the radius in meters at which the sound is played at full volume.


NOTES:
If not using a sound & the FileNames format, this must be left blank, e.g.
Code:
FileNames = ,shown.wav, state1.wav etc.

If the FileNames list of sounds is less than the number of states, no sound will be played.


Need to do some more testing of my own before letting this loose in the general builds, but feedback appreciated Smile
https://github.com/leezer3/OpenBVE/pull/207

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Thu Dec 07, 2017 2:17 pm

Now in the daily builds Smile

Feedback appreciated please!
(Note that this makes a lot of changes to the internal plumbing for animated objects. I don't believe that anything is broken, but I stand to be corrected....)

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by Marc Riera Fri Dec 08, 2017 4:48 pm

I'm not entirely sure if it's a side effect of the latest change to animated objects, but many of them have stopped working. The animated cars (texture shift) in Chashinai Railway aren't shown, and 3D cabs (I've tested the Class 323) become glitchy when pressing F1 to switch views.

Signals fail too (they always appear turned off), so maybe it's a mix of these latest changes to animated objects and other commits that may have messed up the code.

Marc Riera

Posts : 28
Join date : 2015-12-21
Location : Barcelona, Spain

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Fri Dec 08, 2017 10:25 pm

Hmm.

Will do some digging Sad

I haven't seen anything immediately broken, and I've been testing primarily with D1015, which is a full 3D cab.

Signals have definitely been working here too, as ironically I was using a hacked signal to test the state change sounds ;p

Probably something simple, as there were a *lot* of plumbing changes internally.

Edit:
The 3D cab issues smell related to the change to allow multiple interior views via XML I suspect, rather than the sound stuff.

Will try and chase tomorrow or Sunday evening Smile

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Sat Dec 09, 2017 11:21 am

Oops....

One small typo in a variable name, and rather a lot stops working Razz

(TLDR: This actually only affected the second onwards placement of an animated object (These aren't necessarily consecutive either), and was caused by the clone function, well not cloning it correctly....)

3D cab issue should also be fixed now.
https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2017-12-09.zip

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by Marc Riera Sat Dec 09, 2017 1:40 pm

Everything works again as expected, thank you!

Marc Riera

Posts : 28
Join date : 2015-12-21
Location : Barcelona, Spain

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Sun Dec 10, 2017 10:11 pm

Today's build fixes an issue with these in Object Viewer and Route Viewer, plus adds an info message that these are *only* supported in the main program Smile

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by ebennekom Thu Jan 11, 2018 12:31 pm

I've got a problem adding sound to an animated object.  It's probably to do with me not understanding where to use it, but just can't figure it out.

So I'm assuming the snippet for implementing a sound to an object as per the posted code on the previous page goes in the .animated file itself. Is that correct? And if true, it should go below the object itself?

Based on this assumption I got the following bit:

Code:
[Object]
Position = -16,0,0
States = ..\Misc\StraddleCarrier\StraddlecarrierYellow.b3d, ..\Misc\null.b3d
StateFunction = if[value + delta > 20, -1,0]
TrackFollowerFunction = if[value == 0, value - 1000, if[value > 0, value, value + 0.5]]
RotateYFunction = 3.1416
[Sound]
Filename = Motor3.wav
volume = 1.0
pitch = 1.0
position = 0,1,0

When loading the route containing the animation in routeviewer an errormessage appears:

Code:
Error Invalid statement [Sound] encountered at line 19 in file pathtofile

Loading the route itself with the object in it results in an immediate crash during loading

Code:
13:18:44  The route and train loader encountered the following critical error: Object reference not set to an instance of an object.
13:18:44  WARNING: Program crashing. Creating CrashLog file: pathtocrashlog


Removing any of the functions in the code doesn't make any diffference.

Edit: the soundfile is in the same folder as the .animated file, so the path shouldn't be a problem (me thinks)

Not sure if it matters, but I'm using v1.5.710.1374-travis.

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Thu Jan 11, 2018 1:37 pm

Ah, just a small flaw Razz
(No function in the sound, should have thought of that one.....)

Try this build:
https://vps.bvecornwall.co.uk/OpenBVE/Builds/OpenBVE-2018-01-11.zip

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by ebennekom Thu Jan 11, 2018 4:21 pm

Ah, great. Thank you

So i'm running the latest build now, and sure enough no more crashing. Error log stays nice and empty as well.

However.... there is still no sound to go with my animated object. Not even if trackfollowerfunction and the statefunctions are removed.

So I undressed the animated object to only include one object and attached a sound to it, and removed all other animated objects, but still. No sound.

Here is the code used:

Code:
[Object]
Position = -4,0,0
States = ..\RollingStock\NS 1300\NS1300.b3d
StateFunction = if[value + delta > 20, -1,0]
TrackFollowerFunction = -mod[20 * time, 1000] + 5
RotateYFunction = 3.1416
[Sound]
Filename = passingtrain.wav
volume = 1.0
pitch = 1.0
position = -4,1,0

The drivers train is generating sound so there shouldn't be an issue with my speakers.

Just to clarify. Am I right in assuming the code is correct and it being put into a .animated file is the correct way of doing it?

Also. I'm wondering, could it be the sound isn't looped and it only plays once after gamestart, so you have to stand next to your object to hear it? (the wav used is only about 3 seconds, but I've tested a few longer ones too)

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Sat Jan 13, 2018 11:39 am

Should be looped Smile

Your object's code now seems to work OK for me, so not sure off the top of my head. (I just stuffed a random sound effect onto it)
I'll stuff up a couple of my test objects at some point so you can see an example that works here.

Thoughts:

  • Check the volume of your sound.
  • The sound *only* plays whilst the attached object is visible, so try it with a permanantly visible object.
  • The sound is centered on center of the animated file.
  • With the default radius, you'll only be able to hear the sound for ~200m or so.
  • Try the object at the start of the route. Shouldn't make any difference, but it'll tell us if it's getting misplaced in the world somehow.

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by ebennekom Sat Jan 13, 2018 1:23 pm

Okay, I've just started from scratch with a testobject that's not moving.

Here's the code:

Code:
[Object]
Position = -16,0,0
States = ..\Misc\StraddleCarrier\StraddlecarrierYellow.b3d
[Sound]
Filename = K5LA.wav
volume = 1.0
pitch = 1.0
position = 0,1,0

Positioned as a freeobj at 60m (where my initial station starts)

Code:
60, .freeobj 0;459;0;0;0,

The result is, At gamestart the object is sitting -16m to my locomotive and its sound can be heard quite well. And! Even though I've not set anything to force it to loop, it does exactly that Smile 

Happy about, cause it's what's wanted although I don't understand what makes it loop.

However, If I change the position of the object to lets say 1000, so without changing the code of the object itself,

Code:
1000, .freeobj 0;459;0;0;0,   

The object is just sitting there, but the sound........ isn't No No matter how close I get to it.

Checklist:
.  Check the volume of your sound.
   Done. Sound is available at doppler points and the drivers train.
. The sound *only* plays whilst the attached object is visible
   Checked. The drivers train was standing 16m. to the right of it. Camera bang on top of it
. The sound is centered on center of the animated file
   Checked. The testobject is centered around x and z axis. It stands a little tall but changing it into a 2 meters high object didn't make any difference.
. With the default radius, you'll only be able to hear the sound for ~200m
  Didn't know that, but that's probably not the issue since,.. well, Its way closer than that
. Try the object at the start of the route. Shouldn't make any difference, but it'll tell us if it's getting misplaced in the world somehow.
  Tested. The object is sitting correctly at whichever position I declare for it in the route file.

What I'm after is to have a sound emitted from a trackfollower object just like in your video on the previous page. If you could post the code you used for it that would probably be of much help. I've tried finding a similar object in the routes I've got downloaded but couldn't find one that does the same thing

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by leezer3 Sat Jan 13, 2018 2:20 pm

To add a sound to a trackfollowing object as per the video, just clone exactly the same TrackFollowerFunction into the [Sound] section.

From your test, it sounds like the sound isn't getting moved with the object; I'd suspect it'll probably be found at the start of the route Sad
Will dig into this, but might not be until tomorrow.

leezer3

Posts : 1955
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by ebennekom Sat Jan 13, 2018 5:37 pm

leezer3 wrote:
From your test, it sounds like the sound isn't getting moved with the object

Ehm.... Yeah... Exactly. After 2 days of trying different stuff, it turns out the issue was exactly that. Somehow It never occured to me the sound is just another object and if you want it to move it needs to be treated as any other object.

So now I've got this

Code:
[Object]
Position = -4,0,0
States = ..\RollingStock\NS 1300\NS1300.b3d
TrackFollowerFunction = -mod[20 * time, 1000] + 5
[Sound]
Filename = passingtrain.wav
volume = 1.0
pitch = 1.0
Position = -4,0,0
TrackFollowerFunction = -mod[20 * time, 1000] + 5


And it works Smile

It also opens up another can of worms but thats for another day

Thanx a lot for your help mate (where's the beer icon if you need it)

ebennekom

Posts : 53
Join date : 2017-12-14
Location : Alicante, Spain

Back to top Go down

Animated Objects: Following The Track- Now with SOUND! - Page 2 Empty Re: Animated Objects: Following The Track- Now with SOUND!

Post by Sponsored content


Sponsored content


Back to top Go down

Page 2 of 2 Previous  1, 2

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum