sega 500 custom music using ogg vorbis jeff “ezeikeil” giles jgiles@artschool.com jgiles

Post on 18-Dec-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Sega 500

Custom Music using

Ogg Vorbis

Jeff “Ezeikeil” Gilesjgiles@artschool.comhttp://gamestudies.cdis.org/~jgiles

Audio to date

We’ve imported our own noise files into UT.

And cover so much audio theory in the last 2 days, it’s coming our of our ears.

Audio to Date

All we’ve cover is small sound files we use as in game effects.

But have done nothing with the music…

Music in UT2k3

This is one of those items that has radically changed.

The previous version used to import from Digitally mixed music (.mod, .s3m, .it, etc). These are special music formats which include digitally recorded instruments as well as sequencing data .

Music in UT2k3

Games that use the earlier Unreal Engine builds (like Unreal, UT and Deus Ex) support Direct music (MID, MIDI and RMI) and (Music) Modules - usually shortened to "MOD“.

Which were then converted into .umx files

Music in UT2k3

Basically, a umx file doesn't contain anything special except for the music track itself which was imported into it. (not entirely true, but will do for our purposes).

Music in UT2k3

Also, CD audio could be used as music in maps.

However, CDA files don't need to be imported into a umx. You can just assign a track number to your map.

Music in UT2k3

Now, as we all know, music can be one of the most important factors in your map.

Setting the right music can create an awesome atmosphere and improve game play.

Music in UT2k3

And the UT2003 uses an incredible, open source, licence free audio format known as Ogg Vorbis.

http://www.vorbis.com

Music in UT2k3

This new system of using ogg file completely does away with the old MOD music and umx formats.

Music in UT2k3

Here’s an expert from an IRC chat log I found from an interview with the boys at epic (Mark Rein, Epic, VP )

[21:54] <UsAaR33> oh, and is module music stuff supported?[21:54] <MarkRein[Epic]> Usaa--> Good question. I don't think so.[21:56] <MarkRein[Epic]> USaa--> To mod music - I don't think it is supported with the new sound code[21:55] <Orpheus> is the galaxy sound system totally out ?[21:56] <MarkRein[Epic]> Orpheus--> Galaxy is long gone. The new system won't cause so many support headaches.

Why Vorbis?

Word used to be that U2 would use MP3s for its music.

But to prohibit the notorious copyright infringements that are well-known with the use of MP3s.

Why Vorbis?

Well, Ogg Vorbis is an open source encoding format and does NOT bring any licensing issues with it were MP3 does. And it brings lots of them too.

Another pro about this format is its higher compression rate, which is even higher than the trusted MP3 format!

So what is Ogg Vorbis?

Ogg Vorbis is a new audio compression format.

It is roughly comparable to other formats used to store and play digital music, such as MP3, and other digital audio formats.

So what is Ogg Vorbis?

It is different from these other formats because it is completely free, open, and unpatented.

More on Why Vorbis? Although not everyone realizes it, MP3 is a

"lossy" format.

Thus, much of the sound data is removed when MP3 files are created.

Vorbis is also a "lossy" format, but uses superior acoustic models to reduce the damage. Thus, music released in Vorbis will sound better than a comparably sized MP3 file.

More on Why Vorbis?

If you decide to sell your music in MP3 format, you are responsible for paying Fraunhofer a percentage of each sale because you are using their patents.

Vorbis is patent and license-free, so you will never need to pay anyone in order to sell, give away, or stream your own music.

Using Vorbis

OK, once again we’ve established that:

free == good

But how widely accepted is it?

Using Vorbis

At this point quite…natively supported in Winamp 3 and a few other media players.

Using Vorbis

Also, look at the frequency it’s running the audio.

44100hz! That’s CD quality!

Using Vorbis

So sweet!

Time to start ripping our own tunes into UT.

Using Vorbis Compression

I’ve 2 tools to do this CDex and oggdropXPd.

Both are free

<And free == good>

Using Vorbis Compression

CDex is a utility of extraction (ripping) any audio files from an audio CD.

http://www.cdex.n3.net/

The files can be ripped in either the plain WAV format or to a compressed file format (CDex supports many encoders).

Using Vorbis Compression

I used this to rip a track from CD into .wav or go directly into .ogg if I want

Personally, I’d go wav first so I could edit the track in sound forge if need be.

Using Vorbis Compression

But ripping straight to .ogg is real easy.

Just hit the settings button and specify the compression format from the roll down.

Using Vorbis Compression

If you like you can specify various bit rates for the compression. Here’s how I set mine up.

Using Vorbis Compression

Now, as mentioned, You may want to edit your track some before compressing into an ogg.

This means file to file…CDex won’t let you do this (at least not for the version available when I wrote this lesson). Straight CD ripping only.

Using Vorbis Compression

So, I prefer to go from CD to wav, do my editing in soundforge and then convert to ogg via oggdropXPd.

Using Vorbis Compression

Simply drag and drop your wav file. It’s default compression is really good!

Get the OggDrop here. http://www.vorbis.com/software.psp?pid=2

Using Vorbis Compression

However, if it’s not enough, right click for options.

Using Vorbis Compression

Just for giggles look at the differences in file size…wav, ogg and mp3

All at 44100hz.

Adding Your Music

Once again, remarkably easy.

Just move the new ogg file into the music directory.

Adding Your Music

Now in your level properties, place the name of the song and your good to go…

Simple…nes-pas?

Next track

And that’s all it takes to get a custom music track into UT.

Should you choose to, feel free to poke around the vorbis site. There are *lots* of tools and documentation.

Next track

And it’s open source for all you code monkeys.

More for Code Monkeys

Okay, we’ve covered lots on how to get some tunes into UT2003, but other than the level music, nothing so far on how to use them.

…and yes, there is functionality for this.

More for Code Monkeys

Lets start by looking at an item that we have already to play with.

The MusicTrigger.

The MusicTrigger

This little toy does exactly what it promises, toggles the music.

We can turn it on, off or swap tunes if we so choose.

The MusicTrigger

Now setting this up is not exactly what I would have expected being a trigger itself.

The catch is that the music trigger is passive and that it doesn’t seem to handle triggering itself.

The MusicTrigger

It sits waiting for a matching event to be broadcast by a trigger…much like the viewshaker.

Regular triggerTag: tunes

Music triggerEvent: tunes

At which time it does it’s thing with the music.

The MusicTrigger

Then the setup.

Select your ogg file ( no post fix to the Name ).

The MusicTrigger

How long you want the fade in our out to take.

The MusicTrigger

And lastly specify if you want the songs to fade out or not.

I recommend that you do, otherwise they’ll play at the same time.

More for Code Monkeys

Ok, so for the code, how does this song get played.

If you open up the actor class, you’ll find 3 handy functions:

More for Code Monkeys

native final function int PlayMusic( string Song, float FadeInTime );native final function StopMusic( int SongHandle, float FadeOutTime );native final function StopAllMusic( float FadeOutTime );

And most of this is pretty straight forward.

With one exception, PlayMusic returns an int.

More for Code Monkeys

And, once again, the great gods of no documentation point and laugh in our general direction.

But, in this case, it’s not that bad… actually… it’s kinda cool.

More for Code Monkeys

Look at how it’s used in the MusicTrigger.

SongHandle = PlayMusic( Song, FadeInTime );

…Thank you for good naming! We get a handle back which tells use which song is playing.

More for Code Monkeys

Now, SongHandle is declared as transient, so the data does not presist:

"objects belonging to this class should never be saved on disk". Only useful in conjunction with certain kinds of native classes which are non-persistent by nature, such as players or windows

More for Code Monkeys

But as far as I can tell, there is no way to tell from the SongHandle what song is playing, just that one is.

However, a handle can be passed into the StopMusic function to stop a specific song while it is playing.

More for Code Monkeys

Yet, if you really need to know which some is playing, there is another way to find out.

You can access it via the level. E.g.

Somestring = level.song;

More for Code Monkeys

And inside the levelinfo class, you’ll find a few oterh audio properties to play with:

Not a lot, but I sure you can come with some interesting fun with these.

var(Audio) string Song; // Filename of the streaming song.var(Audio) float PlayerDoppler; // Player doppler shift, 0=none, 1=full.var(Audio) float MusicVolumeOverride;

Now that’s done, you can grove to your own funky beats in UT.

top related