Jump to content

Sound Effects Cancelling Randomly


Telric

Recommended Posts

The sounds I've got going will play just fine when the buff triggers them, but will randomly stop playing in some conditions. If the player isnt at 100% health, or the player goes underwater, and some other scenarios. At first I thought it was just the audiosource. I use the weaponfire source, but changed over to the notification source. The issue still continued. I've also tried turning off the dynamic music, but that didn't fix it either. This gives no errors or anything, even in output log.

 

Here is a single node from my sounds.xml. It is triggered through a PlaySound action in buffs.xml. But it doesnt matter which sound I play, any will cause this issue. If anyone has encountered this and knows whats up, let me know.

<SoundDataNode name="HorseCourseStartSound">
<AudioSource name="Sounds/AudioSource_WeaponFire"/>
	<AudioClip ClipName="#@modfolder:Resources/TelricsHorses.unity3d?HorseCourseLoop" Loop="true"/>
	<!--<Channel name="Mouth"/>-->
	<Priority name="0"/>
	<maxVoicesPerEntity value="10"/>
  <LowestPitch name="0.95"/>
  <HighestPitch name="1.05"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value=".1"/> 
</SoundDataNode>



Video

Link to comment
Share on other sites

I had no idea what did you mean, so I watched the video and now I see. It looks like the change of environment is what causes this. Perhaps the water has its own sound that's playing by default when you go under water and replaces your own sound that started before? Just guessing, because the code you're showing here is something I haven't touched yet, so I have no idea about that. Have you tried to play with different values in the last line inside the node? Are those even explained anywhere? Like "MaxVoices" or "MaxRepeatRate"? What are those values doing? What would happen if you increased MaxVoices to say 20? Would it make any difference in relation to the problem?

Link to comment
Share on other sites

Well the max voices is how many instances of that specific sound can be playing at any one time, and repeat rate is how much time has to pass before the next instance of the sound can be played. Don't think those would do anything. Also, this doesnt just happen when going under water, if you are not at 100% health, it randomly cuts off. I only did the water showcase cuz its easy to replicate. Being below 100% health will randomly make it stop playing. No specific amount of time to pass or anything, just completely random.

Link to comment
Share on other sites

I've had to play with sounds a little bit. I can tell you MaxRepeatRate didn't seem to do a thing, at least not when loop="true".  I tracked most of my issues down to loop="true" in fact, but could never solve it.  I was trying to make a different set of sounds for a modded auger, and it would randomly go silent.  It would play 5-7 sounds (varied) then stutter for 2 seconds, then start again.  Very weird, and did it no matter what MaxRepeatRate or MaxVoices was set to.  Also, some items use the loop mechanism for continuous fire (smg, auger) while others just use a single sound in sound_repeat (electric fence).  The nailgun just uses sound_start with no repeat or loop, yet it still works.  It looks like they use to do it one way, then started to overhaul the system and never completed conversion.

 

I spent a few hours messing with it, and gave up when it started to feel like I had a ship's wheel on my belt buckle.

 

Arrrr, it drove me nuts.

 

Sorry, there isn't really in there that actually provides any help.  But want you to know you're not alone.

Link to comment
Share on other sites

With Audio Channels in general, if something else attempts to use that channel thats already in use, it will interrupt the current sound effect.

An audio channel is basically a single lane highway and if someone else has a higher or same priority wants to use it, they get to use it and cuts off whats there.

So from a technical stand point, that is one of the reasons this is occurring when the wave file stops playing. (IE: You going into the water)


The Dynamic Music stuff shouldn't interfere with this as it uses a different sound channel than sound effects does in game. (AKA Music Channel)

(Change the AudioSource to test for a good channel)
Other possible variables to use: AudioSource_VO_Announce / Sounds/AudioSource_VO

<SoundDataNode name="HorseCourseStartSound">
<AudioSource name="Sounds/AudioSource_Notifications"/>
	<AudioClip ClipName="#@modfolder:Resources/TelricsHorses.unity3d?HorseCourseLoop" Loop="true"/>
	<!--<Channel name="Mouth"/>-->
	<Priority name="0"/>
	<maxVoicesPerEntity value="10"/>
  <LowestPitch name="0.95"/>
  <HighestPitch name="1.05"/>
	<LocalCrouchVolumeScale value="1.0"/> <CrouchNoiseScale value="0.5"/> <NoiseScale value="1"/> <MaxVoices value="10"/> <MaxRepeatRate value=".1"/> 
</SoundDataNode>

I would say if your wave file still works by going under water with that change, but then cuts off randomly, then look into the "time" variable mentioned in the sound.xml file.



Side Note: I'm still learning about moding sounds and music myself. Just trying to provide my viewpoint to help out with your project. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...