I’m trying to put together a minigun but I’m having issues with the audio clip. Basically I want the barrels to spin up and play a specific sound then once they are spun up they play a soundclip of the minigun shooting. Then once it spins down play another sound clip. I’m not sure what the best way to do this is. I tested it out using a regular soundclip of a rifle shooting but it created a lot of weird distortion. I’ll post up my script later tonight when I get home, but does anyone have any tips for this? I’m sure it’s a simple fix but I don’t know much about playing audio clips in this way. Thanks
I think you might be calling a function for a clip to play every time it shoots, try to set the audio player to loop and set it to play once while shooting
1.) Play startup sound
2.) If fire key held down long enough, stop playing startup sound and start playing bullet sound
3.) On fire key depress, stop playing fire sound and play stop sound
For the firing sound, you need to get an audioclip that loops perfectly and only call this once. Superimposing the playback of the same audio clip on top of another in the same frequency will cause distortion and other undesired behaviour.
Yeah, Meltdown nailed it. Your distortion is most likely coming from playing the same sound many times on top of itself, which also has other effects like making inefficient use of the audio system.
Awesome, thanks guys. Yeah I was using it in a function and yeah I was using one sound of a gun firing off once thinking that if it kept playing over and over I’d get that minigun sound effect. Makes sense to make a looping sound effect to play once.