Adding a sound to your age

Revision as of 16:05, 23 January 2008 by Nadnerb (Talk | contribs) (Add your sound file to blender)

With the newest plugin version, we now have the ability to use our own sounds in our Ages. Our ability to manipulate those sounds is at this point rather limited. This is what we can do as of now:

  • create an ambient loop that will play at equal volume everywhere in an Age
  • create a looping sound that emanates from a particular point and can be heard up to a defined distance from the emitter
  • start and stop sounds using logic triggers. (clickables, detector regions, python)

Things we will be able to do in the future, but cannot yet:

  • confine sounds to a region using softvolumes

Add your sound file to blender

In Blender, change one of your views to a "Audio Window". Click the selector to the right of the menus and select "OPEN NEW". Then browse to a sound file and open it. A waveform should show up in the window. The name at the top is the name you will give for the "file" in your alcscript. You can also add a sound by making a "Video Sequence Editor" window and using Add > Audio (RAM), and finding the sound.

If you press Alt-A in the Video Sequence Editor window, Blender will play the sound.

Example Showing audio and alcscript

Creating an emitter

Place the cursor where you want your emitter object to be. Use [space] > Add > Empty to create a new empty. In the editing panel (F9), change its name to something useful. This will be the point from which your sound will emit, if you choose to make it a 3D sound. If it will not be a 3d sound, then you don't really need to place it anywhere specific.

Create an AlcScript with the name of your emitter. You may omit the "| 3d" if you want a constant sound, and the "loop |" if you want the sound to only play once and then stop. "start" sets your sound to start automatically on link in, and it appears that uru will save the playing state of your sound between sessions.

<Name of emitter object>:
    type: soundemit
    sound:
        flags: loop | start | 3d
        file: psnlMusicPlayer (name of the wav file you imported without the extension)
        volume: 1
        type: <SoundFX, Ambience, BackgroundMusic, GUISound, NPCVoices>
        channel: <right, left>
        maxfdist: 250 (farthest distance from the emitter the sound can be heard. Only affects 3d sounds)
        minfdist: 50 (inside this distance, the sound is full volume. Only affects 3d sounds)

Using SoundRegions and Sound Messages

You can use a sound region to start and stop a sound. Entering and exiting the region will toggle the sound. To add one, use the scripts window menu Scripts > Add > PyPRP > Add a (Generic) Logic Region to add a region. Then you can either set the text properties:

regiontype: soundregion
soundemitter: <Name of sound emitter>

or use the following AlcScript:

<Name of sound region>:
    region:
        type: soundregion
        soundemitter: <Name of sound emitter>

Export

Your sound should now be ready, export the Age and check it out. If you don't hear anything, make sure that the sound file (something.wav) is located in the sfx/streamingCache folder in your uru directory. The "fdists" are in Blender units, and should be very large if you are using a 3D sound. Good luck!

-Nadnerb