Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Goober5000 on March 29, 2003, 12:19:13 am
-
Making new battle tracks has aggravated Freespace modders for ages. No one knew how to do it, and the best method was usually estimating. Well, now that we have the source code, all we need to do is look. Here's what I discovered...
--Find out the number of measures in the file. The best way to do this is to keep time (by clapping or getting a metronome, finding the average time for one measure, and multiplying by the number of seconds. For reference, FS2_AArv_A01 is a march. Count "ONE, two, ONE..." and don't quite make it to "two" again. This corresponds with the table, where it says that this bit of music is 1.8 measures long. This is rather straightforward. The next part is what people had trouble figuring out, and needed the source to see.
--The number of samples per measure is the number of bytes per measure divided by 2. The event-driven music is usually formatted as 16 bits per sample. A stereo track at 44,100 Hz will be 172 kilobytes per second. So multiply this number by the length, in seconds, of your music to get the total number of kilobytes actually used by the music itself. Multiply this by 1024 to get the number of bytes in your music. Now divide the number of bytes by the number of measures to get bytes per measure, and then again by 2 to get samples per measure.
--There you have it. Put your file name, the number of measures, and the number of samples per measure in music.tbl, and you have the foundation of a new battle track. And with FS2_Open, you now have the capability to include up to 30 soundtracks and 30 briefing/mainhall tracks in a single music.tbl. :)
Note - I did some calculations based on the Volition soundtracks, and they didn't come out correctly, much to my puzzlement. I traced through the code, however, and that seems to be what it is. If anyone wants to take a look, the relevant stuff is in eventmusic.cpp.
-
Blimey, good effort Goob. I don't approve of the use of the word 'bollixed', however :p
-
No? Why? Did I miss a nuance somewhere? :) (AFAIK it just means to confuse or confound.)
-
Yeah, sorry, I just felt the forum needed a bit of a smut injection :)
-
:wtf:
*looks up word*
*word seems innocent enough*
*is confused :confused:*
*notices word etymology*
:eek:
Whoops! :o I will edit that straight away. :o
*Note to self - look up slang before using it*
-
Anyone ever tried Fruty Loops?
-
Awesome work Goober...counting for a pre-recorded piece of music seems very insane but doable and having the information is really useful.
How does it really benefit us however? TBP's been working for 2 years without any proper calcuations.
-
Originally posted by TrashMan
Anyone ever tried Fruty Loops?
Yes. Made lots of stuff with it, such as this (http://www.3dap.com/hlp/hosted/scroll/misc/liliths_eden.mp3) dark and trippy little number. What has that to do with this topic, however?
-
Naturally, Volition's music files don't calculate sizes correctly, as they use the ADPCM compression codec, which means the bitrate is significantly lower. ADPCM generally reduces the sizes four-fold.
-
I'm still a bit confused here, as I am not really familiar with the music terminology. :p What exactly is a measure? Is it a drum beat sound? A certain length of time?
-
BPM is a way to measure tempo. It basically tells you how fast to play the music from notes. It's dependant on how you composed the music, not the destination file (Unless that file is a .mod, .s3m, .xm or .it).
-
Originally posted by Sesquipedalian
Yes. Made lots of stuff with it, such as this (http://www.3dap.com/hlp/hosted/scroll/misc/liliths_eden.mp3) dark and trippy little number. What has that to do with this topic, however?
Where can I get Fruty Loops?
-
Fruity loops is commercial software that costs lots of money. Do what you always do, and go warez it.
Disclamer: The author of this message is in no way trying to evoke illicit activities. He is merely telling people to act the way the already do :)
-
Now that you've implemented that play-music SEXP, will a track still have to be in the music tbl?
-
Dude, READ THE SEXP PAGE. It tells you how to use it.
-
I have, and it told me nothing.
-
Hmm. I guess it didn't address that.
No, any music played with play-sound-file does not need to be in music.tbl. :)
-
YES!
-
Ah, but does it play continuously? :D
-
Originally posted by TrashMan
Anyone ever tried Fruty Loops?
hehee shhhhhhhhhhh! your letting out the secret music program!
now ima have to redo the album....