<sound>
Description
A sound node plays a sound. The sound can have directional properties, so the stereo effect moves with the camera, even for mono sound sources. For stereo sound sources, the channels are mixed and reverse to match the direction of the sound. Sounds can either be streamed live from the location, or they can be preloaded.
Sounds should be in mp3 format. The '#membername' syntax to load a resource from a cast can not be used with sound nodes at this time; sounds have to be external files.
Syntax
<tour> <scene> <sound id="soundID" behavior="someBehavior" src="yoursound.mp3" volume="90" ambient="20" pan="15" tilt="5" radius="10" streaming="true" loop="true" active="false" /> ... </scene> ... </tour>
Attributes
-
id
Unique id to reference the sound by. -
src
Relative url of the mp3 file to use. -
pan
If set, sets the pan value of the source of the sound in the scene. If the pan value is not set, but a tilt value is set, the sound volume will change according to the camera tilt, but the stereo image will not change.Values: true or false, defaults to false -
tilt
If set, sets the tilt value of the source of the sound in the scene. If the tilt value is not set, but a pan value is set, the sound is still directional but tilting the camera will not change the sound.Values: 0 - 360, or none -
radius
If pan and/or tilt are set, radius determines the camera angle in which the sound fades from 'volume' to 'ambient'Values: 0.01 - 180, defaults to 90 -
volume
Turns the sound on or off.Values: 0 - 100, defaults to 100 -
ambient
If the sound is directional, this is the residual volume ouside the specified radius.Values: 0 - 100, defaults to 0 -
active
Turns the sound on or off.Values: true or false, defaults to false -
loop
Sets the number of times a sound plays.
Values: 1 or higher, ot 'true'. If set to 'true', sounds loops indefinately. Defaults to 1 -
streaming
Specifies whether the sound resource is downloaded before playback commences. If set to true, only a short buffer will be downloaded before the sound playback is started.Values: true or false, defaults to false
Events
-
ready
Fires when the sound file is done loading and streaming = false. -
start
Fires when the sounds starts playing. -
stop
Fires when sound reaches its end and loop = false. -
loop
Fires when sound reaches its end and loop = true. -
change
Fires during sound playback (on each iteration).
Children
History
- 22-Nov-07: Restored lost documentation
fieldOfView | SPi-V dev
Re: <sound>
Is it supported in any 1.3 version ? If not, it should be clearly noted on this page that it is a feature added in 1.4, shouldn't it ?
Re: <sound>
A case of 'premature specification'. Updated the page, thanks
Re: <sound>
it seems to me that pan range is -180 to 180 and tilt range is -90 to 90, not 0-360 for both.
In event change, there's a remaining of "ramp" (copy-paste?).
Apart from those little doc glitches, you have really made a good job with sound. Congratulations.
Re: <sound>
fixed, thanks
Re: loop attribute
Regarding loop, we are used in Director to have :
loop = 1 means play once
loop = n means play n times
loop = 0 means loop indefinitely
Was it difficult for you to repro this using Flash to play sound ? Looks like this would be even more flexible but the attribute would have exactly opposite values then.
Re: loop attribute
This is how it currently works, except for 0. I'll add '0' as a synonym for 'true' in the next beta
Re: loop attribute
Do you mean that "true" will be treated the same as "0" and "false" the same as "1". It seems very odd to me, and just the opposite to what we are used to in Director development (I know, Spi-V users are not all Director developers ;-) )
Re: loop attribute
No, I did not mean that, but I did imply it by what I meant.
I suggest that for the 'loop' attribute, you either live in the 'true/false' world, or in the numeric world.
loop="true" is a logical way of saying that it is looping, right? Especially since that has always been the way to make a ramp loop. And if loop="false", it's only natural that it plays only once.
The unintuitive loop="0" is added for Director users.
PS: yes, ramps will be updated with the same logic.
Re: <sound> - ambient + radius....
Aldo,
Where can I find description to ?
I am looking for explanations of "ambient" and "radius" according to this:
<sound id="seagulls-sound" src="sound/seagulls.mp3" active="true" streaming="true" loop="true" pan="120" tilt="10" radius="120" volume="60" ambient="20"/>Karol
Re: <sound> - ambient + radius....
fixed documentation to include all attributes
Sound documentation replaced by ramp
Looks like the documentation for sound has been replaced by ramp
Jim
Graphic software developer
http://photocreations.ca
Re: Sound documentation replaced by ramp
sorry, has been high on the todo list for a while...
Re: Sound documentation replaced by ramp
fixed
Streaming
Hello
First of all, sound doesn't play locally in the browser, but it's not so bad, because on server and standalone viewer it plays nice.
But I've tried to use streaming attribute and it works very strange. In my project, I have two different mp3, which can be switched by the user. And switching works very randomly, once it does, once doesn't. Sometimes it doesn't load at all.
http://www.pimpek.lama.net.pl/spi/bug/sound.htm - without streaming
http://www.pimpek.lama.net.pl/spi/bug/sound_stream.htm - with streaming
(+ and - starts different sounds)
Sometimes if I wait a very long time, stream starts to play, but it rather should be much faster than no-streaming method...
Sound not working locally
Hello,
Sound doesn't work when a tour is viewed in browser from a local drive... (From server and in standalone viewer it's playing, so I think it's not my xml problem)
Can anyone help? I really need it!
Re: Sound not working locally
I will likely be reimplementing the sound engine (little more Flash, little less Director) for the next release of SPi-V. This is likely going to take a little while. Sorry.