How to implement game music?

Started by
10 comments, last by bschmidt1962 10 years, 9 months ago

Hey, I'm new and I have a question.

I've worked on a couple games but I'm fairly noobish. So far I've only been required to produce audio files in various formats. I was wondering if there are other ways music is commonly implemented in games other than just putting on a .wav file?

Advertisement

Hey, I'm new and I have a question.

I've worked on a couple games but I'm fairly noobish. So far I've only been required to produce audio files in various formats. I was wondering if there are other ways music is commonly implemented in games other than just putting on a .wav file?

for music .wav is a poor format choice due to its large size, you could consider using mp3, vorbis, midi(instrumental only and the exact sound will vary between soundboards but the files become incredibly small), .mod (for tracker music), etc.

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

Hi Masked!

Your question is quite broad to get a proper answer in a simple forum post.

Do a search for "interactive Music". Also, download and try the game audio tools, FMod Studio (from www.fmod.org) and WWise (from audiokinetic.com). They take wave files and let you morph them into formats that games can use to have your music change depending on what the game is doing.

In general your topic is something that people spend weeks teaching, so it's hard to do it justice in a forum response :).

At GameSoundCon, we spend several hours talking about exactly this :)

-Brian

.

Brian Schmidt

Executive Director, GameSoundCon:

GameSoundCon 2016:September 27-28, Los Angeles, CA

Founder, Brian Schmidt Studios, LLC

Music Composition & Sound Design

Audio Technology Consultant

Hey, I'm new and I have a question.

I've worked on a couple games but I'm fairly noobish. So far I've only been required to produce audio files in various formats. I was wondering if there are other ways music is commonly implemented in games other than just putting on a .wav file?

for music .wav is a poor format choice due to its large size, you could consider using mp3, vorbis, midi(instrumental only and the exact sound will vary between soundboards but the files become incredibly small), .mod (for tracker music), etc.

Thanks for the tip, Those file types are generally of lower quality though right? Is there a way the lower quality is dealt with?

Hi Masked!

Your question is quite broad to get a proper answer in a simple forum post.

Do a search for "interactive Music". Also, download and try the game audio tools, FMod Studio (from www.fmod.org) and WWise (from audiokinetic.com). They take wave files and let you morph them into formats that games can use to have your music change depending on what the game is doing.

In general your topic is something that people spend weeks teaching, so it's hard to do it justice in a forum response smile.png.

At GameSoundCon, we spend several hours talking about exactly this smile.png

-Brian

.

Thanks for the response! I will definitively look into those tools.

Usually the final game will use an mp3 or an ogg but you should still be creating a lossless format like a wav initially. If they ask for a different format, you can convert it to the format of their choosing. The loss in sound quality is usually negligible but that's the user's decision to make.

It really depends on what device(s) the game audio will be running on. As Brian said, there are many tools and methods on how to best implement audio. Could you give us a bit more info on what kind(s) of games and device(s) they're being played on? This will help us give you more specific advice and tips.

Nathan Madsen
Nate (AT) MadsenStudios (DOT) Com
Composer-Sound Designer
Madsen Studios
Austin, TX

I've worked on an android/ios game and a pc/mac game.

I've worked on an android/ios game and a pc/mac game.

a few things to help you decide:

MIDI and MOD(also XM/IT for some trackers) files are sample based (MOD/XM/IT files use your own samples, MIDI uses the samples provided by the devices MIDI implementation), they are both fairly easy to modify at runtime. You can for example change the speed at which the music or parts of the music (such as the drum track) plays without also changing the pitch or you can just change the pitch of a track or a note without the speed being affected. One set of music tends to consist of several tracks played in parallell (normally each instrument has its own track or set of tracks), MIDI is far smaller than MOD as it doesn't contain its own samples(They're provided by the MIDI implementation(the soundcard or soundcard driver provides them). the quality for both formats depend on the sample quality. For dynamic instrumental music these formats are pretty darn awesome (For vocals they kinda suck, unless you are sampling vocals)

WAV and FLAC are lossless formats and their quality primarily depends on the samplerate and size. (FLAC is compressed so for actually deploying the music it is preferable over WAV)

a CD quality wav file (2 channels, 44.1Khz, 16bit) eats up 10MB / minute) , FLAC slightly less, these formats basically store a digital version of the soundwaves sampled at a fixed rate(1hz-4.3Ghz for Wav, 1Hz-655Khz for FLAC) which makes them extremely hard to modify in a sane way at runtime.

Mp3, Vorbis(ogg/oga), etc are similar to wav files but have been filtered and compressed using a lossy filter/compression, those formats give you a pretty good tradeoff between sound quality and filesize.

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

I've worked on an android/ios game and a pc/mac game.

For mobile you almost always have to use MP3 or OGG (or similar) for streaming music. For loading/off loading one hit sounds like short SFX wav can work but you'll probably need to use a lower spec like 22k. It really depends on what your clients are using to run their audio. For example Unity is great and can take hi-res assets and then export them out for whatever kind of platform the game is launching on. It can even do multiple versions - all from hi-res assets.

But if your client(s) are making their own audio engine, it's really up to what they support.

Things get a bit less restricted when it comes to PC/Mac but it's still a common (and best) practice to stream your music as a lower res file type (MP3, OGG, etc) because otherwise it could really drive down performance. If you're learning FMOD or other forms of middleware be sure to set long files (music) to stream and short files (SFX) as loading into RAM. If you try and load a 2 minute WAV file into memory while running the game, things could get messy!

Nathan Madsen
Nate (AT) MadsenStudios (DOT) Com
Composer-Sound Designer
Madsen Studios
Austin, TX

Thanks for the responses!


...

...If you're learning FMOD or other forms of middleware be sure to set long files (music) to stream and short files (SFX) as loading into RAM. If you try and load a 2 minute WAV file into memory while running the game, things could get messy!

I've never heard the term middleware before, is the term common? Is that a type of tool that a developer might expect me to be familiar with?

This topic is closed to new replies.

Advertisement