ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
[sr_sound] and repeating sounds

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  23:15:18  8 June 2013
profilee-mailreply Message URLTo the Top
rkr5
(Novice)
 
On forum: 09/05/2009
Messages: 41
[sr_sound] and repeating sounds

How do I go about repeating a sound played by the [sr_sound] scheme?
Current logic:

[logic]
active = sr_idle

[sr_idle]
on_actor_inside = sr_sound %=check_weather_rain%

[sr_sound]
on_info = {-is_rain} nil
snd = ambient\waterflow ;placeholder
rnd = 100
;position = random
idle = 1



As it stands, everything works as intended - The player enters the space restictor, a function runs to check the level of rain, if there is more than a certain amount present an infoportion is given and the sound plays. However, once the sound finishes, it doesn't play again until I exit and re-enter the space restictor.
So, what do I have to do get the sound, or groups of sounds, to play in a loop upon entry of the SR?
  09:19:29  10 June 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
06/10/2013 9:25:35
Messages: 567
This is very similar to what I started over a year ago.

Short answer:
There are a few issues, but you mostly just need to create a sound theme, which will loop automatically when used.
http://sdk.stalker-game.com/en/index.php?title=Logic#Ph_sound

Long answer:
It looks like you want the sound to both loop and play in a random location. To loop a sound, you have to use a sound theme. However, the functions that support playing themes do not support playing sounds at random locations, too (as far as I know). Also, note that if sounds are played at random positions they become 3D sounds and, therefore, cannot be played in stereo. Asking to play a 3D sound in stereo (2D) will crash the game.

First, you need to define a theme in sound_theme.script. Themes, when used, will automatically loop. So, if you define multiple audio files in a theme, it will randomly pick between then indefinitely.

After you create a new sound theme in sound_theme.script, you will need to edit your code to look like this. You also want the sound to stop playing when it is no longer raining. I'm assuming you have an info_portion you made that can tell this.


in sound_theme.script:
ph_snd_themes["waterflow"] = { "ambient\waterflow" }

in your script:
[logic]
active = sr_idle

[sr_idle]
on_actor_inside = sr_sound_act@rain_noise %=check_weather_rain%

[sr_sound_act@rain_noise]
on_info = {-is_rain} sr_idle
theme = waterflow
delay = 0
max delay = 0
stereo = false

Try that. It should work. I have lots of success with this and, before you, I think I was the only one to have this idea. I have a lot of experience with this, so feel free to ask away. If you are curious, I have some dev diaries for LURK 1.2 where I talk about this stuff in-depth.
  17:03:14  10 June 2013
profilee-mailreply Message URLTo the Top
rkr5
(Novice)
 
On forum: 09/05/2009
Messages: 41
Thank you for the in-depth reply. I stumbled across your LURK dev diaries a few days ago while searching for info about sound schemes. Haven't had a chance to watch them yet, but I can assure you I will.

The topic at hand - I did try sr_sound_act, but I didn't like the way the audio was non-directional, nor the abrupt stop when stepping back out from under the trees.
I ended up using ph_sound and setting up another space restrictor up in the tree tops to play the audio from, but this led me to another problem - the audio loops fine, but there is a 500-750ms delay between the cycles, even with 0ms idle time (not to mention the amount of new story id's needed to get this working).
I spent a lot of time in my DAW making the loop sound invisible, and it worked perfectly when playing back the sample on repeat, but in-game... Not so good.

I think I'll go back to my source material, and try to put something together where the slight delay will blend with the samples. Perhaps if I record many different individual droplet samples, I could get away with it. I'll also try working with sr_sound_act again - if the samples are short, the abrupt end to the audio would be almost unnoticeable.


One question though: I noticed while setting this up in Agroprom, there are many static sound sources dotted around in almost random places, playing things like wind noise and the like, but these sound sources don't seem to continuously play like, say, the transformer hum in X18.
The values used in the properties of both sound sources are exactly the same (00.00 in all fields), so I'm wondering, is there a way to "switch off" a static sound source? Because that would make this a whole lot easier.
  01:46:12  11 June 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070

---QUOTATION---
[sr_sound] and repeating sounds

How do I go about repeating a sound played by the [sr_sound] scheme?
Current logic:

[logic]
active = sr_idle

[sr_idle]
on_actor_inside = sr_sound %=check_weather_rain%

[sr_sound]
on_info = {-is_rain} nil
snd = ambient\waterflow ;placeholder
rnd = 100
;position = random
idle = 1



As it stands, everything works as intended - The player enters the space restictor, a function runs to check the level of rain, if there is more than a certain amount present an infoportion is given and the sound plays. However, once the sound finishes, it doesn't play again until I exit and re-enter the space restictor.
So, what do I have to do get the sound, or groups of sounds, to play in a loop upon entry of the SR?
---END QUOTATION---





---QUOTATION---


Try this way...

[logic]
active = sr_idle

[sr_idle]
on_actor_inside = sr_sound@1 %=check_weather_rain%

[ sr_sound@1]
on_info = {-is_rain} nil
snd = ambient\waterflow ;placeholder
rnd = 100
;position = random
idle = 1
on_signal = sound_end | sr_sound@2


[ sr_sound@2]
on_info = {-is_rain} nil
snd = ambient\waterflow ;placeholder
rnd = 100
;position = random
idle = 1
on_signal = sound_end | sr_sound@1



---END QUOTATION---

  07:09:28  11 June 2013
profilee-mailreply Message URLTo the Top
rkr5
(Novice)
 
On forum: 09/05/2009
Messages: 41

---QUOTATION---

[logic]
active = sr_idle

[sr_idle]
on_actor_inside = sr_sound@1 %=check_weather_rain%

[ sr_sound@1]
on_info = {-is_rain} nil
snd = ambient\waterflow ;placeholder
rnd = 100
;position = random
idle = 1
on_signal = sound_end | sr_sound@2


[ sr_sound@2]
on_info = {-is_rain} nil
snd = ambient\waterflow ;placeholder
rnd = 100
;position = random
idle = 1
on_signal = sound_end | sr_sound@1



---END QUOTATION---



I swapped a few things around, as I now longer have to call the rain check from xr_effects, but as far as I can tell this works very nicely! Now that has me wondering if I can use a fine-tuned on_timer to start the next sound a few hundred ms before the first sound ends with a slight fade in/out, as the slight delay is still there, but I'll have to wait until I get back from work to test that out.
Thanks, man!
  08:12:32  11 June 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
One of the team members on LURK has been working on a script that will crossfade space restrictor audio. If things progress with it I can share it with you.

Glad things seem to be working so far and that you found a solution to the looping issue.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2020 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.