CSBwin/CSBuild/Adding custom sounds

From DmWiki
Revision as of 13:23, 16 August 2008 by Gilles (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

_under construction, may as always take some time... :-/_


Here you will learn how a custom sound is added to your dungeon and how it can be triggered (played) using a DSA.

Don't worry about having to use a DSA to include a custom sound to your dungeon. It's not that hard.

Firstoff you'll need a sound.
If you have a mike and the necessary tools on your computer, it won't be much of a problem. Use (PCM) 11,025 kHz; 8 bits; Mono to record your sound and save it as a *.wav. You can also use a mobile device or Pocket PC to record speech or sounds, just don't expect it to sound all that well. With such a low sampling rate it is an art of it's own to make it sound good.

You might as well steal some sounds from conflux.
Simply load the CSBgraphics file from Conflux and use the export function.

Now let us add a sound to CSBgraphics.

Start CSBgraphics and choose "I" (for import). Choose sound (*wav) and add the file to the list. Also you need to select an ID. In out example it's "65".

.../picture/...

Now save your "CSBgraphics.dat" to the folder containing CSBwin.

Let's start CSBuilt now and add the sound to the dungeon using a DSA.
Take a look at the "copy/paste" section of the wiki. There you'll find the custom sound example, that is used in Conflux:

0S0 : G0C1 &= ?J0C3
0C0 : G0C1 &!= ?J0C2 LA L0 L0 &SOUND
0T0 : LB &RAND &NOT ?J0S0
0C1 : L$ &LOC2ABSCOORD &DROP &ROT L0 L4 &PARTY@ L1 &@
0C2 : N
0T2 : &NEG
0C3 : V3@ &NEG &+ &DUP L0 &< ?G0T2 &SWAP V2@ &NEG &+ &DUP L0 &< ?G0T2 &+ J0T3
0T3 : LA &SWAP L0 &SOUND
(Description from Zyx)
Sound is only played if the party is on same level as the DSA instance.
SET msg: sound is played with a volume inversely proportional to distance. So you should put the DSA instance right where the origin of the sound is supposed to be, or very near.
CLOSE msg: sound is played at full volume, no matter the distance.
TOGGLE msg: sound is played with a volume inversely proportional to distance, with a random chance. B parameter is the chance not to be played.

We won't need it in all of it's complexity. Just a sound that is played at 100% volume when a button/preassure pad is triggered.

So for a sound played at full volume, all you would need is the part of the DSA reacting to a "close" message:

0C0 : G0C1 &!= ?J0C2 LA L0 L0 &SOUND
0C1 : L$ &LOC2ABSCOORD &DROP &ROT L0 L4 &PARTY@ L1 &@
0C2 : N
0C3 : V3@ &NEG &+ &DUP L0 &< ?G0T2 &SWAP V2@ &NEG &+ &DUP L0 &< ?G0T2 &+ J0T3

CSBuild custom sound pic1.JPG

Again, this is still by far more than we need.
For a set message a sound triggered by

(S0:) LA L0 L0 &SOUND

is much simpler.

Note the parameter "A" in the first line.
The ID of the sound is 65, so you could as well type

L65 L0 L0 &SOUND

yielding the same result.

But for more flexablility it is of course more useful to use the parameter A, so you won't have to edit the DSA itself if you want to change the ID of the sound to be played.

Now all that needs to be done is adding a preasure plate, a button, or any other trigger (even another DSA?) targeting the DSA that plays the sound.

You are now free to add sounds, speech, quest given verbaly, maybe even a talking sphere that guides the player throughout the dungeon.
This is the point to look hard for some talented artists. ;-)

Have fun!