Author Topic: New music coming your way soon!  (Read 128220 times)

0 Members and 1 Guest are viewing this topic.

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: New music coming your way soon!
That sounds convenient but might actually cause a few problems. One of the music.tbl parameters is based on the bitrate and would vary depending on whether the file is an ogg or one of the old, low quality wavs.
I would really, really like that to be automatic.  I don't actually know what that parameter actually measures though (I did know at one point, I just didn't care, and have since forgotten ;)).  If it's something that we can actually figure out when loading the file then we can code it in rather than having it in the tbl.  I have a feeling that it would be more preference rather than a code definable setting though.

Would this also work for voice files later on? That would save a little work for something in my campaign in the future.
Yep, the plan is to convert everything to do it.  Though, the current code will actually do this for anything which is streamed, including all music and most voices (de/briefing, etc).  The main reason that audiostr (the music/voice code) got this first is to prevent a crash if it happened to try and load a Theora movie by mistake.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New music coming your way soon!
The values in the TBL are defined as "Number of measures" and "Samples per measure", going by that, neither one should be preference-based or dependant on bitrate.

In fact, given that fs2_open plays VBR OGG (Vorbis :p) files, having it based on bitrate would make it virtually impossible to have any kind of consistent marking.
-C

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
According to Goober's comments on the wiki, the samples per measure value is obtained from the number of measures and the average bitrate. I guess the game could automatically determine that from the file size though.

The number of measures is actually more of a problem. I don't know of any simple way to find that value apart from trial and error (I can't make any sense of what Goober is talking about there), although that doesn't have anything to do with the music file quality.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New music coming your way soon!
Well, first of all, I'd take all that information with a grain of salt. The last time I tried to figure out Goober's music.tbl instructions, they didn't make any sense given how it should work, and when I checked the code, I only saw a partial relation in how it actually did work. That was awhile back though, and to be fair, Goober's instructions may have worked at some point in time.

Second of all, I think you're confusing bitrate with the bits per sample, because I did a text search on that page and don't see 'rate' anywhere.

Here goes...

Description of terms
Sample - A 'sample' is a measure of sound, a snapshot of it, if you will. Think of it as a frame in an animation
Sample Rate - The number of samples per second. The higher this is, the more samples you have, and thus the better sounding your sound file is. Music may be specified in hertz or kilohertz. A good-quality sounding file will generally be about 44100hz, or 44.1khz, which means that in one second, approximately 44 thousand samples are played.
Bits per sample - How much data each sample contains. Sizes are usually 8 bits or 16 bits, and in professional audio circles, up to 24 bits or more. The larger this is, the more range each sample has. This is not to be confused with bitrate; they are completely different.
Bitrate - Bitrate is used for compression algorithms. Basically what the bitrate means is that X bytes of data will be used to store information in a second. This is akin to varying the compression numbers on a JPEG image. 128-192kbps is generally regarded as CD-quality compression for OGG and MP3. However, with variable bitrate files, the encoder will actually remove sound data that would be inaudible or barely noticeable to the human ear.
Measure - A measure is not really a technical term, but a music term, and for Freespace purposes, it means a section of music. If you had a one-minute piece of music, the beats per minute could be identical as the number of measures in the wave. For a 2 minute file, it could be 2 x BPM. However, it really depends on the piece of the music. The reason Freespace2 wants this, is that it'll assume that the end of a measure is a graceful point to transition to the next song. (At least, that's my understanding of it)

How to use them
I've attached two images to this post, both are the output from a foobar2000 properties window. The first is for an OGG, the second is for a wave. Note that the OGG file does not list the bits per sample. All OGG files are decoded at 16 bits per sample in fs2_open, regardless of their bitrate; this is something that you specify within the program itself that's playing the OGG, rather than the file.

All that follows is based in an ideal world, where the TBL functions do exactly what they're supposed to.

Num measures
This is really up to your ear, because it's completely dependant on the music. For "Don't Panic", I'm going to throw out an arbitrary value that every measure should last 5 seconds. So, I use the formula

Total Length / Sample Length = Number of measures

Doing a bit of rounding, for "Don't Panic", I get:

135 / 5 = 27 measures

Samples per measure
If you already know the measure length, you can just do:

Sample Rate x Measure Length = Number of Samples

So for the OGG:

44100 * 5 = 220500 samples

Final Note

If for whatever reason, you know exactly how many measures you have in a file, but not how many samples, you can use the number of samples (just under the grey header for the second section)

Num Samples / Num Measures = Num Samples per Measure

[attachment deleted by admin]
« Last Edit: January 11, 2007, 05:32:03 am by WMCoolmon »
-C

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
Quote
Well, first of all, I'd take all that information with a grain of salt. The last time I tried to figure out Goober's music.tbl instructions, they didn't make any sense given how it should work, and when I checked the code, I only saw a partial relation in how it actually did work. That was awhile back though, and to be fair, Goober's instructions may have worked at some point in time.

Second of all, I think you're confusing bitrate with the bits per sample, because I did a text search on that page and don't see 'rate' anywhere.

The bitrate is the same thing as the kb/sec value, which is what Goober refers to there. The oggs have a variable bitrate as you said, but from what Goober is saying I think it's just looking for the average bitrate over the entire file.

You may be right about the rest though. :p It's been a while since I last did anything with music.tbl, but I don't remember ever having to take any bitrate changes into account (when switching to a higher quality file). The bits per sample is the only thing that seemed to matter. Now that I look at it again, I think Goober's instructions may be making this more complicated than it really is.

Quote
Measure - A measure is not really a technical term, but a music term, and for Freespace purposes, it means a section of music. If you had a one-minute piece of music, the beats per minute could be identical as the number of measures in the wave. For a 2 minute file, it could be 2 x BPM. However, it really depends on the piece of the music. The reason Freespace2 wants this, is that it'll assume that the end of a measure is a graceful point to transition to the next song. (At least, that's my understanding of it)

I see, this is the main thing I was having trouble with. But what exactly counts as a beat? Take something like battle part 2 of track F for example. It seems to have "big" beats every two seconds along with a bunch of smaller beats interspersed in between.
« Last Edit: January 11, 2007, 10:21:47 am by CP5670 »

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: New music coming your way soon!
If there's a technical definition for a beat beyond 'an interval in music at which a sound is regularly heard', I'm not aware of it. :p That is entirely up to the musician. If your song had lyrics, you might want each measure to be at the end of a line. Or you might want it to be at the end of each stanza.


I read through the wiki again, and I think I see what you're talking about.

Quote
A stereo track at 44,100 Hz will be 172 kilobytes per second

And this should be completely irrelevant for filling out the music.tbl (in the aforementioned ideal world). Although it is, technically, correct. OGG files are decoded to PCM before being sent off to OpenAL anyways, so it should be possible to do all the math consistently for WAV and OGG files, and ignore the bitrate of OGG files altogether.

I could see Goober's odd instructions being correct is if :V: made a mistake in coding the music.tbl in the first place. It's entirely possible, but I have yet to see any proof of it...
-C

 
Re: New music coming your way soon!
All I want is Anciants, and all the FS2 Battle Musics

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Re: New music coming your way soon!
I'd like to request M3 and M10 for the next round! :)

We really should try and get these all up in one place.
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Herra Tohtori

  • The Academic
  • 211
  • Bad command or file name
Re: New music coming your way soon!
Measure - A measure is not really a technical term, but a music term, and for Freespace purposes, it means a section of music. If you had a one-minute piece of music, the beats per minute could be identical as the number of measures in the wave. For a 2 minute file, it could be 2 x BPM. However, it really depends on the piece of the music. The reason Freespace2 wants this, is that it'll assume that the end of a measure is a graceful point to transition to the next song. (At least, that's my understanding of it)

Actually, tracks *should* always end so that an even number of measures in that track have been played. That's because almost every piece of music has an even number of measures... so having a track to switch at the end of an odd (uneven) measure would not be much better than having the tracks switch mid-measure.

I dunno how it's coded, though, but musically it should be like that.
There are three things that last forever: Abort, Retry, Fail - and the greatest of these is Fail.

 

Offline Scuddie

  • gb2/b/
  • 28
  • I will never leave.
Re: New music coming your way soon!
So it's been a while since any updates were made...  Is there anything to report, or is it essentially abandoned / put on hold?
Bunny stole my signature :(.

Sorry boobies.

 

Offline Nix

  • 28
  • In the morning!
    • Minecraft
Re: New music coming your way soon!
Not abandoned.  CP5670 and I are trying to get this done.  I haven't heard back from Dan on the files we're missing.  I've pretty much given him (CP5670) everything that I have, and he's working up the tables and such.  I'm trying to find free time to sit down and do processing and such, but I'm sure we got a big chunk of this down.  I do want to assure you that it's not abandoned.  I've been way out of the loop for a while due to me quitting my old job and getting a new job with the BLM out here. It's been pretty busy on my end filling out endless paperwork just to be hired. (Welcome to the US Government!)  I'll try to get back on track as soon as I can, but I'm pretty much tied down with some of the missing stuff.  That's all up to Dan, and I'm sure he's quite busy with composing for current V projects. I'll drop him a line this weekend to check in on status. 

Sorry for the delay everyone

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
I have most of the available FS2 tracks working correctly now. The table data for the ingame music hasn't been set up yet, but there are some changes being made to how the game handles that, so I'm holding off on it.

I have uploaded the briefing and menu tracks that we have here, if anyone is interested. I had to make subtle changes to a few of them to make them match the lengths of the originals. They're not perfect, but they sound pretty good to me. You can dump these into the data\music and data\tables folders (it would be a good idea to create a mod folder and put them in there) and the game will play them fine.

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
By the way, for future reference, I found out how the music.tbl parameters work. The samples per measure is computed using the formula SPM = (2*SF*L)/NM, where SF is the sampling frequency in hz , L is length of the music piece in seconds (only up to the point where the game is supposed to truncate it, not necessarily the length of the entire file), and NM is the number of measures. It turns out that the NM value is actually irrelevant. You can put in anything for it as long as the SPM is calculated correctly, since the game just multiplies them together.

 

Offline Nix

  • 28
  • In the morning!
    • Minecraft
Re: New music coming your way soon!
you know, Dan had mentioned that if the source files are in 22K, all we'd need to do is double the SPM value.  Somehow... I didn't think it was going to be that easy, especially for the slightly longer tracks here and there.  I spent quite a few nights with what Dan told me, and what Goober posted in the wiki and I couldn't ever get the tracks to line up right.  I couldn't even get the correct sample values to show up when I did my calculations on paper.  They wouldn't match Sound Forge's Samples measurements, I'd be millions of samples off.

Anywho, I will definitely check this out tonight, downloading it now.  Thanks for your help on this project!

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
No problem. :) Yeah, Dan is correct there. I think you can just disregard Goober's instructions. They make even less sense to me now that I know how it works. :p The L values are really the only thing that the game actually uses; they tell the game where to place the transitions between music pieces.

Do the Brief3 and Brief5 tracks sound okay to you? You'll notice that they were both taken from the FS2_Brief_03 file, but certain parts of the music that are repeated twice in the original versions are only played once in the file, so I had to cut and paste/mix pieces of them to make them sound right. This may actually be the background track for the Colossus movie, which has them merged together like this. The DVD archive also contains separated copies of these tracks, but they're among the files that are only in 22khz.

 

Offline Nix

  • 28
  • In the morning!
    • Minecraft
Re: New music coming your way soon!
05 sounds pretty good as is. I will have to break out the fine-toothed comb for 03 and re-up back to ya.  I'll see what I can do for that one.  Otherwise, it all sounds pretty darn good.  I have yet to test in-game tonight, probably do this on monday in the afternoon.  I love paid holidays! 

I can also hear that 04 had been downsampled, then re-upsampled back up to 44K, either that or the "magnitude" of the volume is way too high.  It sounds distorted, and that's the way it's always been from source.  It does sound good enough though to do better than what's already ingame, but I have told dan awhile back of what we're missing. 


 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
I noticed the same thing with 04. We have a couple of different versions of that one, but they all sound either the same as this or worse.

See if you can do better with 03. I'm not entirely happy with that one either. The thing with it is that the part at the beginning (which is what needs to be repeated) is merged into the end of the 05 music. This makes duplicating it somewhat harder than it would normally be, since you can hear bits of 05 right at the merging point.

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: New music coming your way soon!
Yeah, Dan is correct there. I think you can just disregard Goober's instructions. They make even less sense to me now that I know how it works. :p
Oops. :nervous:

Would you mind updating the wiki? :)

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: New music coming your way soon!
Okay, done. Hope you don't mind that I removed your instructions, to prevent any further confusion with this.

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: New music coming your way soon!
K. :)