Softvolumes and Sounds

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Softvolumes and Sounds

Postby Justintime9 » Thu Jan 21, 2010 2:43 pm

I have decided to add music to a certain area of my age. Now, this age (as most of you probably know by now, but should be mentioned nonetheless) has a page-swap property (not sure if that's what it's called, but that's what it does). I have a sound emitter on the "shared" page that makes the background sounds for the age. When I switch it to page 2 (or the Nighttime page) I've created a softvolume in the area of the age I want my music playing (so that it only plays in that area of the age, and not in the daytime).

At first I wasn't sure if I should mention the background sound in the softvolume script, but decided it's probably necessary. After it didn't work just having one softvolume, I created another one in the area of the age that I don't want the music playing, so I can tell URU that when in that region, only the background sound will play. However, knowing that I can only have one entry for each sound emitter, figuring out how to write that it should play in one softvolume but not in the other has been difficult.

After referring to my other age that I've used softvolumes for lamps in, and the wiki tutorial about them, I came up with this:

Code: Select all
MusicEmit:
    type: soundemit
    sound:
        flags:
          - looping
          - autostart
        file: ZfaNightmusic
        volume: 0.05
        type: bacgroundmusic
   
MusicSV:
    type: softvolume
    softvolume:
        type: convex
        softdist: 2.0
   
MusicEmit:
    sound:
        softvolume: ("!(OceanSV)"),MusicSV)
   
OceanEmit:
    sound:
         softvolume: U(OceanSV,MusicSV)
   
OceanSV:
    type: softvolume
    softvolume:
        type: convex
        softdist: 2.0

OceanEmit:
    type: soundemit
    sound:
        flags:
          - looping
          - autostart
        file: Ocean
        volume: 0.1
        type: ambient


I've included the sound emitter scripts as well just in case it might help. "MusicEmit" is my music emitter, and "OceanEmit" is my background sound emitter.

For the "MusicEmit" softvolume entry I've tried to tell it to play in "MusicSV" but not "OceanSV".
For "OceanEmit" I've told it to play in both softvolumes. As I've been typing this I just realized that there can't be two entries for "OceanEmit" and "MusicEmit" but don't know how I would merge them. I can tell I've probably screwed this up big time, so any help would be appreciated :D
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Softvolumes and Sounds

Postby D'Lanor » Thu Jan 21, 2010 3:44 pm

You do not need softvolumes. Sounds work fine in swap pages. Just put the sounds into the swap pages and they will load/unload along with them.

And in general you do not need a softvolume if the region you want your sound to play in is roughly circular. A 3d sound in the center will work fine and is easier to set up. Just remember to set the minfdist and maxfdist values when using 3d sounds. minfdist is the distance from the emitter at which the sound starts fading and maxfdist is the distance where it has completely faded.

Edit: You have a typo in "bacgroundmusic". And the ambient type should be ambience btw. The wiki is wrong. It works nevertheless because ambience is PyPRP's default type and it reverts to ambience even if you use a non-existent type like "blah". :D
Last edited by D'Lanor on Thu Jan 21, 2010 3:51 pm, edited 2 times in total.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Softvolumes and Sounds

Postby Justintime9 » Thu Jan 21, 2010 3:49 pm

well that's good to know, but actually what I had in mind is that in the daytime it just has the ocean background sound. When it swaps to nighttime the background sound will still be the only thing playing. The music will start only after the player enters a certain room.

The music should only play in that room and other rooms connected to it, but not the area with the swap button, thus the need for a softvolume. I don't want it to be a 3D sound either, but it should be the same volume throught the area it's playing in and only fade out when the player leaves the room.
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Softvolumes and Sounds

Postby Paradox » Thu Jan 21, 2010 4:01 pm

You also have two definitions of MusicEmit in your AlcScript. This will lead to chaos and confusion because AlcScript will (semi)randomly pick one definition to use values from, and completely ignore the other one.

In your case, you could end up with a sound that has a softvolume, but never plays and has a volume of 0. Never have duplicate AlcScript entries for the same object!
Paradox
 
Posts: 1295
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: Softvolumes and Sounds

Postby Justintime9 » Thu Jan 21, 2010 4:38 pm

yeah, I just realized that after I made that post, but not sure how to merge them.
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Softvolumes and Sounds

Postby D'Lanor » Fri Jan 22, 2010 10:45 am

Justintime9 wrote:yeah, I just realized that after I made that post, but not sure how to merge them.

Like this.

Code: Select all
MusicEmit:
    type: soundemit
    sound:
        flags:
          - looping
          - autostart
        file: ZfaNightmusic
        volume: 0.05
        type: backgroundmusic
        softvolume: ("!(OceanSV)"),MusicSV)

OceanEmit:
    type: soundemit
    sound:
        flags:
          - looping
          - autostart
        file: Ocean
        volume: 0.1
        type: ambience
        softvolume: U(OceanSV,MusicSV)
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Softvolumes and Sounds

Postby Justintime9 » Fri Jan 22, 2010 12:56 pm

:P wow, that was easier than I thought. However, is ("!(OceanSV)"),MusicSV) and U(OceanSV,MusicSV)
the right way to put the softvolume references in? I tried exporting, and it exported longer, but eventually I got this error:

Image

from the looks of it it has something to do with the parentheses.
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Softvolumes and Sounds

Postby Christian Walther » Sun Jan 24, 2010 4:10 am

Shot in the dark:
Code: Select all
        softvolume: ("!(OceanSV)"),MusicSV)

should be
Code: Select all
        softvolume: I(!(OceanSV),MusicSV)


You have three closing but only two opening parentheses here, a missing operator at the beginning (should be Intersection if I’m understanding you correctly), and it seems you misunderstood something about the need for quotation marks together with the ! operator: The quotes are only necessary if your whole expression (everything between softvolume: and the end of the line) starts with ! (and then around the whole expression). I’m not sure if quoting subexpressions as you do here would work, but I guess not.
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: Softvolumes and Sounds

Postby Justintime9 » Thu Jan 28, 2010 11:40 am

Ok, I tried that, and and after changing a few other things it exports. When I created my Music softvolume, I had to Ctrl+R it, divide it in half, and then extrude part, in order for it to fit the area it needs to encompass.

Once it exported, the first thing I noticed was that the Background sound wasn't playing. I then entered the room with the music softvolume, and there was still no background sound, and on top of that the Music didn't play. Finally, I entered the area of the MusicSV that had been extruded, and could hear the music.

Figuring that extruding must cause it to not work right, I made two softvolumes for the music, both completely rectangular, rather than extrude a single SV. Even though I gave it the same properties as the first SV, when I linked to the age the second softvolume was the only place the music played in. (much like the extruded area of the Softvolume previously.)

Here's my AlcScript:

Code: Select all
MusicSV:
    type: softvolume
    softvolume:
        type: convex
        softdist: 2.0
   
MusicSV2:
    type: softvolume
    softvolume:
        type: convex
        softdist: 2.0
   
OceanSV:
    type: softvolume
    softvolume:
        type: convex
        softdist: 2.0
   
MusicEmit:
    type: soundemit
    sound:
        flags:
          - looping
          - autostart
        file: ZfaNightmusic
        volume: 0.05
        type: backgroundmusic
        softvolume: I(!(OceanSV),MusicSV,MusicSV2)

OceanEmit:
    type: soundemit
    sound:
        flags:
          - looping
          - autostart
        file: Ocean
        volume: 0.1
        type: ambience
        softvolume: OceanSV,MusicSV,MusicSV2
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Softvolumes and Sounds

Postby Paradox » Thu Jan 28, 2010 8:31 pm

Code: Select all
softvolume: OceanSV,MusicSV,MusicSV2


That's not valid in any way, and will probably make Uru look for a softvolume object named "OceanSV,MusicSV,MusicSV2". You need to specify what logical operation to apply to the regions.
Paradox
 
Posts: 1295
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Next

Return to Building

Who is online

Users browsing this forum: No registered users and 3 guests

cron