Author Topic: Music table  (Read 1696 times)

0 Members and 1 Guest are viewing this topic.

Offline Ransom

  • M. Night Russel
  • 210
  • It will not wait.
    • Rate of Injury
Er... how exactly do you add new soundtracks to the music table? I've got the music playing in-game, but at the beginning of each track there's a bit of... weirdness, stopping and starting a couple of times, but the rest of the track plays fine. I think it's something to do with the num_measures and/or samples_per_measure, or I just did something wrong with the .wav's. Any help?

 
[wiki] blah [/wiki]

Check the wiki link in the above bit of auto text, I'm pretty sure it's in there.
just another newbie without any modding, FREDding or real programming experience

you haven't learned masochism until you've tried to read a Microsoft help file.  -- Goober5000
I've got 2 drug-addict syblings and one alcoholic whore. And I'm a ****ing sociopath --an0n
You cannot defeat Windows through strength alone. Only patience, a lot of good luck, and a sledgehammer will do the job. --StratComm

  

Offline Ransom

  • M. Night Russel
  • 210
  • It will not wait.
    • Rate of Injury
Already checked the wiki - couldn't find anything on it. The Music Table section remains completely untouched...
« Last Edit: July 18, 2004, 02:45:45 am by 1494 »

 

Offline Ransom

  • M. Night Russel
  • 210
  • It will not wait.
    • Rate of Injury
*bump*

Anyone?

 

Offline Silent Warrior

  • 27
  • My thoughts go where no one knows to tread.
It's a bit of hit or miss with the numbers as far as I can tell (know that I haven't researched this table much). I usually use the length of the track in seconds as the last of the two mystery-numbers. Works reasonably well... Not perfect (arrivals are dreadful), but it isn't horrible.
I can't go home again until I find a stone a rose a door.
Choo choo, and that is the truth.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Ok, here's my take on this...

Fact
When sound is digitized into something like a wave file, there is an x number of data pieces taken which hold the info about the sound at that very movent. This is called the frequency of a wave file, because the frequency number is the number of times each second that a data piece, called a sample is taken. For CD quality music, this is about 44100 hz (aka 44.1 khz). Freespace 2's sound files mostly use 22050 hz.

My guess, based on the code
Freespace 2 uses a sound system which fades in between different loaded music files when an event occurs. An enemy ship warps in, for example. To make this *sound* right, it needs to know when it can fade out the file rather than just fading it indiscriminately.

So, each song in Freespace 2 is divided up into measures. At the beginning or end of a measure, Freespace 2 will fade to a different song if it's needed.

This means that to set the two variables correctly, samples_per_measure must be set to the number of samples per section of music. num_measures is the total number of sections for the music file.

So say you had a simple drumbeat - abaab - that was 2 seconds long, recorded at 22050 hz, repeating over a 30 second music file. To find the number of samples per measure, you would use the equation (frequency * measure time) or in this case (22050 * 2). To find the number of measures, you would use the equation (music time / measure time) or (30 / 2)
-C

 

Offline Silent Warrior

  • 27
  • My thoughts go where no one knows to tread.
That guess sounds a whole lot better than mine. I'll go with that. *Takes note*
I can't go home again until I find a stone a rose a door.
Choo choo, and that is the truth.

 
*points to the wiki's 'edit' button *
just another newbie without any modding, FREDding or real programming experience

you haven't learned masochism until you've tried to read a Microsoft help file.  -- Goober5000
I've got 2 drug-addict syblings and one alcoholic whore. And I'm a ****ing sociopath --an0n
You cannot defeat Windows through strength alone. Only patience, a lot of good luck, and a sledgehammer will do the job. --StratComm

 

Offline ShadowWolf_IH

  • A Real POF Guy
  • 211
    • CoW
Thanks WM, that should be most helpful .
You can't take the sky from me.  Can't take that from me.

Casualties of War

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions