Handling multiple sounds

Oldtimer
Posts: 834
Joined: 2002.09
Post: #1
Note: This thread was split off from this thread.

Quote:I think you may get a stuttering effect, depending on the sound, because you are restarting it each time. It might sound better to let the first one fade, then play the trailing end of the follow-up explosion?


Yes, I'm a bit worried about that. (It depends entirely on the sound, and on the delay between them, however.) Fading the first might be a good idea, but I'm a bit worried about the sound sounding cut off there too.

This sounds like it is going OT, so I'll be brief. Yes, or course you are right in your approach using three channels 'per sound'. What triggered my thinking was the fact that with my old architecture, each instance of, say, a monster, would carry around a copy of that monster type's entire sound set. For a monster with a gun sound and a dying sound, that could easily mount up to a 100 sound instances with 50 enemies. Sad Oh, well, I'll try this and see where I end up. Smile
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #2
It sounds like your current sound system is really messed up! Wacko

Why don't you just reimplement it so that you have a library containing one instance of each sound, a set of channels, and a way of playing a sound on the next free channel?

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #3
Quote:It sounds like your current sound system is really messed up

...which is the reason I ripped it out in the first place. Smile QuickTime isn't very easy to get a grip on (I don't think it even does channels in the traditional way) - right now I'm hunting flies with a bazooka. But I need it for MP3, SWF and WAV support, which makes it also a natural choice for handling all my sounds. Since the game isn't very heavy on multivox anyways, but thanks for the suggestion anyway.

Which brings me to a real topic for this thread - how would you create maximum depth with your sounds? I'm working on a solution (very common solution, too) similar to detail texturing - play a looping sound, and then put another loop on top of it of another length. That way, they will rarely repeat (depending on sample length).

Anyone have another neat-o method for killer sound?
Quote this message in a reply
Member
Posts: 100
Joined: 2006.05
Post: #4
SWF? Why would you use SWF? I've never seen a game use SWF (Besides a Flash game. In which I don't think your doing) Isn't SWF Macromedia Flash? You would need to like get some kind of SWF decoder library from Macromedia, and maybe even have to get permission to use it. Or is that a typo?.... Or am I just incredibly stupid. I dunno.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #5
SWF is very good for hand-drawn animations, which the game is all about. And no, there's no licencing fees, since I play them through QuickTime, which means Apple already did that for me. Smile But yes, we use flash movies as cut-scenes.
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #6
Quote:Originally posted by Fenris
...which is the reason I ripped it out in the first place. Smile QuickTime isn't very easy to get a grip on (I don't think it even does channels in the traditional way) - right now I'm hunting flies with a bazooka.

Right... I really don't understand QuickTime, which is why I'm still using snd resources and the Sound Manager. I'd like to be able to support external sound files (AIFF and so on), but I don't fancy wrestling with QuickTime's hideous API so I'll probably try to find some other way of doing it.

Quote:Which brings me to a real topic for this thread - how would you create maximum depth with your sounds? I'm working on a solution (very common solution, too) similar to detail texturing - play a looping sound, and then put another loop on top of it of another length. That way, they will rarely repeat (depending on sample length).

Anyone have another neat-o method for killer sound?

I'd be interested to see how your idea turns out. I can see one possible problem: you'd have to make sure the main sound and the detail sound weren't derived from the same original sample or you might get beating interference patterns. Ever heard that thing where you play the same explosion sound twice in quick succession and it comes out sounding really strange? Things like that could happen.

I don't have any really good suggestions for doing more interesting things with sounds, but you could try dynamically shifting the pitch of sounds as they play to give them a more irregular, organic feel. You could also try using a spatial sound API to get better effects.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Member
Posts: 440
Joined: 2002.09
Post: #7
If the licensing works for you, try FMOD. I recently started using it and can honestly say I will never use anything else for game audio.

Your multiple sound instance problem can be fixed pretty quickly with FMOD - load a sample once, and assign a pointer for each object that will play it. You then manipulate the sound though channels, rather than messing with the actual sample.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #8
No, licensing is unfortunately not OK - I will use fMod in the future, though. It rocks. Smile

I'm looking at maybe switching to the old Sound Manager for sound effects, and keeping QT for movies and music... that would probably do the trick. Smile
Quote this message in a reply
Moderator
Posts: 365
Joined: 2002.04
Post: #9
Quote:Originally posted by Fenris
I'm looking at maybe switching to the old Sound Manager for sound effects, and keeping QT for movies and music... that would probably do the trick. Smile

This may be old news to you, but I've just found this example on Apple's website which has two interesting functions:

SndSnip_PlayWAVEFileWithQuickTime() loads a .wav file using QuickTime, but could be changed to load any audio format. It puts the sound into a Movie handle and plays it with StartMovie().

SndSnip_ExtractSoundTrackIntoHandle() takes a Movie handle and turns it into something which can be played with the Sound Manager's SndPlay() function.

Mix those two functions together and you can load any sound format from disk and play it with the Sound Manager, and that solves the problem I mentioned in my last post!

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #10
_That_ I didn't know. Very helpful indeed! Grin Really great news, thanks! Grin
Quote this message in a reply
Post Reply