sega 500 custom music using ogg vorbis jeff “ezeikeil” giles [email protected] jgiles

52
Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles [email protected]

Upload: aubrie-hill

Post on 18-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Sega 500

Custom Music using

Ogg Vorbis

Jeff “Ezeikeil” [email protected]://gamestudies.cdis.org/~jgiles

Page 2: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com 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.

Page 3: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Audio to Date

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

But have done nothing with the music…

Page 4: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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 .

Page 5: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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

Page 6: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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).

Page 7: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 8: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 9: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Music in UT2k3

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

http://www.vorbis.com

Page 10: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Music in UT2k3

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

Page 11: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 12: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 13: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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!

Page 14: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 15: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

So what is Ogg Vorbis?

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

Page 16: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 17: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 18: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis

OK, once again we’ve established that:

free == good

But how widely accepted is it?

Page 19: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis

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

Page 20: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis

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

44100hz! That’s CD quality!

Page 21: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis

So sweet!

Time to start ripping our own tunes into UT.

Page 22: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis Compression

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

Both are free

<And free == good>

Page 23: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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).

Page 24: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 25: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 26: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis Compression

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

Page 27: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 28: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis Compression

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

Page 29: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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

Page 30: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis Compression

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

Page 31: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Using Vorbis Compression

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

All at 44100hz.

Page 32: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Adding Your Music

Once again, remarkably easy.

Just move the new ogg file into the music directory.

Page 33: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Adding Your Music

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

Simple…nes-pas?

Page 34: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 35: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

Next track

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

Page 36: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 37: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

More for Code Monkeys

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

The MusicTrigger.

Page 38: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 39: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 40: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 41: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

The MusicTrigger

Then the setup.

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

Page 42: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

The MusicTrigger

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

Page 43: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 44: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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:

Page 45: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 46: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 47: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 48: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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

Page 49: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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.

Page 50: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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;

Page 51: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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;

Page 52: Sega 500 Custom Music using Ogg Vorbis Jeff “Ezeikeil” Giles jgiles@artschool.com jgiles

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