Difference between revisions of "Changing sounds"
From XStoryPlayer Wiki
(7 intermediate revisions by the same user not shown) | |||
Line 25: | Line 25: | ||
</li> | </li> | ||
<li>Open the <code>/ai/speech</code> directory and create a sub-directory called <code>/saiko</code>.</li> | <li>Open the <code>/ai/speech</code> directory and create a sub-directory called <code>/saiko</code>.</li> | ||
− | <li>Add the <code>alien_hello1.wav</code> from the 'Tutorial | + | <li>Add the <code>alien_sound/alien_hello1.wav</code> from the '[[Tutorial resource pack]]' to the newly created <code>/ai/speech/saiko</code> directory.</li> |
− | <li>Now we want Saiko to say 'hello' in her alien | + | <li>Now we want Saiko to say 'hello' in her alien voice when you say 'hello' to her.<br> |
Open the <code>/init/std/base/char/brain/code/run/basic_func_sentence.dat</code> file. This file contains functions for basic responses.</li> | Open the <code>/init/std/base/char/brain/code/run/basic_func_sentence.dat</code> file. This file contains functions for basic responses.</li> | ||
− | <li>Locate | + | <li>Locate these functions and change the code as follows. |
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
<talk_say_hello> | <talk_say_hello> | ||
Line 56: | Line 56: | ||
</li> | </li> | ||
<li>Now start the mod dungeon Saiko scene and say 'hello' to Saiko. She should respond by saying something back in her alien sounding voice.</li> | <li>Now start the mod dungeon Saiko scene and say 'hello' to Saiko. She should respond by saying something back in her alien sounding voice.</li> | ||
+ | </ol> | ||
+ | |||
+ | ===Adding scene sound=== | ||
+ | |||
+ | <ol> | ||
+ | <li>The easiest way to add a sound to a scene is to use the radio object. There are other ways to add a sound to a scene but we will come to that in more advanced tutorials.</li> | ||
+ | <li>Open the <code>/scenes/sounds</code> directory and create a sub-directory called <code>/alien</code>.</li> | ||
+ | <li>Add the <code>alien_sound/alien_abient1.mp3</code> from the 'Tutorial Resource Pack' to the newly created <code>/scenes/sounds/alien</code> directory.</li> | ||
+ | <li>Now we want the sound to play in the dungeon scene.<br> | ||
+ | To do this add a radio object to the <code>/init/stories/dungeon/scenes/dungeon1.dat</code> file like this: | ||
+ | <syntaxhighlight lang="cpp"> | ||
+ | tv_objecti:PSCREEN PSCREEN1 | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | |||
+ | // Add this code under the PSCREEN1 tv object | ||
+ | radio_objecti:RADIO RADIO1 | ||
+ | { | ||
+ | obj_name = "object_table3:table2"; // Uses table object as sound location | ||
+ | |||
+ | status = true; // Radio is turned on | ||
+ | |||
+ | channel = 0; // Active channel | ||
+ | |||
+ | // The channel file, it starts with # to indicate that the file can be found within the pack directory. | ||
+ | channels | ||
+ | { | ||
+ | file = "#scenes/sounds/alien/alien_abient1.mp3"; | ||
+ | pos3d_min = 6.0; // From this distance 3d volume will decrease | ||
+ | volume = 1.0; // Volume | ||
+ | } | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | </li> | ||
+ | <li>Now start the mod dungeon Saiko scene and you should hear an alien ambient sound.</li> | ||
+ | <li>Ok now you are ready to start the next tutorial '[[creating a story]]'.</li> | ||
</ol> | </ol> |
Latest revision as of 13:16, 9 January 2015
The scene sounds can be found in the ./pack/pack_dungeon/scenes/sounds
directory.
The character sounds can be found in the ./pack/pack_dungeon/ai/speech/default
directory.
Sound format
- XStoryPlayer character sound files are in .wav format.
- XStoryPlayer scene sound files that have long duration are in .mp3 format.
- Most sounds are 3d, so there have a location in the scene.
- We have support for .lwv files, but because Microsoft decided to stop using them as well.
Adding talking sound
- At the moment the girls only make sounds during sex and in other special situations. It is however possible to add sound files to sentences.
To let a character make a sound the following code can be used:talk.s = "aaaahhhhhhh"; // The mouth movement is derived from this text talk.file = "scream1"; // The file in the ai/speech directory talk.volume = 1.050; // The sound volume talk.text = false; // Do not show text in dialog window
First the
ai/speech/saiko/
location is tried to find the sound file. If the file is not there theai/speech/default/
location is used.
This allows you to add girl specific sounds. - Open the
/ai/speech
directory and create a sub-directory called/saiko
. - Add the
alien_sound/alien_hello1.wav
from the 'Tutorial resource pack' to the newly created/ai/speech/saiko
directory. - Now we want Saiko to say 'hello' in her alien voice when you say 'hello' to her.
Open the/init/std/base/char/brain/code/run/basic_func_sentence.dat
file. This file contains functions for basic responses. - Locate these functions and change the code as follows.
<talk_say_hello> // Add these lines talk.file = "alien_hello1"; talk.volume = 0.95; ... </talk_say_hello> //---------------------------------- <talk_say_helloagain> // Add these lines talk.file = "alien_hello1"; talk.volume = 0.95; ... </talk_say_helloagain>
- Now start the mod dungeon Saiko scene and say 'hello' to Saiko. She should respond by saying something back in her alien sounding voice.
Adding scene sound
- The easiest way to add a sound to a scene is to use the radio object. There are other ways to add a sound to a scene but we will come to that in more advanced tutorials.
- Open the
/scenes/sounds
directory and create a sub-directory called/alien
. - Add the
alien_sound/alien_abient1.mp3
from the 'Tutorial Resource Pack' to the newly created/scenes/sounds/alien
directory. - Now we want the sound to play in the dungeon scene.
To do this add a radio object to the/init/stories/dungeon/scenes/dungeon1.dat
file like this:tv_objecti:PSCREEN PSCREEN1 { ... } // Add this code under the PSCREEN1 tv object radio_objecti:RADIO RADIO1 { obj_name = "object_table3:table2"; // Uses table object as sound location status = true; // Radio is turned on channel = 0; // Active channel // The channel file, it starts with # to indicate that the file can be found within the pack directory. channels { file = "#scenes/sounds/alien/alien_abient1.mp3"; pos3d_min = 6.0; // From this distance 3d volume will decrease volume = 1.0; // Volume } }
- Now start the mod dungeon Saiko scene and you should hear an alien ambient sound.
- Ok now you are ready to start the next tutorial 'creating a story'.