Jump to content
  • Advertisement
Sign in to follow this  

music/sfx questions, possibly beat game related

This topic is 3028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I'm working on a Pac-Man-style game, and I've been thinking about the music quite a bit. I've never actually done any sound programming, so my ideas are purely conceptual at the moment, but I don't want to add sound in as an afterthought. I'll likely be using DirectX 10 for sound.

Here's what I'm thinking:

Do you remember the original Pac-Man sounds? There is a constant "ooOOooOO" sound whether you're eating pellets or not. I've always associated that with the ghosts for some reason. There's also a "wacka-wacka" sound that only plays when you're eating pellets.

I want some sort of music that has three tracks, a melody, bass line, and percussion. The melody would constantly play. The percussion track would be analogous to the "wacka-wacka," only playing when the player is eating pellets. The bass line would be analogous to the "ooOOooOO," playing constantly, but I'd like the volume to vary, getting louder the closer the player is to a ghost. I'll probably need at least two versions of each track, one for normal play and one for being charged with a power pellet. The percussion track may be usable for both states.

How difficult would this be to implement? Can the music be from one file, and then just filter out or adjust the volume of certain frequency ranges, or would it be preferable to store the separate tracks in separate files? If I end up using separate files, can I just start playing them at the same time and trust they'll stay synced up, or will I need to ensure synchronicity somehow? And if so, then how?

And is it possible to adjust playback rate to to sync the beat to the player speed?

I'd appreciate any and all constructive advice, as I'm completely in new territory here.

Share this post

Link to post
Share on other sites
Don't know how sound works with DX, but with API's like FMOD or OpenAL you could:
- Make seperate music files and load them into sound buffers (like textures in a 3D API)
- For each music, make a seperate sound emitter/channel.
- You can play all of them at the same time, but initially faded out simply by putting the volume/gain on 0 dB. When action happens, you could mix the 2 musics by increasing channel A and decreasing B.

Hiding parts of the sound by messing around with the frequencies might be possible, but that seems rather difficult and probably not possible to do it 100% perfectly. As for the synchronicity problem, I wouldn't trust it. Maybe I'm incorrect, but you'll never know what happens in the deeper layers. A few things you could try:

- Make relative short sound samples. Wait until they are all finished, then start them again (instead of auto looping). Eventually errors will be corrected short after then.
- If the musics are really simple, you could break them up into a bunch of sound files and "compose" the music yourself (let a timer play each ooo, OOO or wacka).
- Be careful with streaming. If you stream the music from the harddrive, the speed is far more unpredictable I guess, thus going out of sync very likely to happen. Load the whole thing in the memory instead. This could be problematic if you have big sound files though...

If this is not sufficient, you may try it with a pitch regulator (like a PID controller). Never tried it but...
- Make sure each music file has the same length(you'll have to do that anyway)
- Make a leading timer (goes from 0 to 100%)
- Each cycle, check if each channel is at the right position. If the track position is behind the leading timer, then slightly increase the pitch to catch up. Or vice versa when it runs too fast. Do this slow and smoothly though, otherwise you'll end up with a oscillating pitch.


Share this post

Link to post
Share on other sites
Thanks for the thoughts. The sync may be a non-issue--I just don't know yet. So, I may be worrying for nothing. I'll keep your ideas in mind, just in case ;)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!