This is basically what MOD file format is - some extras. If you're going to string together bits of music to make a sound why not play mod files and build it up in a tracker?
I'm using SDL_mixer for music and sound playback for the game I'm working on, and in order to conserve space we're thinking about chopping our music into chunks. A song consists of a few major parts (intro, verse, chorus, bridge, outro), so we figured it would be wise to create these portions separately and combine them at runtime to form the actual song. (i.e. intro, verse, chorus, verse, chorus, bridge, verse, chorus, outro.) This would help us keep our download smaller.
Now, the question: Does anyone know of a way to combine Ogg files? I could just load the segments into memory and play them one after another, but I'm worried about stuttering and lag between the segments.
Ideally, I would like to combine the files on disk when the game loads for the first time, and then just stream it as usual.
Has anyone tried anything similar?
Ryan Clark
Brace Yourself Games (Formerly of Grubby Games)
This is basically what MOD file format is - some extras. If you're going to string together bits of music to make a sound why not play mod files and build it up in a tracker?
Steve Verreault - Twilight Games
http://www.twilightgames.com --- http://www.indiegamer.com
"Do you really think it is weakness that yields to temptation? I tell you that there are terrible temptations which it requires strength, strength and courage to yield to.” - Oscar Wilde
I'm about to implement exactly that... stitching them together isn't an option for us because we will change it according to the "mood" of the game. So I hope it worksOriginally Posted by Ryan Clark
If stuttering and lag worry you, I'd try making each chunk start a little earlier and end a little later than it's supposed and cross-fade them.
Gabriel Gambetta
Google Zürich - Formerly Mystery Studio
Can MOD files actually produce output with quality as high as an Ogg? I've always thought of MODs as somewhat crummy sounding. Though, in truth, I haven't played a MOD in years, which could explain it.Originally Posted by svero
That's a good idea, but might you not lose the beat this way? That would be noticed, I imagine.Originally Posted by ggambett
Hm...
Ryan Clark
Brace Yourself Games (Formerly of Grubby Games)
This is exactly what I have on my schedule for next week(well, it was to be done this week, but we all know how that sort of thing goes). If you do definitely post your experiences here, it would be much appreciatedAnd when I get around to it if no one else has done so I'll post my experiences. Or if anyone has any better ideas(I share the same reservations about MODs as above)?
Todd
>Can MOD files actually produce output with quality as high as an Ogg?
If 16bit samples are used its pretty much cd quality. There are also tracker formats, which store the samples as mp3 or ogg.
Yeah, I just checked out a few MOD files that were lying around on the internet... it looks like a good musician can make it sound almost exactly like an MP3 or Ogg!
I think I'll investigate further. Thanks for the tip!
Ryan Clark
Brace Yourself Games (Formerly of Grubby Games)
Cletus uses this very technique - although I've cut up the music bar-by-bar, rather than section-by-section. The reason I haven't used a tracker is because I wanted to be able to use these bars to recombine into many different pieces of music. The reason I did this at all, was because I wanted to play the music on real instruments, have a lot of different music, and still keep the download size manageable.
As far as I am aware, trackers all pack their samples into the music file, whereas I needed all the different music files to draw their samples from a common pool. So I wrote my own simple tracker program.
That sounds like a good solution, AnthonySo your code handles the pitch shifting? Or are you storing pre-shifted samples?
You haven't noticed lag or stutter on lower-end test machines? It seems I've been having trouble with such things myself, so I'm hesitant to try anything unorthodox for fear of compatibility issues.
Ryan Clark
Brace Yourself Games (Formerly of Grubby Games)
If you want to pay a smallish fee the Bass sound library can use the MO3 format (ogg compressed mods). http://www.un4seen.com (get the xmplay app to play mo3's). FMOD also has it's .oxm format for ogg compressed xm's.
Hamsterball and Bejeweled 2 uses mo3. Skaven the brilliant musician has them for download here
http://www.futurecrew.org/skaven/
the 40 minute bejeweled ogg version is 40meg and the mo3 version is 350k!
http://www.flipcode.com/cgi-bin/fcsw...tegory=4&id=-1
- bunch of sound libs
At the very least you can the mo3 format to trigger your chunks of songs and not worry about coding all that by yourself. Plus you'd be *amazed* at how many professionals use mods and trackers.. it's just they don't tell anyone because people automatically think they sound crap for some bizarre reason. It's like saying the guitar sounds crap because I've only ever heard country music
EDIT: btw ModPlug tracker is a great free tracker for games that supports all the major mod types (use .it or .xm for new songs though). Plus the source code has been released (although it doesn't compress the samples, so you still have to use bass unless you implement this yourself)
http://www.modplug.com/modplug/index.php3?session=
- the forums
http://www.modplug.com/forum/index.php
Last edited by Vectrex; 02-11-2005 at 12:54 AM.